User:Arielco/ShowHideSidebar-Modern.js

( 	function ( mw, $ ) {	var sidebarSwitch;

function sidebarHide { document.getElementById( 'mw_portlets' ).style.visibility = 'hidden'; document.getElementById( 'mw_content' ).style.marginLeft = '0'; document.getElementById( 'p-cactions' ).style.marginLeft = '0'; if ( sidebarSwitch ) { sidebarSwitch.parentNode.removeChild(sidebarSwitch); }		sidebarSwitch = mw.util.addPortletLink( 'p-cactions', '#', 'Show sidebar', 'ca-sidebar', 'Show the navigation links', 'a' ); $( sidebarSwitch ).click( function ( e ) {			console.log('showing sidebar');			e.preventDefault;			sidebarShow;		} ); }	function sidebarShow { document.getElementById( 'mw_portlets' ).style.visibility = null; document.getElementById( 'mw_content' ).style.marginLeft = null; document.getElementById( 'p-cactions' ).style.marginLeft = null; if ( sidebarSwitch ) { sidebarSwitch.parentNode.removeChild(sidebarSwitch); }		sidebarSwitch = mw.util.addPortletLink( 'p-cactions', '#', 'Hide sidebar', 'ca-sidebar', 'Hide the navigation links', 'a' ); $( sidebarSwitch ).click( function ( e ) {			console.log('hiding sidebar');			e.preventDefault;			sidebarHide;		} ); }	console.log("2017-03-03"); // Only activate on Vector skin if ( mw.config.get( 'skin' ) === 'modern' ) { $( function {			$('#searchInput').attr( 'accesskey', function{console.log('alt-F accesskey');} );			console.log($('#searchInput').attr('accesskey'));			// Change this if you want to show the sidebar by default			console.log('initial sidebarHide');			sidebarHide;		} ); } }( mediaWiki, jQuery ) );