Zum Inhalt springen

MediaWiki:Monobook.js/Schopf 2008-04-28

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

// »Nawigatioon und Hywys«

function $(ID) {return document.getElementById(ID);}
function $t(T) {return document.getElementsByTagName(T);}
i = 0;
url = document.URL;
bouncyWiki = "http://upload.wikimedia.org/wikipedia/commons/6/6c/Bouncywikilogo.gif";
barnStar = "http://upload.wikimedia.org/wikipedia/commons/7/7e/Barnstar-rotating.gif";
// Houptsyte-Karte-Wägsl
function mapChangeTempWorkAround() {
 if ($("Houptsyte-Karte")) {
  $("Houptsyte-Karte").getElementsByTagName("img")[0].style.display = "none";
 }
}
addOnloadHook(mapChangeTempWorkAround);
cur = 1;
maps = new Array();
function mapChange() {
 if ($("Houptsyte-Karte")) {
  maps = $("Houptsyte-Karte").getElementsByTagName("img");
  maps[0].xOpacity = 0;
  maps[cur].xOpacity = .99;
  setTimeout(mapFade, 3000);
 }
}
hookEvent("load", mapChange);
function mapFade() {
 curOpacity = maps[cur].xOpacity;
 next = maps[cur+1]?cur+1:0;
 newOpacity = maps[next].xOpacity;
 curOpacity -= .05;
 newOpacity += .05;
 maps[next].style.display = "block";
 maps[cur].xOpacity = curOpacity;
 maps[next].xOpacity = newOpacity;
 setOpacity(maps[cur]);
 setOpacity(maps[next]);
 if (curOpacity <= 0) {
  maps[cur].style.display = "none";
  maps[next].style.filter = "";
  cur = next;
  setTimeout(mapFade, 5000);
 } else {
  setTimeout(mapFade, 35);
 }
 function setOpacity(o) {
  if (o.xOpacity > .99) {
   o.xOpacity = .99;
   return;
  }
  o.style.opacity = o.xOpacity;
  o.style.MozOpacity = o.xOpacity;
  o.style.filter = "alpha(opacity="+(o.xOpacity*100)+")";
 }
}
// Rückmeldungsskript importieren
if (mw.config.get('wgNamespaceNumber') == 0 && wgIsArticle == true && wgCurRevisionId != false && mw.config.get('wgPageName') != "Houptsyte") {
 if (wgUserName == null) {
  document.write('<script type="text/javascript" src="/w/index.php?title=MediaWiki:If-anon-feedback.js&action=raw&ctype=text/javascript&dontcountme=s"><\/script>');
 } else {
  document.write('<script type="text/javascript" src="/w/index.php?title=MediaWiki:If-user-feedback.js&action=raw&ctype=text/javascript&dontcountme=s"><\/script>');
 }
}
if (wgUserName == null && (mw.config.get('wgPageName') == "Spezial:Suche" || (mw.config.get('wgNamespaceNumber') == 0 && wgArticleId == 0)) && navigator.cookieEnabled == true) {
 document.write('<script type="text/javascript" src="/w/index.php?title=MediaWiki:If-search.js&action=raw&ctype=text/javascript&dontcountme=s"><\/script>');
}
// Seitenmenüleistenfunktionen importieren
 document.write('<script type="text/javascript" src="/w/index.php?title=MediaWiki:If-hideable-portlets.js&action=raw&ctype=text/javascript&dontcountme=s"><\/script>');
 document.write('<script type="text/javascript" src="/w/index.php?title=MediaWiki:If-hideable-sidebar.js&action=raw&ctype=text/javascript&dontcountme=s"><\/script>');
