Utilisateur:Cj73/FullScreen.js
Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;
Firefox (sur GNU/Linux) / Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5./***************************************************************************************
* FULLSCREEN *
* *
* Fonction : *
* Permet de basculer l'affichage entre les modes Plein Écran et Normal *
* grâce à deux liens en haut à droite de la page. *
* *
* Tests : *
** Firefox 3.5 et Monobook : OK *
** Firefox 3.5 et Moderne : OK *
** Firefox 3.5 et Vector : OK *
** Internet Explorer 7 et Monobook : Ne marche pas *
** Internet Explorer 7 et Moderne : Ne marche pas *
** Internet Explorer 7 et Vector : Ne marche pas *
* *
* Crédits : *
* Auteur : Dr Brains *
* Code original : http://fr.wiki.x.io/wiki/Utilisateur:Dr_Brains/FullScreen.js *
* *
* {{Catégorisation JS|FullScreen}} *
* *
***************************************************************************************/
function fullScreenFunction() {
/////////////////////////////////////////////// PARTIE PERSONNALISABLE ////////////////////////////////////////////////////////////////////////////////////////////
var nofullscreenText = "mode Normal";
var fullscreenText = "mode Plein écran";
/////////////////////////////////////////////// FIN DE LA PARTIE PERSONNALISABLE ////////////////////////////////////////////////////////////////////////////////////////////
var fullscreenlinkDiv = document.createElement("div");
fullscreenlinkDiv.innerHTML = "<small><a href=\"javascript:fullscreen()\">" + fullscreenText + "</a> \/ <a href=\"javascript:nofullscreen()\">" + nofullscreenText + "</a></small>";
fullscreenlinkDiv.style.float="right";
fullscreenlinkDiv.style.align="right";
fullscreenlinkDiv.style.textAlign="right";
fullscreenlinkDiv.id = "fullscreenLink";
if( skin == "monobook" ){
var contentNode = document.getElementById("content");
contentNode.insertBefore(fullscreenlinkDiv, contentNode.firstChild);
bodyContentNode = document.getElementById("bodyContent");
}
if( skin == "vector" ){
var contentNode = document.getElementById("content");
contentNode.insertBefore(fullscreenlinkDiv, contentNode.firstChild);
bodyContentNode = document.getElementById("bodyContent");
}
if( skin == "modern" ){
var contentNode = document.getElementById("mw_content");
contentNode.insertBefore(fullscreenlinkDiv, contentNode.firstChild);
bodyContentNode = document.getElementById("mw_contentholder");
}
}
$(fullScreenFunction);
function fullscreen() {
if( skin == "monobook" ){
var fullLink1 = document.getElementById("column-one");
if(!fullLink1){
var fullLink1 = document.getElementById("sidebox");
}
fullLink1.setAttribute( "style","display:none");
var fullLink2 = document.getElementById("footer");
fullLink2.setAttribute( "style","display:none");
var fullLink3 = document.getElementById("column-content");
fullLink3.setAttribute( "style","margin: 0 0 0 0");
var fullLink4 = document.getElementById("content");
fullLink4.setAttribute( "style","margin: 0 0 0 0");
}
if( skin == "vector" ){
var fullLink1 = document.getElementById("mw-head");
fullLink1.setAttribute( "style","display:none");
var fullLink2 = document.getElementById("mw-panel");
fullLink2.setAttribute( "style","margin: 0 0 0 0");
var fullLink3 = document.getElementById("footer");
fullLink3.setAttribute( "style","display:none");
var fullLink5 = document.getElementById("content");
fullLink5.setAttribute( "style","margin: 0 0 0 0");
var fullLink5 = document.getElementById("page-base");
fullLink5.setAttribute( "style","height:0em");
}
if( skin == "modern" ){
var fullLink1 = document.getElementById("mw_portlets");
fullLink1.setAttribute( "style","display:none");
var fullLink2 = document.getElementById("p-cactions");
fullLink2.setAttribute( "style","display:none");
var fullLink3 = document.getElementById("p-personal");
fullLink3.setAttribute( "style","display:none");
var fullLink4 = document.getElementById("footer");
fullLink4.setAttribute( "style","display:none");
var fullLink5 = document.getElementById("mw_contentwrapper");
fullLink5.setAttribute( "style","margin-left: 0em ");
var fullLink6 = document.getElementById("mw_content");
fullLink6.setAttribute( "style","margin: 0 0 0 0");
}
}
function nofullscreen() {
if( skin == "monobook" ){
var fullLink1 = document.getElementById("column-one");
if(!fullLink1){
var fullLink1 = document.getElementById("sidebox");
}
fullLink1.setAttribute( "style","display:block");
var fullLink2 = document.getElementById("footer");
fullLink2.setAttribute( "style","display:block");
var fullLink3 = document.getElementById("column-content");
fullLink3.setAttribute( "style","margin: 0 0 .6em -12.2em");
var fullLink4 = document.getElementById("content");
fullLink4.setAttribute( "style","margin: 2.8em 0 0 12.2em");
}
if( skin == "vector" ){
var fullLink1 = document.getElementById("mw-head");
fullLink1.setAttribute( "style","display:block");
var fullLink2 = document.getElementById("mw-panel");
fullLink2.setAttribute( "style","display:block");
var fullLink3 = document.getElementById("footer");
fullLink3.setAttribute( "style","display:block");
var fullLink4 = document.getElementById("content");
fullLink4.setAttribute( "style","margin-left: 12em");
var fullLink5 = document.getElementById("content");
fullLink5.setAttribute( "style","height:5em");
}
if( skin == "modern" ){
var fullLink1 = document.getElementById("mw_portlets");
fullLink1.setAttribute( "style","display:block");
var fullLink2 = document.getElementById("p-cactions");
fullLink2.setAttribute( "style","display:block");
var fullLink3 = document.getElementById("p-personal");
fullLink3.setAttribute( "style","display:block");
var fullLink4 = document.getElementById("footer");
fullLink4.setAttribute( "style","display:block");
var fullLink5 = document.getElementById("mw_contentwrapper");
fullLink5.setAttribute( "style","margin: 0 0 0 -15em");
var fullLink6 = document.getElementById("mw_content");
fullLink6.setAttribute( "style","margin: 0 0 0 14em");
}
}