17,230
edits
m (if I remember my javascript, this will resolve the function scoping issue) |
(no that wasn't the problem. this should fix it.) |
||
Line 1: | Line 1: | ||
var sidebarSwitch; | var sidebarSwitch; | ||
function sidebarHide() { | |||
document.getElementById("mw-panel").style.visibility = "hidden"; | document.getElementById("mw-panel").style.visibility = "hidden"; | ||
document.getElementById("mw-head-base").style.marginLeft = "0"; | document.getElementById("mw-head-base").style.marginLeft = "0"; | ||
Line 10: | Line 10: | ||
sidebarSwitch.parentNode.removeChild(sidebarSwitch); | sidebarSwitch.parentNode.removeChild(sidebarSwitch); | ||
} | } | ||
sidebarSwitch = mw.util.addPortletLink("p-cactions", " | sidebarSwitch = mw.util.addPortletLink("p-cactions", "#", "Show Sidebar", "ca-sidebar", "Show the navigation links", "a"); | ||
$( sidebarSwitch ).on( 'click', function ( e ) { | |||
sidebarShow(); | |||
e.preventDefault(); | |||
} ); | |||
} | } | ||
function sidebarShow() { | |||
document.getElementById("mw-panel").style.visibility = ""; | document.getElementById("mw-panel").style.visibility = ""; | ||
document.getElementById("mw-head-base").style.marginLeft = ""; | document.getElementById("mw-head-base").style.marginLeft = ""; | ||
Line 22: | Line 26: | ||
sidebarSwitch.parentNode.removeChild(sidebarSwitch); | sidebarSwitch.parentNode.removeChild(sidebarSwitch); | ||
} | } | ||
sidebarSwitch = mw.util.addPortletLink("p-cactions", " | sidebarSwitch = mw.util.addPortletLink("p-cactions", "#", "Hide Sidebar", "ca-sidebar", "Hide the navigation links", "a"); | ||
$( sidebarSwitch ).on( 'click', function ( e ) { | |||
sidebarHide(); | |||
e.preventDefault(); | |||
} ); | |||
} | } | ||