diff --git a/public/src/js/customsongs.js b/public/src/js/customsongs.js index ab98800..9291b5f 100644 --- a/public/src/js/customsongs.js +++ b/public/src/js/customsongs.js @@ -363,6 +363,9 @@ class CustomSongs{ open("privacy") } loading(show){ + if(this.noPage){ + return + } if(show){ loader.screen.appendChild(this.loaderDiv) }else if(this.loaderDiv.parentNode){ @@ -376,7 +379,9 @@ class CustomSongs{ assets.customSongs = true assets.customSelected = this.noPage ? +localStorage.getItem("customSelected") : 0 } - assets.sounds["se_don"].play() + if(!this.noPage){ + assets.sounds["se_don"].play() + } this.clean() setTimeout(() => { new SongSelect("customSongs", false, this.touchEnabled) diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index 6478ef3..03028bb 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -757,7 +757,7 @@ class SongSelect{ autoplay = true }else if(shift){ autoplay = shift - }else if(p2.socket.readyState === 1 && !assets.customSongs){ + }else if(p2.socket && p2.socket.readyState === 1 && !assets.customSongs){ multiplayer = ctrl } var diff = this.difficultyId[difficulty] diff --git a/public/src/js/titlescreen.js b/public/src/js/titlescreen.js index d1d3b2a..850f391 100644 --- a/public/src/js/titlescreen.js +++ b/public/src/js/titlescreen.js @@ -56,7 +56,9 @@ class Titlescreen{ } this.titleScreen.style.cursor = "auto" this.clean() - assets.sounds["se_don"].play() + if(!this.customFolder || assets.customSongs){ + assets.sounds["se_don"].play() + } this.goNext() } } @@ -71,9 +73,20 @@ class Titlescreen{ pageEvents.remove(p2, "message") if(this.customFolder && !fromP2 && !assets.customSongs){ var customSongs = new CustomSongs(this.touched, true) - customSongs.walkFilesystem(this.customFolder).then(files => customSongs.importLocal(files)).catch(() => { + var soundPlayed = false + customSongs.walkFilesystem(this.customFolder).then(files => { + assets.sounds["se_don"].play() + soundPlayed = true + return customSongs.importLocal(files) + }).catch(() => { + localStorage.removeItem("customSelected") db.removeItem("customFolder") - new SongSelect(false, false, this.touched, this.songId) + if(!soundPlayed){ + assets.sounds["se_don"].play() + } + setTimeout(() => { + new SongSelect(false, false, this.touched, this.songId) + }, 500) }) }else{ setTimeout(() => {