missing files from last commit

This commit is contained in:
vvo
2022-12-31 19:51:06 +08:00
parent 577c6e30d9
commit c8b83ef8cc
2 changed files with 180 additions and 0 deletions
+108
View File
@@ -0,0 +1,108 @@
function generateEventToggles(eventInfo, eventConfig) {
let cardContent = $('<div class="card-content">')
if(!['bpl2022', 'konasute', 'xrecord'].includes(eventInfo['id'])) {
cardContent.append(
$('<div class="field is-horizontal">').append(
$('<div class="field-label is-normal"><label class="label" for="' + eventInfo['id'] + '">Enable</label></div>')
).append(
$('<div class="field-body"><div class="field"><div class="control"><label class="switch is-rounded"><input type="checkbox" ' + (eventConfig['toggle'] ? 'checked' : '') + ' name="' + eventInfo['id'] + '"><span class="check"></span></label></div><p class="help">' + eventInfo['info'] + '</p></div></div>')
)
)
} else {
for(const infoIter in eventInfo['info']) {
cardContent.append(
$('<div class="field is-horizontal">').append(
$('<div class="field-label is-normal"><label class="label" for="' + eventInfo['id'] + '_' + (parseInt(infoIter) + 1).toString() + '">Enable Set ' + (parseInt(infoIter) + 1).toString() + '</label></div>')
).append(
$('<div class="field-body"><div class="field"><div class="control"><label class="switch is-rounded"><input type="checkbox" ' + (eventConfig['toggle'][eventInfo['id'] + '_' + (parseInt(infoIter) + 1).toString()] ? 'checked' : '') + ' name="' + eventInfo['id'] + '_' + (parseInt(infoIter) + 1).toString() + '"><span class="check"></span></label></div><p class="help">' + eventInfo['info'][infoIter] + '</p></div></div>')
)
)
}
}
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(
$('<header class="card-header"><p class="card-header-title"><span class="icon"><i class="mdi mdi-calendar-clock"></i></span>' + eventData['events'][eventIter]['name'] + '</p></header>')
).append(
generateEventToggles(eventData['events'][eventIter], eventConfig[eventData['events'][eventIter]['id']])
)
}
}
$('div.main').append(
$('<div class="field is-grouped"><div class="control is-expanded"></div><div class="control"><button class="button is-link" id="event-submit">Apply</button></div></div>')
)
$('#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)
}
)
})
})
@@ -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."
}
]
}