master
Aevann 2023-10-19 22:00:24 +03:00
parent 285ac4d67d
commit cc076e2600
1 changed files with 16 additions and 25 deletions

View File

@ -22,6 +22,19 @@ function pause_audio(audio) {
} }
} }
function play_profile_song() {
addEventListener("load", () => {
play_audio(audio);
document.addEventListener('click', (e) => {
if (e.target.id.startsWith("toggle-anthem"))
return
if (audio.paused) play_audio(audio);
}, {once : true});
prepare_to_pause(audio)
})
}
if (u_username) if (u_username)
{ {
function toggle() { function toggle() {
@ -33,18 +46,7 @@ if (u_username)
} }
} }
if (!playing_music()) { play_profile_song()
addEventListener("load", () => {
play_audio(audio);
document.addEventListener('click', (e) => {
if (e.target.id.startsWith("toggle-anthem"))
return
if (audio.paused) play_audio(audio);
}, {once : true});
prepare_to_pause(audio)
})
}
} }
else else
{ {
@ -68,18 +70,7 @@ else
} }
} }
if (!paused && !playing_music()) if (!paused)
{ play_profile_song()
addEventListener("load", () => {
play_audio(audio);
document.addEventListener('click', (e) => {
if (e.target.id.startsWith("toggle-anthem"))
return
if (audio.paused) play_audio(audio);
}, {once : true});
prepare_to_pause(audio)
})
}
} }
} }