User:Art Klang/vector.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
var new_li=document.createElement('li');
new_li.setAttribute('id','ca_sidebar');
document.getElementById('p-namespaces').getElementsByTagName('ul')[0].appendChild(new_li);
var b_sidebar=document.getElementById('ca_sidebar');
b_sidebar.innerHTML="<span><a onclick=\'toggle_sidebar();\'>Show sidebar</a></span>";
 
 
sidebar_shown=0;
 
function toggle_sidebar()
{
 var sidebar=document.getElementById('mw-panel');
 if (sidebar_shown==0)
 {
  sidebar_shown=1;
  sidebar.setAttribute("style","visibility:visible;background-color:#111111;box-shadow: 0px 0px 5px #70C5FD;margin-left:10px;");
  b_sidebar.innerHTML="<span><a onclick=\'toggle_sidebar();\'>Hide sidebar</a></span>";
  document.getElementById('p-logo').setAttribute('style','visibility:hidden;');
  document.getElementById('content').setAttribute('onclick','toggle_sidebar();');
 }
 else
 {
  sidebar.setAttribute("style","visibility:hidden;");
  sidebar_shown=0;
  b_sidebar.innerHTML="<span><a onclick=\'toggle_sidebar();\'>Show sidebar</a></span>";
  document.getElementById('content').removeAttribute('onclick');
 }
}