diff --git a/static/js/rot.js b/static/js/rot.js index c3bdf431..28bcea7a 100644 --- a/static/js/rot.js +++ b/static/js/rot.js @@ -68,17 +68,6 @@ audio.play().catch(() => getPromiseFromEvent(window, 'click').then(audio.play)); } - function setImage(url) { - if (url) { - console.log("Setting background: " + url); - let apploaded = document.getElementById("app-loaded"); - if (apploaded) - apploaded.style.setProperty("--body-background-image", "url(" + url + ")"); - else - console.log("Couldn't set background, app not yet loaded"); - } - } - function volumeSet(number) { audio.volume = number; //Set localStorage.audiovolume = number; //Save @@ -155,18 +144,13 @@ return false; const musicContainer = ptp.querySelector(".audio-container"); - if (musicContainer) + if (musicContainer) { setMusic(rand(musicContainer.children).src); - else + return true; + } else { setMusic(null); - - const imageContainer = ptp.querySelector(".image-container"); - if (imageContainer) - setImage(rand(imageContainer.getElementsByTagName("img")).src); - else - setImage(null); - - return musicContainer || imageContainer; + return false; + } }); //Configure by fields @@ -176,18 +160,13 @@ return false; const musicFields = fields.filter((x) => x.title.toLowerCase().replace(/\s+/g, '') == "music") - if (musicFields.length > 0) + if (musicFields.length > 0) { setMusic(rand(musicFields).nextElementSibling.title); - else + return true; + } else { setMusic(null); - - const imageFields = fields.filter((x) => x.title.toLowerCase().replace(/\s+/g, '') == "image") - if (imageFields.length > 0) - setImage(rand(imageFields).nextElementSibling.title); - else - setImage(null); - - return musicFields.length > 0 || imageFields.length > 0; + return false; + } }); }