User:Borneanape/common.js

// ? mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:GoogleOCR.js&action=raw&ctype=text/javascript');

/********************** * auteur : Zaran **********************/

function showPanel(animated) { var skin = mw.config.get('skin'); var content = $('#content'); if ( skin == 'vector' ) { if ( animated) { content.animate({'margin-left':content.data('margin')},function{$("#mw-panel").show;}); $("#left-navigation").animate({'left': content.data('margin')}); }   else { content.css('margin-left', content.data('margin') ); $("#mw-panel").show; $("#left-navigation").css('left', content.data('margin') ); } }  else if ( skin == 'monobook' ) { if ( animated) { content.animate({'margin-left':content.data('margin')}, function {content.css('z-index', '2');}); }   else { content.css('margin-left', content.data('margin') ); content.css('z-index', '2'); } } } function hidePanel(animated) { var skin = mw.config.get('skin'); var content = $('#content'); if ( skin == 'vector' ) { $("#mw-panel").hide; if ( animated ) { content.animate({'margin-left':'0px'}); $("#left-navigation").animate({'left':'0px'}); }   else { content.css('margin-left', '0px'); $("#left-navigation").css('left', '0px'); } }  else if ( skin == 'monobook' ) { content.css('z-index', '4'); if ( animated ) { content.animate({'margin-left':'0px'}); }   else { content.css('margin-left', '0px'); } } } function hidePanelCookie(animated) { hidePanel(animated); $("#panel-collapse").find("a").text("Afficher"); $("#panel-collapse").find("a").off("click"); $("#panel-collapse").find("a").click( function( e ) {   e.preventDefault;    showPanelCookie(true);  }); mw.cookie.set("hidepanel", "true"); } function showPanelCookie(animated) { showPanel(animated); $("#panel-collapse").find("a").text("Masquer"); $("#panel-collapse").find("a").off("click"); $("#panel-collapse").find("a").click( function( e ) {   e.preventDefault;    hidePanelCookie(true);  }); mw.cookie.set("hidepanel", "false"); } $(function { mw.loader.using(['mediawiki.util', 'mediawiki.cookie'], function { var content = $('#content'); content.data('margin', content.css('margin-left')); var collapseLink = mw.util.addPortletLink( "p-personal", "#" , "Masquer", "panel-collapse", "Afficher/Masquer le menu latéral", "", "#pt-userpage"); var hide = mw.cookie.get("hidepanel"); if ( hide == "true") { hidePanelCookie(false); } else { $("#panel-collapse").find("a").click( function( e ) {     e.preventDefault;      hidePanelCookie(true);    }); } }); });