Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
566 lines (543 sloc) 44.2 KB
/* Minitel animation for MediaWiki + CSS dynamic management
* by LRQ3000
* v2.3.0
* Released under MIT license.
* Usage: either simply include this script at the header:
*
<script src="minitel-anim.js"></script>
*
* Or if via the javascript overloading API in MediaWiki, you can simply create a common.js page (either in userspace at User:YourName/common.js or globally for all users at MediaWiki:Common.js) and add the following line at the bottom:
mw.loader.load( '/w/index.php?title=User:YourName/minitel-anim.js&action=raw&ctype=text/javascript' );
* Then create three pages minitel-anim.js, minitel.css and pixelate.js and paste respectively the code of these files in these pages. Note that you will have to update the paths in minitel-anim.js to load the correct articles paths that you have just created.
* Note: There is no need to include the CSS separately, it will be dynamically loaded by this script (which allows to disable the style by clicking a link). The style can however be used standalone, without the JS, by only including the CSS in the HTML head.
* Note2: to do a hard refresh to reload the javascript and CSS in case of modifications, press CTRL+F5.
*
* These instructions work for both the desktop and mobile homepages.
*/
function minitel_title_anim(msg) {
// Inspired by Anonymous's code snippet: https://openclassrooms.com/forum/sujet/affichage-a-la-minitel
c = msg.substring(I, I=I+1);
// Replace special characters with equivalent html code
if (c == "\n") {
c = "<br />"; // line return
} else if (c == " ") {
c = "&nbsp;"; // physical space (important for correct rendering of figlet style banner)
} else if (c == "<") {
// support for html tags, we collect all the tags characters and input at once
next_c = "";
while (next_c != ">") {
next_c = msg.substring(I, I=I+1);
c = c + next_c;
}
c = c + msg.substring(I, I=I+1); // also add the next character to have something to display on screen
}
// Continue, unless user interrupted
if (!animstop_flag) {
// display the new character
bannerdiv.innerHTML = bannerdiv.innerHTML + c;
// If there are more characters to draw, continue the animation
if ( I < message.length ) {
setTimeout(function() {minitel_title_anim(msg);}, J=J-Jstep);
// Else this was the last character, draw the full message (with markup code) and show all other elements on page
} else {
setTimeout(function(){ // wait a bit before revealing everything for a better effect
stopAnim(); // show the full message with potentially some html markup
}, 500);
}
}
}
function minitel_play_sound(){
// Play a minitel-like sound
try {
var s = new Audio('https://upload.wikimedia.org/wikipedia/commons/a/a1/Fake_Minitel_sound.ogg');
//var s = new Audio('https://upload.wikimedia.org/wikipedia/commons/4/4f/Dial_up_connection.ogg');
s.loop = false;
s.play();
} catch(err) {}; // pass if Internet Explorer < 11 (incompatible with Audio)
}
function disableBlinkingOnUserInteraction() {
// Stop animations on user interaction
// In accordance with: https://www.w3.org/TR/2008/REC-WCAG20-20081211/#time-limits-pause
// Stop the banner cursor blinking on user key press and mouse click
var a = document.getElementsByTagName('blink');
var b = document.createElement('span');
b.innerText = a[0].innerText;
a[0].parentNode.replaceChild(b, a[0]);
bindUserInterruption(disableBlinkingOnUserInteraction, false);
// Also stop the fish image from moving
var c = document.getElementById('aprilfish');
c.style.animationIterationCount = '0';
}
function stopAnim() {
// Stop the animation and restore the page (on user interruption or because animation has finished)
// This is called in any case at the end of the animation
animstop_flag = true;
J = 0;
bannerdiv.innerHTML = message.replace(/\n/gi, "<br />") + message_post.replace(/\n/gi, "<br />"); // show the full message with correct HTML markup
bannerdiv.setAttribute("style", prevstyle); // restore style (ie, font-size)
hideOrShowAllBut("#"+bannerdiv_id, false); //revealAll(); // reveal everything, all other HTML elements
bindUserInterruption(stopAnim, false); // unbind user interruption on mouse/keyboard (else it's not a big issue, the banner gets refreshed at each mouse or key press, it's not even visible with naked eye)
loadAndPixelateImages(); // bonus: pixelate all images if possible (there is a try catch inside)
document.getElementById('backtofuturelinkfixed').style.display = 'none'; // hide the fixed link to disable the style, there will be other links on the page anyway
bindUserInterruption(disableBlinkingOnUserInteraction, true); // allow to disable the blinking of the cursor if user press any key or click the mouse
}
function revealAll() {
// Show all other HTML elements along with #minitelanim
// UNUSED: now hideOrShowAll does everything without needing JQuery
/*
$('#accueil_2017_bloc-titre').show().parentsUntil('body').addBack().siblings().show();
$('script').hide().parentsUntil('body'); // hide script back, else they will be displayed as text on the page
*/
}
function hideOrShowAllBut(eltid, mode) {
// Hide (or show) all other HTML elements except #eltid
// Use mode == true to hide, or mode == false to show
// Original code snippet by the awesome RobG: https://stackoverflow.com/a/44877057/1121352
var el = document.querySelector(eltid);
var node, nodes = [];
do {
var parent = el.parentNode;
// Collect element children
for (var i=0, iLen=parent.childNodes.length; i<iLen; i++) {
node = parent.childNodes[i];
// Collect only sibling nodes that are elements and not the current element
if (node.nodeType == 1 && node != el) {
nodes.push(node);
}
}
// Go up to parent
el = parent;
// Stop when processed the body's child nodes
} while (el.tagName.toLowerCase() != 'body');
// Hide the collected nodes
//nodes.forEach(function(node){ // incompatible with old IE, or could use JQuery
for (var i = 0; i < nodes.length; i++) { // compatible with old IE
node = nodes[i];
if (mode) {
try {
node.classList.add("hide"); // add a hide class defined in CSS to set display: none; visibility: hidden. This does the job but will leave some divs only invisible, not removed (so there will still be a scrollbar)
} catch(err) {} // just pass if IE < 10 (incompatible with classList)
node.style.display = 'none'; // this totally hides, just like the html elements do not exist
} else {
try {
node.classList.remove("hide"); // remove the hide class
} catch(err) {} // just pass if IE < 10 (incompatible with classList)
node.style.display = 'inherit'; // use inherit to get the original values from CSS such as block/flex/inline-block etc
}
};
// Equivalent one-liner in JQuery 3.3.1
//$('#accueil_2017_bloc-titre').show().parentsUntil('body').addBack().siblings().hide();
}
function bindUserInterruption(f, mode) {
// Bind the mouse click and keyboard key press to call the specified function (or unbinds if mode == false)
if (mode == true) {
try { // compatibility with old IE
window.addEventListener("onclick", f, true);
//window.onclick = f;
window.addEventListener("onkeypress", f, true);
} catch(exc) {};
//window.onkeypress = f;
document.getElementsByTagName("body")[0].onclick = function(){ f(); }; // for IE < 10 compatibility
document.getElementsByTagName("body")[0].onkeypress = function(){ f(); }; // for IE < 10 compatibility
} else {
try { // compatibility with old IE
window.removeEventListener("onclick", f, true);
//window.onclick = null;
window.removeEventListener("onkeypress", f, true);
//window.onkeypress = null;
} catch(exc) {};
document.getElementsByTagName("body")[0].onclick = function(){ null }; // for IE < 10 compatibility
document.getElementsByTagName("body")[0].onkeypress = function(){ null }; // for IE < 10 compatibility
}
}
// Functions to activate the link to disable this style
function setCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
document.cookie = name+'=; Max-Age=-99999999;';
}
// Compatibility functions
if (document.getElementsByClassName == null) {
document.getElementsByClassName = function(cl) {
var retnode = [];
var elem = this.getElementsByTagName('*');
for (var i = 0; i < elem.length; i++) {
if((' ' + elem[i].className + ' ').indexOf(' ' + cl + ' ') > -1) retnode.push(elem[i]);
}
return retnode;
};
}
// MAIN Minitel animation routine
function minitelAnimMain() {
// Declare some global variables
I = 0; // Current character being drawn in the banner animation - Internal parameter, do not touch
J = 30.0; // Slowness of drawing the banner = starting delay of drawing between two characters (of the banner) - this amount will be gradually reduced
Jstep = 0.1; // Step to decrease gradually the time it takes to draw the banner
animstop_flag = false; // declare that the animation was stopped by user - Internal parameter, do not touch
bannerdiv_id = 'accueil_2017_bloc-titre'; // id of the html div that will welcome the animated banner (the content will be entirely replaced)
// Banner in figlet style, generated with https://www.npmjs.com/package/figlet
// To change the banner, please first sanitize it in this order: double (escape) the antislashes and then replace line returns by \n
// This necessitate an appropriate CSS for the bannerdiv for good display (even though we enclose inside <pre> for consistent rendering in old browsers): white-space: pre; font-family: courier;
message = "<pre> __ __ _ _ _ __ _ _\n \\ \\ / /(_)| |__(_) _ __ /_/ __| |(_) __ _\n \\ \\/\\/ / | || / /| || '_ \\/ -_)/ _` || |/ _` |\n \\_/\\_/ |_||_\\_\\|_|| .__/\\___|\\__,_||_|\\__,_|\n |_|</pre>\nL'encyclopédie libre que chacun peut améliorer<blink>_</blink>";
message_post = "\n<br /><a href=\"?\" id=\"backtofuturelink\" style=\"font-weight: bold; font-family: sans-serif; color: cyan;\" onclick=\"setCookie('miniteldisable', 1, 1);\">Retourner vers le futur! Désactiver le poisson d'avril.</a>"; // something you want to add after the banner but not shown during the animation (but this will be shown after on the page)
//document.getElementById('backtofuturelink').onclick = setCookie('miniteldisable', 1, 30);
// Get the banner div html element
bannerdiv = document.getElementById(bannerdiv_id);
bannerdiv.innerHTML = ""; // reset anything inside the bannerdiv, we will fill with our Minitel-like banner
// Style it a bit for better effect (make it bigger)
prevstyle = bannerdiv.getAttribute("style"); // backup previous style
bannerdiv.setAttribute("style", "font-size: 2em; width: auto; overflow: visible; position: absolute;"); // make it bigger
// Allow to skip the animation on mouse click or key press
bindUserInterruption(stopAnim, true);
// Hide all other elements except the banner
hideOrShowAllBut("#"+bannerdiv_id, true);
// Start playing the Minitel like connection sound
minitel_play_sound();
// Add a link fixed on the screen to disable the style at any moment
appendJSLink(document.body, "backtofuturelinkfixed", "Retourner vers le futur ! (désactive le poisson d'avril et l'animation)", 1, false, 'position:fixed;bottom:0;left:0;color:#ff0080;font-weight:bold;');
// Start the Minitel like animation drawing the banner, after the Minitel sound
setTimeout(function(){ // to wait for sound to finish
minitel_title_anim(message.replace(/<[^>]+>/gi, "")); // trim all html code before doing the animation, the animation will anyway display the full message at the end with the markup
}, 1400);
}
function includeCSS(path) {
// Loads additional Minitel CSS style file to the webpage (so this does not replace any other CSS style file, it gets added over the others)
try {
mw.loader.load( '/w/index.php?title=User:Lrq3000/'+path+'&action=raw&ctype=text/css', 'text/css' );
} catch(err) {
var fileref = document.createElement("link");
fileref.rel = "stylesheet";
fileref.type = "text/css";
fileref.href = path;
document.getElementsByTagName("head")[0].appendChild(fileref)
}
}
function minitelAddFish() {
// Add a div where the April's Fools fish image will be placed (via CSS) */
var div = document.createElement('div');
div.id = "aprilfish";
var a = document.createElement('a');
a.href = "https://fr.wikipedia.org/wiki/Poisson_d%27avril";
var img = document.createElement('img');
img.id = "a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appendChild(img);
div.appendChild(a);
document.body.appendChild(div);
}
/* Images pixelation (does not work on background images */
function loadScript(url, callback)
{
// Load an additional javascript library on-the-fly and callback a function that can then access this library
/* https://stackoverflow.com/questions/950087/how-do-i-include-a-javascript-file-in-another-javascript-file */
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
if (window.location.host.match( /wikipedia.org/ )) { // special path for wikipedia, load from user space
script.src = '/w/index.php?title=User:Lrq3000/'+url+'&action=raw&ctype=text/javascript';
} else { // else use the direct path
script.src = url;
}
// Then bind the event to the callback function.
// There are several events for cross browser compatibility.
script.onreadystatechange = callback;
script.onload = callback;
// Fire the loading
head.appendChild(script);
}
function pixelateImages() {
// Pixelate all img
var imgs = document.getElementsByTagName('img'); // get all img objects
for (var i = 0; i < imgs.length; i++) { // iterate on each image
img = imgs[i];
//window.console && console.log(img.id);
if (!(img.id == "aprilfishimg")) { // exception for april fish!
try { // fix for old IE
prevstyle = window.getComputedStyle(img);
if ((!prevstyle.display | prevstyle.display != 'none') & (!prevstyle.visibility | prevstyle.visibility != 'hidden')) { // pixelate and show only if the image is not already hidden
img.pixelate({ value: 0.25, reveal: true }); // modify the value here to make it less or more pixelated (1 for no pixelation, 0 for full pixelation)
}
} catch(exc) {};
}
}
}
function loadAndPixelateImages(){
// Callback to pixelate all images at the end of the animation
// Useful to avoid pixelating while images are still hidden (else they will be misdetected as being originally hidden, whereas it's because of the banner animation)
//try {
loadScript("pixelate.js", pixelateImages); // Bonus: pixelate all images
//} catch(err) {};
}
function eegg() {
loadScript('konami.js',
function () {
try { // fix for old IE
var ee = new Konami(function() {
var newWnd = window.open('https://lrq3000.github.io/javascript-racer/v5.game.html', '_blank', 'noopener');
newWnd.opener = null; // security fix: https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/
});
} catch(exc) {};
}
);
}
function getCurrentDate() {
// Get (client-side) current date
// from: https://stackoverflow.com/a/12409344/1121352
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10){
dd='0'+dd;
}
if(mm<10){
mm='0'+mm;
}
var today = dd+'/'+mm+'/'+yyyy;
return today;
}
// Auxiliary function to generate html links using DOM operators via JS
function appendJSLink(parent, id, text, miniteldisable, list, style) {
// Create the links to disable/reenable the style, without using innerHTML
// if list is true, then will put the link inside a <li>
var a = document.createElement('a');
a.appendChild(document.createTextNode(text));
a.title = text;
a.href = "?";
a.onclick = function() {setCookie('miniteldisable', miniteldisable, 1)};
a.id = id;
if (!style) {
try { // compatibility with old IE
a.style = "color:#ff0080";
} catch(exc) {
a.style.setAttribute("color:#ff0080");
}
} else {
try { // compatibility with old IE
a.style = style;
} catch(exc) {
a.style.setAttribute(style);
};
a.style.cssText = style; // fix for Safari <= 5
}
if (list) {
var li = document.createElement('li');
li.appendChild(a);
parent.appendChild(li);
} else {
parent.appendChild(a);
}
}
function changeColorWMF() {
// Change the text color of the "Powered by Wikimedia Foundation etc" text, for which the style is hardcoded in the HTML page (so cannot use CSS, only JS can do something here)
// limit the search inside mw-parser-output div
var mwparser = document.getElementsByClassName('mw-parser-output');
// search for all divs containing "Powered by Wikimedia Foundation etc" text
var aTags = mwparser[0].getElementsByTagName("div");
var searchText = "Wikipédia est hébergé par la ";
var found;
for (var i = 0; i < aTags.length; i++) {
try {
if (aTags[i].textContent.indexOf(searchText) >= 0) { // prefer String.indexOf() instead of String.includes() for retrocompatibility with Safari <= 5
found = aTags[i];
break;
}
} catch(exc) {};
}
// Now change the hardcoded font color for each div inside the one found
if (found) {
aTags2 = found.getElementsByTagName("div");
for (var i = 0; i < aTags2.length; i++) {
aTags2[i].style.color = 'lime';
}
// Change the horizontal separator color while we're at it
found.style.borderColor = 'lime';
}
// Finally hide again the printfooter
var printfooter = document.getElementsByClassName("printfooter")[0]
try { // fix for old internet explorer
printfooter.style = '';
printfooter.style.display = 'none !important';
printfooter.hidden = true;
printfooter.style.position = 'absolute';
printfooter.style.visibility = 'hidden';
} catch(exc) {
printfooter.style.setAttribute('display: none !important; position:absolute; visibility:hidden');
}
}
function changeBistroTitleBox() {
// Bonus style for the Bistro: change the title, add a Wikipedia Arcade logo, and change the two images on the sides
var minitel_disableflag = getCookie("miniteldisable"); // check the miniteldisable style flag in the cookie
if (minitel_disableflag != 1) {
window.console && console.log('Poisson d\'avril: activation du style bonus pour Le Bistro');
// search for <big> tags, and more particularly the one containing "Le Bistro" text string
var aTags = document.getElementsByTagName("big");
var searchText = "Le Bistro";
var found;
for (var i = 0; i < aTags.length; i++) {
try {
if (aTags[i].textContent.indexOf(searchText) >= 0) { // prefer String.indexOf() instead of String.includes() for retrocompatibility with Safari <= 5
found = aTags[i];
break;
}
} catch(exc) {};
}
// Now add an id, so the CSS can apply
found.id = 'bistrotag';
// Include the Bisto css
includeCSS('minitel-bistro.css');
// Change the images on the sides
var mwparser = document.getElementsByClassName("mw-parser-output");
var aTags2 = mwparser[0].getElementsByClassName("floatleft");
var aTags3 = mwparser[0].getElementsByClassName("floatright");
var imleft = document.createElement('img');
imleft.src = 'https://upload.wikimedia.org/wikipedia/commons/thumb/9/9f/Arcade_machine_icon.png/240px-Arcade_machine_icon.png';
imleft.alt = 'Image d\'une machine de jeu d\'arcade';
imleft.style.width = '200px';
var imright = document.createElement('img');
imright.src = 'https://upload.wikimedia.org/wikipedia/commons/a/af/Arcade_video_game_buttons.jpg';
imright.alt = 'Image de boutons d\'une machine de jeu d\'arcade';
imright.style.width = '200px';
var imleftlink = document.createElement('a');
imleftlink.href = 'https://commons.wikimedia.org/wiki/File:Arcade_machine_icon.png';
imleftlink.title = 'Image d\'une machine de jeu d\'arcade';
imleftlink.appendChild(imleft);
var imrightlink = document.createElement('a');
imrightlink.href = 'https://commons.wikimedia.org/wiki/File:Arcade_video_game_buttons.jpg';
imrightlink.title = 'Image de boutons d\'une machine de jeu d\'arcade';
imrightlink.appendChild(imright);
aTags2[0].replaceChild(imleftlink, aTags2[0].getElementsByTagName('a')[0]);
aTags3[0].replaceChild(imrightlink, aTags3[0].getElementsByTagName('a')[0]);
// Add disable link in the footer
mobilelink = document.getElementById('mw-mf-display-toggle'); // get the link to toggle between mobile and desktop (this id only exists on the mobile version)
if (mobilelink == null) {
footerdiv = document.getElementById('footer-places');
appendJSLink(footerdiv, "backtofuturelink", "Je n'aime pas les salles d'arcades ! (désactive le poisson d'avril)", 1, true, ' ');
} else {
footerdiv = document.getElementsByClassName('footer-places')[0];
appendJSLink(footerdiv, "backtofuturelink", "Je n'aime pas les salles d'arcades ! (désactive le poisson d'avril)", 1, true, ' ');
}
// Add secret game code
eegg();
} else {
// Else the style was disabled, just add a link to allow to enable
window.console && console.log('Poisson d\'avril: désactivation du style bonus pour Le Bistro');
mobilelink = document.getElementById('mw-mf-display-toggle'); // get the link to toggle between mobile and desktop (this id only exists on the mobile version)
if (mobilelink == null) {
footerdiv = document.getElementById('footer-places');
appendJSLink(footerdiv, "backtofuturelink", "Je veux être béta-testeur d'arcades ! (active le poisson d'avril)", 0, true, ' ');
} else {
footerdiv = document.getElementsByClassName('footer-places')[0];
appendJSLink(footerdiv, "backtofuturelink", "Je veux être béta-testeur d'arcades ! (active le poisson d'avril)", 0, true, ' ');
}
}
}
// HELPER FUNCTIONS
function minitelHeader() {
// Helper function: Auto include CSS file as appropriate and add link to disable/enable the style
// To be placed in the header (technically it could be placed at the footer and be merged with minitelFooter() but then there would be a split second where we can see the original WP style)
window.console && console.log('Poisson d\'avril : chargement du header');
var minitel_disableflag = getCookie("miniteldisable"); // check the miniteldisable style flag in the cookie
if (minitel_disableflag != 1) {
// Minitel style flag not disabled (or not defined), we include the CSS and launch the animation
includeCSS('minitel.css');
}
}
function minitelFooter() {
// Helper function: Launch the main routine on if not disabled by cookie! Also manages the links to enable/disable the style and animation
// To be placed in the footer, at the most bottom place in your <body>, just before the </body> if possible (because we need all HTML elements to be already loaded, in order to manipulate them)
window.console && console.log('Poisson d\'avril : chargement du footer');
var minitel_disableflag = getCookie("miniteldisable"); // check the miniteldisable style flag in the cookie
mobilelink = document.getElementById('mw-mf-display-toggle'); // get the link to toggle between mobile and desktop (this id only exists on the mobile version)
if (minitel_disableflag != 1) {
// Do the animation, but only if not on mobile
if (mobilelink == null) { // simply check for the existence of the link to switch the mobile version to desktop. This link does not exist on the desktop version.
// Desktop version, we can show the animation (which will add a disable link)
minitelAddFish(); // add a div to place the April's Fools fish image (via CSS) - DO THIS BEFORE calling the animation (so that the animation can hide it and restore it afterward)
minitelAnimMain(); // do the banner animation! Note: this will also add a link to disable the style + Bonus: pixelate all images (included in stopAnim(), to apply on images when they are unhidden)
// Add another link in the footer
footerdiv = document.getElementById('footer-places');
appendJSLink(footerdiv, "backtofuturelink", "Retourner vers le futur ! (désactive le poisson d'avril)", 1, true);
changeColorWMF();
eegg();
} else {
// Mobile version, no animation but we add a disable link (to disable the CSS style)
minitelAddFish(); // add also the fish
//minitel_play_sound(); // the function is used directly to play the sound even if the banner is not displayed
// Add a disable link
footerdiv = document.getElementsByClassName('footer-places')[0];
appendJSLink(footerdiv, "backtofuturelink", "Retourner vers le futur ! (désactive le poisson d'avril)", 1, true);
// Bonus: pixelate all images
loadAndPixelateImages();
eegg();
}
} else {
// Else the user disabled the Minitel style, just don't do anything except adding a link to reactivate the Minitel style
if (mobilelink == null) {
// Desktop version
bannerdiv = document.getElementById('accueil_2017_bloc-titre');
appendJSLink(bannerdiv, "backtofuturelink", "Je suis nostalgique, retourner dans le passé ! (active le poisson d'avril)", 0, false, "font-size: 0.8em;");
footerdiv = document.getElementById('footer-places');
appendJSLink(footerdiv, "backtofuturelink", "Retourner dans le passé ! (active le poisson d'avril)", 0, true, ' ');
} else {
// Mobile version
footerdiv = document.getElementsByClassName('footer-places')[0];
appendJSLink(footerdiv, "backtofuturelink", "Je suis nostalgique, retourner dans le passé ! (active le poisson d'avril)", 0, true, ' ');
}
}
}
// LOAD ON JS INCLUDE
// Load only if we are the 1st april 2018, and no other date (will allow automatic enabling/disabling past the date)
var match = window.location.host.match( /localhost/ ) || window.location.host.match( /^.*\.github.io/ ); // special case if we are testing, just show the style anytime
if (getCurrentDate() == '01/04/2018' || match) {
// Load only if main page, else skip and show normal pages
var match2 = window.location.pathname.match( /\/wiki\/Wikip%C3%A9dia:Accueil_principal/ ) || window.location.href.match( /title=Wikip%C3%A9dia:Accueil_principal/ ) || match;
var match3 = window.location.pathname.match( /Sp%C3%A9cial/ ) || (window.location.href.match( /action/ ) && (window.location.href.match( /mobileaction/ ) == null)); // check if we are not doing an action on the homepage, then we disable (except if the action is to switch from mobile to desktop version, then we still show)
var match4 = window.location.pathname.match( /\/wiki\/Wikip%C3%A9dia:Le_Bistro/ ) || (match && window.location.href.match( /bistro/ ));
if (match2 && (!match3 || match3 == null) && (!match4)) {
// the WP stylesheet needs to be done inside the javascript, else there will be a split-second blink (not a usability issue, it's just for a more pleasing visual experience)
minitelHeader();
// Add a callback to start the animation at the end of page load (so all elements, including images, are already loaded and can be modified/hidden)
window.console && console.log('Poisson d\'avril : page d\'accueil détectée');
if (document.readyState=="complete") { // if the document is already rendered, then can call right now
minitelFooter();
} else { // else the document is still rendering, delay the call to later (delaying is important, this is what allows to place this JS include anywhere in the page, header or footer does not matter)
//window.addEventListener("load", function(){ // better but does not work on WP
window.onload = function() {
minitelFooter();
};
}
window.console && console.log('Poisson d\'avril : chargement complet');
// Add an empty unload callback to prevent the browser from caching JS (this allows to redo the animation just like first load when hitting the back button)
try { // compatibility with old IE
window.addEventListener("unload", function(){});
} catch (exc) {};
} else if (match4) {
// Bonus style for the bistro
// Call the bonus style
if (document.readyState=="complete") { // if the document is already rendered, then can call right now
changeBistroTitleBox();
} else { // else the document is still rendering, delay the call to later (delaying is important, this is what allows to place this JS include anywhere in the page, header or footer does not matter)
window.onload = function() {
changeBistroTitleBox();
};
}
}
}