// Ajax import feature:
document.write('<style type="text/css">#interProject, #properTitle, #subTitle, #WikiPoll {display: none; speak: none;} #grayTitle {color: #E9E9E9;}<\/style>');
impArr = new Array("NavBar", "LinkFA", "pTitle", "sTitle", "WikiPoll", "sincere-visitor", "pt-login", "patrolLink", "markedPatrolled", "onlyRcID", "sidebar-bug");
done = new Array();
ta = new Object();
function ifID() {
 for (var i = 0; i < impArr.length; i++) {
  varArr = impArr[i];
  if ($(varArr)) {var impVar = i;}
  if ($("pTitle")) {$t("h1")[0].id = "grayTitle";}
  if (varArr == "sincere-visitor" && mw.config.get('wgNamespaceNumber') == 0 && wgUserName == null && wgIsArticle == true && wgCurRevisionId != false && mw.config.get('wgPageName') != "Houptsyte" && navigator.cookieEnabled == true) {var impVar = i;}
  if (varArr == "sidebar-bug" && (mw.config.get('wgUserGroups') && mw.config.get('wgUserGroups').indexOf("sysop") > -1 && !$("n-villagepump")) || document.referrer.indexOf("jsAction=flush") > 0) {var impVar = i;}
  if (impVar == i) {jsImp(i);}
 }
}
addOnloadHook(ifID);
function jsImp(i) {
 var script = document.createElement("script");
 script.type = "text/javascript";
 script.src = "/w/index.php?title=MediaWiki:If-"+impArr[i]+".js&action=raw&ctype=text/javascript&dontcountme=s";
 $t("head")[0].appendChild(script);
}
if (url.indexOf("&rcid=") > 0 && url.indexOf("action=") < 0 && url.indexOf("diff=") < 0) {jsImp(9);}
if (url.indexOf("?diff=next&rcid=") > 0) {jsImp(7);}

