タイトル順で並べ替える機能を実装

This commit is contained in:
yuuki
2025-01-09 16:47:43 +09:00
parent dbf6dbdcce
commit ae84364572

View File

@@ -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)