User:Vilas rokade/common.js

var sideBarToggleCookieName = mw.config.get('wgDBname') + 'SidebarState'; if( $.cookie(sideBarToggleCookieName) === null ){ $.cookie(sideBarToggleCookieName, 'visible'); }

if( $.cookie(sideBarToggleCookieName) == 'visible' ){ appendCSS(		'#content {margin-left: 10em !important;} ' +		'#mw-panel { visibility:visible} ' +		'#left-navigation {left: 10em !important;} ' +		'#footer {margin-left: 10em !important;} ' +		'#mw-head-base{margin-left: 10em !important;}'	); }else{ appendCSS(		'#content {margin-left: 0.5em !important;} ' +		'#mw-panel { visibility:hidden} ' +		'#left-navigation {left: 0.5em !important;} ' +		'#footer {margin-left: 0.5em !important;} ' +		'#mw-head-base{margin-left: 0.5em !important;}'	); }

document.onkeydown = function( e ) { if( e == null ){ e = event; } if( testKey( e, 113 ) ) { //F2 key if( $.cookie(sideBarToggleCookieName) == 'collapsed' ){ appendCSS(				'#content {margin-left: 10em !important;} ' +				'#mw-panel { visibility:visible} ' +				'#left-navigation {left: 10em !important;} ' +				'#footer {margin-left: 10em !important;} ' +				'#mw-head-base{margin-left: 10em !important;}'			); $.cookie(sideBarToggleCookieName, 'visible'); }else{ appendCSS(				'#content {margin-left: 0.5em !important;} ' +				'#mw-panel { visibility:hidden} ' +				'#left-navigation {left: 0.5em !important;} ' +				'#footer {margin-left: 0.5em !important;} ' +				'#mw-head-base{margin-left: 0.5em !important;}'			); $.cookie(sideBarToggleCookieName, 'collapsed'); }		return false; } }

function testKey( e, intKeyCode ) { if( window.createPopup ){ return e.keyCode == intKeyCode }else{ return e.which == intKeyCode } }