// Stabile Versionen

 document.write('<style type="text/css">#dVban, #sVban {border-width: 0 0 1px; color: #000000; margin-left: -1em;} #p-cactions li#ca-nstab-main a.dVyellow {background-color: #FFFAEE;} #p-cactions li#ca-nstab-main a.sVgreen {background-color: #F3FFF3;} li#dVyellow.selected {background-color: #FFFCD9; border: 1px dashed #AAA;} #dVyellow {background-color: #FFFCD9;} li#sVgreen.selected {background-color: #E3FFE3; border: 1px dashed #AAA;} #sVgreen {background-color: #E3FFE3;} #firstRev {background-color: #F5F5F5;}<\/style>');
 if (url.indexOf("stabil&oldid=") > 0) {
  document.write('<style type="text/css">#mw-revision-info, #mw-revision-nav {display: none; speak: none;}<\/style>');
 }
 
 // Stabil-/Entwicklungsversionen
 var sID;
 function stabVer() {
  if ($("copyright")) {sID = $("copyright").getElementsByTagName("a")[0].id;}
  if (sID) {
   var cnm = $("ca-nstab-main").getElementsByTagName("a")[0];
   var pCact = $("p-cactions").getElementsByTagName("ul")[0];
   if (wgCurRevisionId == sID && url.indexOf("oldid=") < 0 || url.indexOf("oldid="+sID) > 0 && url.indexOf("diff=") < 0) {
    cnm.className = "sVgreen";
    if (url.indexOf("action=edit&stabil") < 0) {
     cnm.href = "javascript:showBanner(1)";
    } else {
     cnm.href += "?stabil&oldid="+sID;
    }
    cnm.innerHTML = "Stabilversion";
    $t("h1")[0].innerHTML += '<a class="anti-hoax" id="vLink" style="background-color: #F0FFF0; cursor: help; font-size: 10px; line-height: 10px; margin-left: 0.7em;" href="javascript:showBanner(1)" title="Zeigt eine erweiterte Beschreibung">[Beständige Version]<\/a>';
    sVer = document.createElement("div");
    if (is_khtml) {
     sVer.setAttribute("style", "margin: -0.7em 115px 0.7em 165px;");
    }
    if (wgCurRevisionId == sID) {
     $("ca-edit").id = "ca-viewsource";
     pCact.getElementsByTagName("a")[2].innerHTML = "Artikel weiterentwickeln";
     var dev = "";
    } else {
     var dVtab = document.createElement("li");
     dVtab.innerHTML = '<a href="/wiki/'+mw.config.get('wgPageName')+'?aktuell" title="Betrachte die brandaktuelle Version!">Entwicklungsversion<\/a>';
     pCact.insertBefore(dVtab, $("ca-nstab-main"));
     pCact.removeChild(pCact.getElementsByTagName("li")[3]);
     var dev = ' <small>(<a class="anti-hoax" href="/wiki/'+mw.config.get('wgPageName')+'?action=edit&stabil&oldid='+sID+'" title="Verwende den Quelltext der stabilen Version!">Quelltext<\/a>)<\/small>. Es gibt jedoch eine aktuellere <a class="anti-hoax" href="/wiki/'+mw.config.get('wgPageName')+'?aktuell" title="Betrachte die brandaktuelle Version!">Entwicklungsversion<\/a> <small>(<a class="anti-hoax" href="/wiki/'+mw.config.get('wgPageName')+'?diff=0&oldid='+sID+'" title="Vergleiche die beständige mit der aktuellen Version!">Unterschied<\/a>)<\/small>';
    }
    sVer.innerHTML = '<table id="sVban" style="border-style: solid; border-color: #32CD32; border-collapse: collapse; background-color: #F0FFF0; line-height: 1.8em;"><tr><td style="padding: 2px 9px 1px;">Diese Ausgabe des Artikels ist eine beständige <b>„<a class="anti-hoax" href="/wiki/Wikipedia:Stabilversionen" title="Was ist eine Stabilversion?">Stabilversion<\/a>“<\/b>'+dev+'.<\/td><\/tr><\/table>';
    if ($("dVban")) {
     $("lastmod").insertBefore(sVer, $("dVban"));
     $("lastmod").removeChild($("dVban"));
    } else {
     $("f-list").insertBefore(sVer, $("copyright"));
    }
   } else if (wgCurRevisionId != sID && url.indexOf("oldid=") < 0) {
    if ($("dVban")) {
     cnm.className = "dVyellow";
     cnm.href = "javascript:showBanner(1)";
     cnm.innerHTML = "Entwicklungsversion";
     var sVtab = document.createElement("li");
     sVtab.innerHTML = '<a href="/wiki/'+mw.config.get('wgPageName')+'?stabil&oldid='+sID+'" title="Betrachte die stabile Version!">Stabilversion<\/a>';
     pCact.insertBefore(sVtab, $("ca-talk"));
     $t("h1")[0].innerHTML += '<a class="anti-hoax" id="vLink" style="background-color: #FFFBDE; cursor: help; font-size: 10px; line-height: 10px; margin-left: 0.7em;" href="javascript:showBanner(1)" title="Zeigt eine erweiterte Beschreibung">[Änderbare Version]<\/a>';
     if (is_khtml) {
      $("dVban").setAttribute("style", "border-style: solid; border-color: #FFAA80; border-collapse: collapse; background-color: #FFFADE; line-height: 1.8em; margin: -0.7em 115px 0.7em 165px;");
     }
    }
   }
  }
 }
 addOnloadHook(stabVer);
 function showBanner(x) {
  var a = $("ca-nstab-main").getElementsByTagName("a")[0];
  if (x != 1) {
   if ($("dVban")) {$("contentSub").removeChild($("dVban"));}
   if ($("sVban")) {$("contentSub").removeChild($("sVban"));}
   $("vLink").className = "hiddenStructure";
   a.href = url;
  } else {
   if ($("dVban")) {
    if (is_khtml) {
     $("dVban").setAttribute("style", "border-style: solid; border-color: #FFAA80; border-collapse: collapse; background-color: #FFFADE; line-height: 1.8em;");
    }
    $("contentSub").appendChild($("dVban"));
   }
   if ($("sVban")) {$("contentSub").appendChild($("sVban"));}
   $("vLink").setAttribute("style", "color: #778899; font-size: 10px; line-height: 10px; margin-left: 0.7em;");
   $("vLink").href = "javascript:showBanner(0)";
   a.href = "javascript:showBanner(0)";
  }
 }
 
 // Markierungen unter "Versionen/Autoren"
 if (url.indexOf("=history") > 0) {
  function sVmark() {
   var sID = $("histlegend").className;
   if (sID) {
    var ip = $t("input");
    for (var i = 0; i < ip.length; i++) {
     if (ip[i].name == "oldid") {
      if (ip[i].value == wgCurRevisionId) {
       ip[i].parentNode.id = "dVyellow";
      }
      if (ip[i].parentNode.innerHTML.indexOf(") (vorane) ") > 0) {
       ip[i].parentNode.id = "firstRev";
      }
      if (ip[i].value == sID) {
       ip[i].parentNode.id = "sVgreen";
      }
     }
    }
    if ($("pagehistory").innerHTML.indexOf("<li>(Jetz) (vorane)") > 0) {
     $("pagehistory").getElementsByTagName("li")[0].id = "sVgreen";
    }
   }
  }
  addOnloadHook(sVmark);
 }
 
 // Versionen als "stabil" markieren (SysOps)
 if (mw.config.get('wgNamespaceNumber') == 0) {
  function makeStable() {
   if (mw.config.get('wgUserGroups') != null && mw.config.get('wgPageName') != "Houptsyte") {
    if (mw.config.get('wgUserGroups')[0] == "sysop" || mw.config.get('wgUserGroups')[1] == "sysop") {
     if (mw.config.get('wgNamespaceNumber') == 0 && url.indexOf("oldid=") > 0 && url.indexOf("diff=") < 0 && !(sID && url.indexOf("oldid="+sID) > 0)) {
      var oldid = url.replace(/.*?oldid=([0-9]+).*/, "$1");
      var span = document.createElement("span");
      span.setAttribute("style", "float: right; color: #000000; font-size: larger;");
      span.innerHTML = ' [<a style="color: #008000;" href="javascript:ask(\''+oldid+'\')">Zur stabilen Version machen<\/a>]';
      $("mw-revision-info").appendChild(span);
     }
    }
   }
  }
  addOnloadHook(makeStable);
 }
 xTimes = 0;
 function ask(x) {
  var img = new Image();
  img.src = bouncyWiki;
  if (img.complete == true) {
   var ask = confirm("Diese Version wirklich zur Stabilversion machen?");
   if (ask == true) {
    location.href = "/wiki/MediaWiki:Stabilversion/"+mw.config.get('wgPageName')+"?action=edit&useID="+x;
   }
  } else {
   xTimes = xTimes +1;
   if (xTimes < 9) {
    window.setTimeout('ask('+x+')', 250);
   }
  }
 }
 
 // Versionsmarkierung (autoEdit)
 if (url.indexOf("&useID=") > 0) {
  document.write('<style type="text/css">body {background: #f9f9f9 url('+bouncyWiki+') center 200px no-repeat;} #globalWrapper {display: none; speak: none;}<\/style>');
  function autoEdit() {
   var useID = url.replace(/.*?useID=([0-9]+).*/, "$1");
   var editForm = document.editform.wpTextbox1;
   editForm.value = useID;
   document.editform.wpSummary.value = '[['+mw.config.get('wgPageName')+'|'+useID+']]';
   var minorEdit = document.editform.wpMinoredit;
   var watchThis = document.editform.wpWatchthis;
   if (minorEdit.checked != true) {minorEdit.checked = true;}
   if (watchThis.checked == true) {watchThis.checked = false;}
   document.editform.submit();
  }
  addOnloadHook(autoEdit);
 }
 if (url.indexOf("MediaWiki:Stabilversion/") > 0 && url.indexOf("?") < 0) {
  document.write('<style type="text/css">body {background: #f9f9f9 url('+bouncyWiki+') center 200px no-repeat;} #globalWrapper {display: none; speak: none;}<\/style>');
  function autoRedirect() {
   var pageName = url.replace(/.*?Stabilversion\/(.*)/, "$1");
   location.href = '/wiki/'+pageName+'?stabil&oldid='+$("bodyContent").getElementsByTagName("p")[0].innerHTML;
  }
  addOnloadHook(autoRedirect);
 }
 
 // Versionsmarken aus RC ausblenden
 function hideRevTagsLink() {
  var tRTL = $("hideRevTags");
  if (tRTL) {
   tRTL.innerHTML = 'Versioonsmarka <a href="javascript:hideRevTags(1)" id="hideRTLink">usblände<\/a>';
   if (document.cookie.indexOf("hideRevTags=1") > -1) {hideRevTags(1);}
  }
 }
 addOnloadHook(hideRevTagsLink);
 var doneRep;
 function hideRevTags(x) {
  var li = $t("li");
  for (var i = 0; i < li.length; i++) {
   var a2 = li[i].getElementsByTagName("a")[1];
   if (a2) {
    var title = a2.title;
    var tBase = title.replace(/(.*?)\/.+/, "$1");
    if (tBase == "MediaWiki:Stabilversion") {
     if (x != 1) {
      li[i].className = "visibleStructure";
     } else {
      li[i].className = "hiddenStructure";
     }
    }
   }
  }
  if ($("RCM0")) {
   if (is_gecko) {var tag = "SPAN";} else {var tag = "DIV";}
   if (doneRep != 1) {
    var oldHTML = $("bodyContent").innerHTML.replace(/<(img src|span id)/gi, "<$1");
    var mHTML = oldHTML.replace(/<(img)(.*?)<(a)(.*?)(title="MediaWiki:Stabilversion)(.*?)<(br)(.*?)>/gi, '<'+tag+' class="sVrevTag"><$1$2<$3$4$5$6<$7$8></'+tag+'>');
    var nHTML = mHTML.replace(/<(span id="RCM)(.*?)<(a href="\/)(.*?)(title="MediaWiki:Stabilversion)(.*?)<(br)(.*?)>/gi, '<'+tag+' class="sVrevTag"><$1$2<$3$4$5$6<$7$8></'+tag+'>');
    var newHTML = nHTML.replace(/<(img src|span id)/gi, "<$1");
    $("bodyContent").innerHTML = newHTML;
    doneRep = 1;
   }
   var gTag = $t(tag);
   for (var j = 0; j < gTag.length; j++) {
    if (gTag[j].className.indexOf("sVrevTag") > -1) {
     if (x != 1) {
      gTag[j].className = "sVrevTag";
     } else {
      gTag[j].className = "hiddenStructure sVrevTag";
     }
    }
   }
  }
  if (x != 1) {
   document.cookie = "hideRevTags=0; path=/";
   $("hideRTLink").href = "javascript:hideRevTags(1)";
   $("hideRTLink").firstChild.nodeValue = "usblände";
  } else {
   document.cookie = "hideRevTags=1; path=/";
   $("hideRTLink").href = "javascript:hideRevTags(0)";
   $("hideRTLink").firstChild.nodeValue = "yblände";
  }
 }

 function replaceInit() {
  if (mw.config.get('wgAction') == "edit" || mw.config.get('wgAction') == "submit") {
   $("replace").innerHTML = '(<a href="javascript:replaceFunc()">+/-<\/a>)';
  }
 }
 addOnloadHook(replaceInit);
 function replaceFunc() {
  searchPrompt = prompt("Gib zerscht y, was gsuecht werre soll (alt)!", "");
  if (searchPrompt != "" && searchPrompt != null) {
   replacePrompt = prompt("Gib jetz y, mit was ersätzt werre soll (nej)!", "");
   if (replacePrompt != "" && replacePrompt != null) {
    var editForm = document.editform.wpTextbox1;
    var regEx = new RegExp(searchPrompt, "g");
    editForm.value = editForm.value.replace(regEx, replacePrompt);
    alert("Dong!");
   }
  }
 }
 // end