MediaWiki:Common.js

From CenterfocusWiki

Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: hold Ctrl while clicking Refresh, or press Ctrl-F5; Konqueror:: simply click the Reload button, or press F5; Opera users may need to completely clear their cache in Tools→Preferences.

/* 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, #pt-login,#ca-nstab-main,#ca-history, #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, #pt-login,#ca-nstab-main,#ca-history, #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