Remove unnecessary comments and streamline DOM observation in seasonal scripts
This commit is contained in:
@@ -7,6 +7,12 @@ const enableSpookySway = config.EnableSpookySway !== undefined ? config.EnableSp
|
||||
const spookySize = config.SpookySize || 20;
|
||||
const spookyGlowSize = config.SpookyGlowSize !== undefined ? config.SpookyGlowSize : 2;
|
||||
|
||||
const spookyImages = [
|
||||
"../Seasonals/Resources/halloween_images/ghost_20x20.png",
|
||||
"../Seasonals/Resources/halloween_images/bat_20x20.png",
|
||||
"../Seasonals/Resources/halloween_images/pumpkin_20x20.png",
|
||||
];
|
||||
|
||||
let msgPrinted = false;
|
||||
|
||||
// function to check and control the spooky theme
|
||||
@@ -20,13 +26,13 @@ function toggleSpooky() {
|
||||
const hasUserMenu = document.querySelector('#app-user-menu');
|
||||
|
||||
if (videoPlayer || trailerPlayer || isDashboard || hasUserMenu) {
|
||||
spookyContainer.style.display = 'none'; // hide spooky
|
||||
spookyContainer.style.display = 'none';
|
||||
if (!msgPrinted) {
|
||||
console.log('Spooky Theme hidden');
|
||||
msgPrinted = true;
|
||||
}
|
||||
} else {
|
||||
spookyContainer.style.display = 'block'; // show spooky
|
||||
spookyContainer.style.display = 'block';
|
||||
if (msgPrinted) {
|
||||
console.log('Spooky Theme visible');
|
||||
msgPrinted = false;
|
||||
@@ -34,7 +40,6 @@ function toggleSpooky() {
|
||||
}
|
||||
}
|
||||
|
||||
// observe changes in the DOM
|
||||
const observer = new MutationObserver(toggleSpooky);
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
@@ -42,13 +47,7 @@ observer.observe(document.body, {
|
||||
attributes: true
|
||||
});
|
||||
|
||||
const spookyImages = [
|
||||
"../Seasonals/Resources/halloween_images/ghost_20x20.png",
|
||||
"../Seasonals/Resources/halloween_images/bat_20x20.png",
|
||||
"../Seasonals/Resources/halloween_images/pumpkin_20x20.png",
|
||||
];
|
||||
|
||||
// create spooky objects
|
||||
function createSpooky() {
|
||||
const container = document.querySelector('.spooky-container') || document.createElement("div");
|
||||
|
||||
@@ -95,7 +94,6 @@ function createSpooky() {
|
||||
});
|
||||
}
|
||||
|
||||
// Add configured extra symbols
|
||||
for (let i = 0; i < spookyCount; i++) {
|
||||
const spookyOuter = document.createElement("div");
|
||||
spookyOuter.className = "spooky";
|
||||
|
||||
Reference in New Issue
Block a user