User:Subtank/nimbus.js
From Halopedia, the Halo wiki
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/*** Background changer ***/
$(document).ready(function(){
var d = new Date();
var n = d.getHours();
if (n > 19 || n < 6)
// If time is after 7PM or before 6AM, apply night theme to ‘body’
document.body.className = "night";
else if (n > 16 && n < 19)
// If time is between 4PM – 7PM sunset theme to ‘body’
document.body.className = "evening";
else
// Else use ‘day’ theme
document.body.className = "day";
});
/*** Randomiser: header ***/
/** function randomBack () {
var opts = [
'https://www.halopedia.org/images/archive/a/a0/20110715123155!Headertest.jpg',
'https://www.halopedia.org/images/archive/a/a0/20110716172307!Headertest.jpg',
'https://www.halopedia.org/images/archive/a/a0/20110716172439!Headertest.jpg',
'https://www.halopedia.org/images/archive/a/a0/20110825154206!Headertest.jpg',
'https://www.halopedia.org/images/archive/a/a0/20110825162527!Headertest.jpg',
'https://www.halopedia.org/images/archive/a/a0/20110825162728!Headertest.jpg'
];
$('body').css('background-image','url(' + opts[Math.floor(opts.length*Math.random())] + ')');
}
$(randomBack); **/
/*** Randomiser: wiki-logo ***/
function randomLogo () {
var opts2 = [
'https://www.halopedia.org/images/halopedia.png',
'https://www.halopedia.org/images/d/d4/H4pedia3.png',
'https://www.halopedia.org/images/0/0b/H4pedia2.png',
'https://www.halopedia.org/images/f/fa/H4pedia4.png',
'https://www.halopedia.org/images/3/3c/H4pedia.png',,
'https://www.halopedia.org/images/4/41/Monaco.png',
];
$('#site-logo a').css('background-image','url(' + opts2[Math.floor(opts2.length*Math.random())] + ')');
}
$(randomLogo);