diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index 8ab1702..62581f1 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -141,6 +141,9 @@ class SongSelect{ return a.id > b.id ? 1 : -1 } }) + if (localStorage.getItem("titlesort") ?? "false" === "true") { + this.songs.sort((a, b) => a.title.localeCompare(b.title)); + } if(assets.songs.length){ this.songs.push({ title: strings.back, @@ -262,6 +265,13 @@ class SongSelect{ action: "detarame", }); + + this.songs.push({ + title: "タイトル順で並べ替え", + skin: this.songSkin.customSettings, + action: "titlesort", + }); + this.songs.push({ title: strings.back, skin: this.songSkin.back, @@ -981,6 +991,20 @@ class SongSelect{ } localStorage.setItem("detarame", detarame); }, 100); + } else if (currentSong.action === "titlesort") { + this.playSound("se_don"); + setTimeout(() => { + let titlesort = localStorage.getItem("titlesort") ?? "false"; + const input = prompt("タイトル順で並べ替えするには\"true\"を入力してね!", titlesort); + if (input === null) { + // キャンセル + } else if (input === "") { + titlesort = "false"; + } else { + titlesort = input; + } + localStorage.setItem("titlesort", titlesort); + }, 100); } } this.pointer(false)