MediaWiki:Common.js

From CenterfocusWiki

(Difference between revisions)
Jump to: navigation, search
(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 = '...)
Current revision (14:25, 12 January 2011) (edit) (undo)
 
Line 15: Line 15:
return s;
return s;
}
}
- 
document.onkeydown = function( e ) {
document.onkeydown = function( e ) {
Line 22: Line 21:
if (MediaWikiNavEnabled)
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;}');
+
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
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;}');
+
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;
MediaWikiNavEnabled=!MediaWikiNavEnabled;

Current revision

/* 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