Utilisateur:Kagg90/monobook.js

Un article de la désencyclopédie.
Aller à la navigation Aller à la recherche

Note : après avoir publié vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

  • Firefox / Safari : maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou appuyez sur Ctrl + F5 ou Ctrl + R (⌘ + R sur un Mac).
  • Google Chrome : appuyez sur Ctrl + Maj + R (⌘ + Shift + R sur un Mac).
  • Internet Explorer / Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
  • Opera : appuyez sur Ctrl + F5.
importScript('MediaWiki:Gadget-HotCat.js');
//importScript('Utilisateur:Kagg90/testOuverture.js‎');


//test pour l'article Théorie de la matrice
var conteneurOuverture = document.getElementById("effetOuverture");

if (conteneurOuverture != null) {

    var button = document.createElement("button");
    button.type = "button";
    button.style = "width:150px;height:50px;";
    button.innerHTML = "Rejoins-nous";
    conteneurOuverture.appendChild(button);

		var imageCachee = document.getElementById("imageGifCachee");

		conteneurOuverture.style = "position: relative; top: 0px; left: 0px; z-index:2; opacity: 1; background-color: white;";
		var topImage = (-conteneurOuverture.offsetHeight/2) - imageCachee.offsetHeight/2;
		imageCachee.style = "position: relative; top: "+topImage+"px; left: 0px; z-index:1";

    function startTransformation(balise, isOuvertureGauche) {
				if(balise instanceof HTMLElement){
					var style = "opacity: 1; background-color: white; transform : rotateY(90deg);transition-property: transform;transition-duration: 15s;transition-timing-function:linear;transition-delay: 2s;";

					if (isOuvertureGauche[0]) {
	            style += "transform-origin: 0px 0px;";
	        } else {
	            style += "transform-origin: 100% 100%;";
	        }

	        if (balise === button) {
	            style += "width:150px;height:50px;";
	        }
	        //balise.style = style;
					balise.style = style + balise.getAttribute("style");

					balise.style.padding = "";
					balise.style.paddingTop = (getComputedStyle(balise).marginTop + getComputedStyle(balise).paddingTop)+"px";
					balise.style.paddingBottom = (getComputedStyle(balise).marginBottom + getComputedStyle(balise).paddingBottom)+"px";
					balise.style.paddingRight = (getComputedStyle(balise).marginRight + getComputedStyle(balise).paddingRight)+"px";
					balise.style.paddingLeft =  (getComputedStyle(balise).paddingLeft + getComputedStyle(balise).marginLeft)+"px";

					balise.style.marginBottom = "";
					balise.style.marginTop = "";
					balise.style.marginLeft = "";
					balise.style.marginRight = "";
					balise.style.margin = "0px";

					isOuvertureGauche[0] = !isOuvertureGauche[0];
				}
    }


    button.addEventListener("click", function() { //gère l'effet de porte qui s'ouvre

        var isOuvertureGauche = [true];
        var balises = conteneurOuverture.childNodes;

        for (var i = 0; i < balises.length; i++) {
            startTransformation(balises.item(i), isOuvertureGauche);
        }
				conteneurOuverture.style = "position: relative; top: 0px; left: 0px; z-index:2;";
    }, true);
}