MediaWiki:Common.js
From Comprehensible Input 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.
/* Any JavaScript here will be loaded for all users on every page load. */
//Wait for page to be parsed
$(document).ready( function () {
if(window.location.hostname == 'comprehensibleinput.miraheze.org'){
$('#bodyContent').prepend('<div id="redirectPopup" style="display:none">New URL!<br>Redirecting to <b>comprehensibleinputwiki.org</b> in <span id="countdown"></span> seconds.</div>');
document.querySelector('#redirectPopup').style.display="block"
var timeleft = 5000;
var redirectTimer = setInterval(function(){
if(timeleft <= 0){
clearInterval(redirectTimer);
window.location.hostname='comprehensibleinputwiki.org'
}
document.getElementById("countdown").innerHTML = Math.ceil(timeleft/1000);
timeleft -= 100;
}, 100);
}
});