From bcd2394cc59ae21d0db615d56e1a385177f44dff Mon Sep 17 00:00:00 2001 From: uwaa Date: Thu, 23 Jan 2025 00:35:26 +0000 Subject: [PATCH] remove "image" from rot.js --- static/js/rot.js | 41 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) 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; + } }); }