MediaWiki:Common.js

From CenterfocusWiki
Revision as of 14:25, 12 January 2011 by CfWikiSysop (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Clear the 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
}