From c8b83ef8ccea9a6f83b028b5806b2bd293400b6e Mon Sep 17 00:00:00 2001 From: vvo <> Date: Sat, 31 Dec 2022 19:51:06 +0800 Subject: [PATCH] missing files from last commit --- sdvx@asphyxia/webui/asset/js/events.js | 108 +++++++++++++++++++++ sdvx@asphyxia/webui/asset/json/events.json | 72 ++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 sdvx@asphyxia/webui/asset/js/events.js create mode 100644 sdvx@asphyxia/webui/asset/json/events.json diff --git a/sdvx@asphyxia/webui/asset/js/events.js b/sdvx@asphyxia/webui/asset/js/events.js new file mode 100644 index 0000000..0ba33b7 --- /dev/null +++ b/sdvx@asphyxia/webui/asset/js/events.js @@ -0,0 +1,108 @@ +function generateEventToggles(eventInfo, eventConfig) { + let cardContent = $('
') + if(!['bpl2022', 'konasute', 'xrecord'].includes(eventInfo['id'])) { + cardContent.append( + $('
').append( + $('
') + ).append( + $('

' + eventInfo['info'] + '

') + ) + ) + } else { + for(const infoIter in eventInfo['info']) { + cardContent.append( + $('
').append( + $('
') + ).append( + $('

' + eventInfo['info'][infoIter] + '

') + ) + ) + } + } + return cardContent +} + +async function readEventsConfigFile() { + try { + return await $.getJSON("static/asset/config/events.json", function(data) { + return data + }) + } catch { + return await generateNewEventsConfigFile() + } +} + +async function readEventsJsonFile() { + return await $.getJSON("static/asset/json/events.json", function(data) { + return data + }) +} + +async function generateNewEventsConfigFile() { + let hiddenEvents = ['bpl2021', 'bsb2021', 'gmz2022', 'pcbevent'] + let eventConfig = {} + let eventData = await readEventsJsonFile() + for(const eventIter in eventData['events']) { + let hidden = false + let toggle = false + if(['bpl2022', 'konasute', 'xrecord'].includes(eventData['events'][eventIter]['id'])) { + toggle = {} + for(const toggleIter in eventData['events'][eventIter]['info']) { + toggle[eventData['events'][eventIter]['id'] + '_' + (parseInt(toggleIter) + 1)] = false + } + } + if(hiddenEvents.includes(eventData['events'][eventIter]['id'])) { + hidden = true + } + eventConfig[eventData['events'][eventIter]['id']] = { + 'hidden': hidden, + 'toggle': toggle + } + } + console.log(eventConfig) + return eventConfig +} + + +$(document).ready(async function() { + let eventData = await readEventsJsonFile() + let eventConfig = await readEventsConfigFile() + for(const eventIter in eventData['events']) { + if(!eventConfig[eventData['events'][eventIter]['id']]['hidden']) { + $('div.main').append( + $('

' + eventData['events'][eventIter]['name'] + '

') + ).append( + generateEventToggles(eventData['events'][eventIter], eventConfig[eventData['events'][eventIter]['id']]) + ) + } + } + $('div.main').append( + $('
') + ) + + $('#event-submit').on('click', async function() { + $.each($('span.check'), function(index, value) { + for(const eventIter in eventData['events']) { + let toggle = true + if($(value).css('background-color').includes("54, 54, 54")) { + toggle = false + } + + if(eventData['events'][eventIter]['id'] === $(value).parent().children('input').attr('name')) { + eventConfig[eventData['events'][eventIter]['id']]['toggle'] = toggle + } else if ($(value).parent().children('input').attr('name').includes(eventData['events'][eventIter]['id'])) { + eventConfig[eventData['events'][eventIter]['id']]['toggle'][[$(value).parent().children('input').attr('name')]] = toggle + } + } + }) + + await emit("manageEvents", {eventConfig: eventConfig}).then( + function(response) { + alert('saved') + }, + function(error) { + console.log(error) + } + ) + }) +}) \ No newline at end of file diff --git a/sdvx@asphyxia/webui/asset/json/events.json b/sdvx@asphyxia/webui/asset/json/events.json new file mode 100644 index 0000000..0668347 --- /dev/null +++ b/sdvx@asphyxia/webui/asset/json/events.json @@ -0,0 +1,72 @@ +{ + "events": [ + { + "id": "xrecord", + "in_game_event": false, + "name": "X-record", + "info": [ + "1st set of songs from X-record; originally unlocked by playing either SOUND VOLTEX on the Valkyrie model, or beatmaniaIIDX on the Lightning model. Enable this option to have them automatically unlocked and saved to your account.", + "2nd set of songs from X-record; originally unlocked by playing either SOUND VOLTEX on the Valkyrie model, or beatmaniaIIDX on the Lightning model. Enable this option to have them automatically unlocked and saved to your account." + ] + }, + { + "id": "konasute", + "in_game_event": false, + "name": "グレイスからの挑戦状!! (GRACE kara no chousenjou!!)", + "info": [ + "Enables unlock for the song 'ドゥサンコオデッセイ!!' by cosMo@暴走P upon logging in. This song is originally unlocked by having played it first on the コナステ (Konasute) version of Sound Voltex.", + "Enables unlock for the song 'αzalea' by BlackY upon logging in. This song is originally unlocked by having played it first on the コナステ (Konasute) version of Sound Voltex.", + "Enables unlock for the song 'BAYONEX' by かめりあ as \"Revenge of Riot\" upon logging in. This song is originally unlocked by having played it first on the コナステ (Konasute) version of Sound Voltex.", + "Enables unlock for the song 'Reverenced Flower' by ぺのれり upon logging in. This song is originally unlocked by having played it first on the コナステ (Konasute) version of Sound Voltex.", + "Enables unlock for the song '《Re:miniscence》' by かねこちはる upon logging in. This song is originally unlocked by having played it first on the コナステ (Konasute) version of Sound Voltex." + ] + }, + { + "id": "bpl2021", + "in_game_event": false, + "name": "BPL応援 楽曲解禁スタンプラリー (BPL ouen gakkyoku kaikin stamp rally)", + "info": "Songs in this event are originally unlocked by accessing the official BEMANI PRO LEAGUE 2021 website and obtaining the stamp by watching VODs of the BPL. Enable this option to have them unlocked and saved to your account." + }, + { + "id": "bsb2021", + "in_game_event": false, + "name": "BEMANI 2021真夏の歌合戦5番勝負 (BEMANI 2021 manatsu no utagassen 5 ban shoubu)", + "info": "This is a cross-BEMANI event. Songs are originally unlocked by playing participating BEMANI games and earn 'Yell' points. Enable this option to have the songs unlocked and saved to your account." + }, + { + "id": "sdvx10thstamp", + "in_game_event": true, + "name": "SOUND VOLTEX 10th Anniversary", + "info": "Stamp event to unlock 7 songs. Enable this option to enable this stamp event." + }, + { + "id": "reflecstamp", + "in_game_event": true, + "name": "REFLEC BEAT Song Stamp Event", + "info": "Stamp event to unlock 5 songs originally from the REFLEC BEAT game. Enable this option to enable this stamp event." + }, + { + "id": "gmz2022", + "in_game_event": false, + "name": "いちかのごちゃまぜMix UP! (Ichika no gochamaze Mix UP! )", + "info": "This is a cross-BEMANI event. Songs include some that are shared from other BEMANI games and some that are mashup/remixes of the shared songs. These are originally unlocked by playing participating BEMANI games and earning points to fill different gauges. Enable this option to have the songs unlocked and saved to your account." + }, + { + "id": "bpl2022", + "in_game_event": false, + "name": "BEMANI PRO LEAGUE -SEASON 2-! Original Song", + "info": [ + "Enable this option to have songs from the 1st week unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Enable this option to have songs from the 2nd week unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Enable this option to have songs from the 3rd week unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Enable this option to have songs from the 4th week unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE." + ] + }, + { + "id": "pcbevent", + "in_game_event": true, + "name": "PCB Stamp Event", + "info": "Stamp event to earn PCB. Enable this option to enable this stamp event." + } + ] +} \ No newline at end of file