MediaWiki:Common.js

From CenterfocusWiki

(Difference between revisions)
Jump to: navigation, search

CfWikiSysop (Talk | contribs)
(New page: - Any JavaScript here will be loaded for all users on every page load. - MediaWikiNavEnabled=true; function appendCSS(text) { var s = document.createElement('style'); s.type = '...)
Next diff →

Revision as of 14:04, 12 January 2011

/* Any JavaScript here will be loaded for all users on every page load. */

MediaWikiNavEnabled=true;



function appendCSS(text) {

 var s = document.createElement('style');
 s.type = 'text/css';
 s.rel = 'stylesheet';
 if (s.styleSheet) s.styleSheet.cssText = text //IE
 else s.appendChild(document.createTextNode(text + )) //Safari sometimes borks on null
   document.getElementsByTagName('head')[0].appendChild(s);
 return s;

}


document.onkeydown = function( e ) {

if( e == null ) e = event
if( testKey( e, 122 ) ) { //F11

if (MediaWikiNavEnabled)

       appendCSS('#column-content {margin: 0 0 .6em 0;} #content {margin: 2.8em 0 0 0;} .generated-sidebar, #p-lang, #p-tb, #p-search, #p-navigation {display:inline;} #p-cactions {left: .1em;} #footer {display:inline;}');

else

       appendCSS('#column-content {margin: 0 0 .6em 0;} #content {margin: 2.8em 0 0 0;} #p-logo, .generated-sidebar, #p-lang, #p-tb, #p-search, #p-navigation {display:none;} #p-cactions {left: .1em;} #footer {display:none;}');
       MediaWikiNavEnabled=!MediaWikiNavEnabled;
return false;
}

}


function testKey( e, intKeyCode ) {

       if( window.createPopup )
               return e.keyCode == intKeyCode
       else
               return e.which == intKeyCode

}

Personal tools