MediaWiki:If-hideable-sidebar.js

Us der alemannische Wikipedia, der freie Dialäkt-Enzyklopedy

Hywys: Nôch dyner Änderig muess no der Browser-Cache gleert wärde!
Mozilla/Safari/Konqueror: Strg-Umschalttaste-R (oder Umschalttaste drückt halte und uf’s Neu-Laden-Symbol klicke), IE: Strg-F5, Opera/Firefox: F5

 // D’Syteloischte (Menü) y- und usblènde (um meh Platz z’hong)

 function prepareSidebar() {
  if (navigator.cookieEnabled == true) {
   var li = document.createElement("li");
   li.id = "t-toggle";
   li.innerHTML = '<a href="javascript:toggleSidebar()">Syteloischte usblände<\/a>';
   var tb = document.getElementById("p-tb");
   if(tb) {
   	ul = tb.getElementsByTagName("ul")[0];
   	if(ul) {
		ul.appendChild(li);
   	}
   }
  }
 }
 $(prepareSidebar);

 document.write('<style type="text/css">.pShow {display: block !important;} .onlyContent {border-right: 1px solid #aaa !important; margin: 2.8em 18px 0 33px !important; padding-left: 2.5em !important;} .movedCactions {left: 14px !important;} #hSbTop, #hSbLeft {position: absolute; left: 4px; top: 0; color: #99AABB; font-size: 9px; z-index: 9;} #hSbLeft {top: 11px !important;} #hSbTop a, #hSbLeft a {color: #778899;} #mbSpiral {background: url(//upload.wikimedia.org/wikipedia/als/f/fe/Monobook-spiral.png) repeat-y; position: absolute; left: -22px; top: 0; height: 100%; z-index: 3;}<\/style>');
 document.write('<!--[if lt IE 7]><style type="text/css">.IEfooter {margin-left: -1px !important;}<\/style><![endif]-->');
 if (document.cookie.indexOf("sidebar=hidden") > -1) {
  document.write('<style id="hideSidebar" type="text/css">#p-logo, #p-navigation, #p-contribution, #p-support, #p-search, #p-tb, #p-feedback, #p-lang {display: none;} #content {border-right: 1px solid #aaa !important; margin: 2.8em 18px 0 33px !important; padding-left: 2.5em !important;} #p-cactions {left: 14px !important;}<\/style>');
  document.write('<!--[if lt IE 7]><style id="expandFooter" type="text/css">#footer {margin-left: -1px !important;}<\/style><![endif]-->');
  $(monobookSpiral);
 }
 function toggleSidebar() {
  var pArray = new Array("logo", "navigation", "contribution", "support", "search", "tb", "feedback", "lang");
  var confirmSidebarToggling;
  if (document.cookie.indexOf("sidebar=hidden") < 0) {
   if (document.cookie.indexOf("confirmSidebarToggling") > -1) {confirmSidebarToggling = true;}
   if (confirmSidebarToggling != true) {
    confirmSidebarToggling = confirm("D’Sytemenüloischte wirkle usblènde?\n\nS Menü ka natirle ou wyder yblèndet werre ;-)");
    document.cookie = "confirmSidebarToggling=0; path=/";
   }
   if (confirmSidebarToggling == true) {
    pClass = "hiddenStructure";
    $id("content").className = "onlyContent";
    $id("p-cactions").className = "portlet movedCactions";
    $id("footer").className = "IEfooter";
    monobookSpiral();
    document.cookie = "sidebar=hidden; path=/";
   }
  } else {
   if ($id("hideSidebar")) {$t("head")[0].removeChild($id("hideSidebar"));}
   if ($id("expandFooter")) {$t("head")[0].removeChild($id("expandFooter"));}
   $id("globalWrapper").removeChild($id("hSbLeft"));
   $id("globalWrapper").removeChild($id("hSbTop"));
   $id("content").removeChild($id("mbSpiral"));
   $id("content").className = "sidebar-content";
   $id("footer").className = "sidebar-footer";
   $id("p-cactions").className = "portlet";
   pClass = "portlet pShow";
   document.cookie = "sidebar=shown; path=/";
  }
  for (var p = 0; p < pArray.length; p++) {
   if ($id("p-"+pArray[p])) {
    $id("p-"+pArray[p]).className = pClass;
   }
  }
 }

 function monobookSpiral() {
  var div = document.createElement("div");
  div.id = "mbSpiral";
  div.innerHTML = '<a href="javascript:toggleSidebar()" style="display: block; height: '+$id("content").offsetHeight+'px !important; width: 37px;"><\/a>';
  $id("content").appendChild(div);
  var tSpan = document.createElement("span");
  tSpan.id = "hSbTop";
  tSpan.innerHTML = '<a href="/wiki/Houptsyte">Houptsyte<\/a> | <a href="javascript:toggleSidebar()">Syteloischte wyder aazoige<\/a>';
  $id("globalWrapper").appendChild(tSpan);
  var lSpan = document.createElement("span");
  lSpan.id = "hSbLeft";
  lSpan.innerHTML = '<a href="/wiki/Spezial:Suche">Suech<\/a><br \/><a href="/wiki/Spezial:Letzte_Änderungen">LÄ<\/a>';
  $id("globalWrapper").appendChild(lSpan);
 }