MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 7: Line 7:
   logo.href = 'https://ooqa.karls.computer/Special:Random';
   logo.href = 'https://ooqa.karls.computer/Special:Random';
});
});
let counter = rand(1000, 10000)




Line 17: Line 19:
e.style.rotate = `${ rand(-3, 3) }deg`
e.style.rotate = `${ rand(-3, 3) }deg`
})
})
counter = rand(5000, 15000)
setTimeout(() => { setRandomRotations() }, counter)
}
}




//Background color
//Background color
// Function to generate a random bright color
// Function to generate a random bright color
function getRandomBrightColor() {
function getRandomBrightColor() {
   const min = 200; // Minimum value for bright colors
   const min = 75; // Minimum value for bright colors
   const r = Math.floor(Math.random() * (255 - min) + min);
   const h = Math.floor(Math.random() * (220));
   const g = Math.floor(Math.random() * (255 - min) + min);
   const s = Math.floor(Math.random() * (100 - min) + min);
   const b = Math.floor(Math.random() * (255 - min) + min);
   const l = Math.floor(Math.random() * (100 - min) + min);
   return `rgb(${r},${g},${b})`;
   return `hsl(${h},${s}%,${l}%)`;
}
}


Line 45: Line 48:
     element.style.backgroundColor = getRandomBrightColor();
     element.style.backgroundColor = getRandomBrightColor();
   });
   });
counter = rand(5000, 15000)
setTimeout(() => { setBackgroundColors() }, counter)
}
}


// Gradually change the background color for all elements
// Gradually change the background color for all elements
function changeStylesGradually() {
function changeStylesGradually() {
   setInterval(() => { setRandomRotations() }, rand(1000, 10000))
   setTimeout(() => { setRandomRotations() }, counter)
   setInterval(() => { setBackgroundColors() }, rand(1000, 10000))
   setTimeout(() => { setBackgroundColors() }, counter)
}
}