forked from mirrors/akkoma-fe
remove "image" from rot.js
This commit is contained in:
parent
70ca1b2418
commit
bcd2394cc5
1 changed files with 10 additions and 31 deletions
|
@ -68,17 +68,6 @@
|
||||||
audio.play().catch(() => getPromiseFromEvent(window, 'click').then(audio.play));
|
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) {
|
function volumeSet(number) {
|
||||||
audio.volume = number; //Set
|
audio.volume = number; //Set
|
||||||
localStorage.audiovolume = number; //Save
|
localStorage.audiovolume = number; //Save
|
||||||
|
@ -155,18 +144,13 @@
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const musicContainer = ptp.querySelector(".audio-container");
|
const musicContainer = ptp.querySelector(".audio-container");
|
||||||
if (musicContainer)
|
if (musicContainer) {
|
||||||
setMusic(rand(musicContainer.children).src);
|
setMusic(rand(musicContainer.children).src);
|
||||||
else
|
return true;
|
||||||
|
} else {
|
||||||
setMusic(null);
|
setMusic(null);
|
||||||
|
return false;
|
||||||
const imageContainer = ptp.querySelector(".image-container");
|
}
|
||||||
if (imageContainer)
|
|
||||||
setImage(rand(imageContainer.getElementsByTagName("img")).src);
|
|
||||||
else
|
|
||||||
setImage(null);
|
|
||||||
|
|
||||||
return musicContainer || imageContainer;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//Configure by fields
|
//Configure by fields
|
||||||
|
@ -176,18 +160,13 @@
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const musicFields = fields.filter((x) => x.title.toLowerCase().replace(/\s+/g, '') == "music")
|
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);
|
setMusic(rand(musicFields).nextElementSibling.title);
|
||||||
else
|
return true;
|
||||||
|
} else {
|
||||||
setMusic(null);
|
setMusic(null);
|
||||||
|
return false;
|
||||||
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;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue