From 4d9bd687404455b0a19af0a67d2fa6faa61cf725 Mon Sep 17 00:00:00 2001 From: yuukiwww <167487626+yuukiwww@users.noreply.github.com> Date: Fri, 19 Apr 2024 13:27:43 +0000 Subject: [PATCH] =?UTF-8?q?=E5=89=8A=E9=99=A4=E5=87=A6=E7=90=86=E3=82=92?= =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/src/js/songselect.js | 40 +++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index a558a03..8ed30a1 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -512,6 +512,8 @@ class SongSelect{ this.toSongSelect() }else if(this.selectedDiff === 2){ this.toDownload() + }else if(this.selectedDiff === 3){ + this.toDelete() }else if(this.selectedDiff === 1){ this.toOptions(1) }else{ @@ -599,23 +601,7 @@ class SongSelect{ }else if(moveBy === 2){ this.toDownload() }else if(moveBy === 3){ - // ここに削除処理を書く - if (!confirm("本当に削除しますか?\nこの曲に問題がある場合や公序良俗に反する場合にのみ実行したほうがいいと思います\n10回に1回の確率で本当に曲が削除されます\n成功しても反映まで1分ほどかかる場合があります")) { - return; - } - fetch("/api/delete", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - id: this.songs[this.selectedSong].id, - }) - }) - .then((res) => res.text()) - .then((text) => { - alert(text); - }); + this.toDelete() }else if(moveBy === 1){ this.toOptions(1) }else if(moveBy === "maker"){ @@ -3079,6 +3065,26 @@ class SongSelect{ }) }) } + + toDelete() { + // ここに削除処理を書く + if (!confirm("本当に削除しますか?\nこの曲に問題がある場合や公序良俗に反する場合にのみ実行したほうがいいと思います\n10回に1回の確率で本当に曲が削除されます\n成功しても反映まで1分ほどかかる場合があります")) { + return; + } + fetch("/api/delete", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + id: this.songs[this.selectedSong].id, + }) + }) + .then((res) => res.text()) + .then((text) => { + alert(text); + }); + } } /*!