// Start April Fools 2021 script by User:Wookipan -----
var apFools21 = {
init: function() {
var tf95Modal = $('.tf95-box-container');
//var wookiAd = $('.free-hat-totally-legit-ad');
//var nopeAvi = document.createElement('audio');
// Change favicon
$('link[rel~="icon"]').attr('href', '/w/images/3/35/User_Wookipan_tf95_favicon.png');
//$('#siteNotice').css('zIndex', '10');
// Draggable dialog box
if (tf95Modal) {
function mouseDown(e) {
window.draggable = {};
draggable.axisX = e.pageX;
draggable.axisY = e.pageY;
draggable.elem = this;
draggable.offset = $(this).offset();
function dragHandler(e) {
var x = draggable.offset.left + (e.pageX - draggable.axisX);
var y = draggable.offset.top + (e.pageY - draggable.axisY);
$(draggable.elem).offset({ top: y, left: x });
}
function mouseUp(e) {
$('body')
.off('mousemove', dragHandler)
.off('mouseup', mouseUp);
}
$('body').on('mouseup', mouseUp).on('mousemove', dragHandler);
}
tf95Modal.mousedown(mouseDown);
// Only show the dialog box once regardless of whether it has been clicked
//if (localStorage.getItem('modalData')) {
// tf95Modal.remove();
//} else {
// modalFired();
//}
//function modalFired() {
// localStorage.setItem('modalData', 'true');
tf95Modal.show();
//}
$('.tf95-box-body > .tf95-btn').click(function () {
$(this).css('cursor', 'default');
setTimeout(function() {
tf95Modal.remove();
}, 100);
});
}
// Pick a random number between 0 and 16
//var randomSeed = Math.floor(Math.random() * 17);
//nopeAvi.src = '/w/images/b/bd/Engineer_no01.wav';
//if (wookiAd.length && randomSeed === 0) {
// // Force the link to open in a new window/tab
// $('.free-hat-totally-legit-ad > a').attr('target', '_blank');
// wookiAd.html(function() {
// $(this).delay(2000).animate({ bottom: '20px' });
// if (localStorage.getItem('adData')) {
// $(this).remove();
// } else {
// $(this).click(function() {
// nopeAvi.play();
// Don't show the ad again after it has been clicked
// adFired();
// });
// }
// });
// Save the browser session to avoid creating annoyance
// The Wiki does not use cookies so we'd have to resolve to web storage instead
// function adFired() {
// localStorage.setItem('adData', 'true');
// wookiAd.remove();
// }
//}
}
};
$(apFools21.init);
// End April Fools 2021 script -----