2023-10-17 19:35:00 +00:00
|
|
|
if (localStorage.getItem("music_playing") != 'true') {
|
2023-10-18 20:10:45 +00:00
|
|
|
addEventListener("load", () => {
|
|
|
|
const audio = document.getElementById('event-song');
|
2022-12-29 14:20:27 +00:00
|
|
|
|
2023-10-18 20:10:45 +00:00
|
|
|
audio.addEventListener('play', () => {
|
|
|
|
localStorage.setItem("music_playing", true);
|
|
|
|
})
|
2023-10-17 19:35:00 +00:00
|
|
|
|
2023-10-18 20:10:45 +00:00
|
|
|
window.addEventListener('beforeunload', () => {
|
|
|
|
localStorage.setItem("music_playing", false);
|
|
|
|
})
|
2023-10-17 19:35:00 +00:00
|
|
|
|
2023-10-18 20:10:45 +00:00
|
|
|
audio.play();
|
|
|
|
document.addEventListener('click', () => {
|
|
|
|
if (audio.paused) audio.play();
|
|
|
|
}, {once : true});
|
|
|
|
prepare_to_pause(audio)
|
|
|
|
})
|
2023-10-17 19:35:00 +00:00
|
|
|
}
|