User:DerHexer/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. If this is a .js page, the code will be executed when previewing the page.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
 // get URL parameters (used for page type variables)
 var UrlParameters = new Array ();
 readparams();
 
 function readparams() {
  var asReadInUrlParameters;
  var asReadInUrlParameter;
 
  // Get URL parameters
  asReadInUrlParameters = location.search.substring(1, location.search.length).split("&");
  for (i = 0; i < asReadInUrlParameters.length; i++) {
    asReadInUrlParameter = asReadInUrlParameters[i].split("=");
    UrlParameters[decodeURIComponent(asReadInUrlParameter[0])] = decodeURIComponent(asReadInUrlParameter[1]);
  }
 }
 
 function fillActionPage() {
   if (UrlParameters["action"] == "rollback") {
     if (document.getElementsByTagName("h1")[0].childNodes[0].nodeValue == 'Action complete') {
       window.close();
     }
   }
   if (UrlParameters["action"] == "delete") {
     if ((document.getElementsByTagName("h1")[0].childNodes[0].nodeValue == 'Action complete') || (document.getElementsByTagName("h1")[0].childNodes[0].nodeValue == 'Internal error')) {
       window.close();
     } else if (UrlParameters["deletereason"] != 'undefined') {
       var deletedtitle = wgPageName;
       var reason = UrlParameters["deletereason"];
                function newRequest()
                {
                  try {
                    if (window.XMLHttpRequest) {
                      return new XMLHttpRequest();
                    } else {
                      return new ActiveXObject("MSXML2.XMLHTTP");
                    }
                  } catch (e) {
                    return false;
                  }
                }
 
                var req;
                if (req = newRequest()) {
                  var text = "/w/api.php?format=xml&action=query&prop=info&inprop=protection&titles=" + deletedtitle.replace(/ /g, "%20").replace(/&/g, "%26").replace(/\"/g, "%22").replace(/\+/g, "%2B") + "&rvlimit=10";
                  req.open("GET", text, false);
                  req.send("");
 
                  var revisions = req.responseXML.getElementsByTagName("pr");
                  if (revisions.length < 1) {
                    if (wgCanonicalNamespace != "Image") {
                      document.getElementById("deleteconfirm").wpReason.value = reason.replace(/\%7C/g, "|");
                      document.getElementById("deleteconfirm").wpConfirmB.click();
                    } else {
                      document.forms[0].wpReason.value = reason.replace(/\%7C/g, "|");
                      document.getElementById("mw-filedelete-submit").click();
                    }
                  }
              }
     }
   }
   if (UrlParameters["blockreason"] > "" && UrlParameters["blockduration"] > "") {
     document.forms["blockip"].wpBlockReason.value = UrlParameters["blockreason"];
     if (UrlParameters["blockduration"].search(/[^\d]/) == -1) {
       document.forms["blockip"].wpBlockOther.value = UrlParameters["blockduration"] + " hours";
       var blocktime = UrlParameters["blockduration"] + " hours";
     } else {
       document.forms["blockip"].wpBlockOther.value = UrlParameters["blockduration"];
       var blocktime = UrlParameters["blockduration"];
     }
     if ((wgUserName == "KnowledgeOfSelf") && ((blocktime.search(/week/) != -1) || (blocktime.search(/month/) != -1) || (blocktime.search(/year/) != -1))) { document.forms["blockip"].wpCreateAccount.click(); }
     var isBlocked = UrlParameters["title"].replace(/Special:BlockIP\//, '');
     if (isBlocked.search(/\d+\.\d+\.\d+\.\d+/) == -1) {
       if (UrlParameters["blockreason"] != 'name') {
        if (prompt('Are you sure to block, ' + isBlocked + ' ?','ja')) {
         if ((UrlParameters["blockreason"] != '\{\{uw-ublock\}\}') && (UrlParameters["blockreason"] != '\{\{uw-uhblock\}\}')) {
           var newurl = "http://en.wikipedia.org/w/index.php?title=User_talk:" + isBlocked + "&action=edit&addtemplate=2";
         } else if (UrlParameters["blockreason"] == '\{\{uw-ublock\}\}') {
           document.forms["blockip"].wpCreateAccount.click();
           document.forms["blockip"].wpEnableAutoblock.click();
           var newurl = "http://en.wikipedia.org/w/index.php?title=User_talk:" + isBlocked + "&action=edit&addtemplate=3";
         } else {
           var newurl = "http://en.wikipedia.org/w/index.php?title=User_talk:" + isBlocked + "&action=edit&addtemplate=4";
         }
         if (isBlocked.search(/\d+\.\d+\.\d+\.\d+/) == -1) { window.setTimeout(function() { document.forms["blockip"].wpBlock.click(); }, 100); }
        }
       } else if ((UrlParameters["blockduration"] != 'infinite') && (isBlocked.search(/\w/) == -1)) {
         window.setTimeout(function() { document.forms["blockip"].wpBlock.click(); }, 100);
       }
     } else {
       var newurl = "http://en.wikipedia.org/w/index.php?title=User_talk:" + isBlocked + "&action=edit&addtemplate=1&blockduration=" + blocktime;
       window.setTimeout(function() { document.forms["blockip"].wpBlock.click(); }, 100);
     }
     if ((UrlParameters["blockduration"] != 'infinite') || (isBlocked.search(/\d+\.\d+\.\d+\.\d+/) == -1)) { window.setTimeout(function() { location.href = newurl; }, 1000); }
   }
   if (UrlParameters["protectreason"] > "" && UrlParameters["protectduration"] > "" && UrlParameters["protecttype"] > "") {
     document.getElementById("expires").value = UrlParameters["protectduration"];
     document.getElementById("mwProtect-reason").value = UrlParameters["protectreason"];
     protectLevelsUpdate(this);
     if (UrlParameters["anotherprotecttype"] != '') {
       document.getElementById("mwProtect-level-move").selectedIndex = UrlParameters["anotherprotecttype"];
     } else {
       document.getElementById("mwProtect-level-move").selectedIndex = UrlParameters["protecttype"];
     }
     document.getElementById("mwProtect-level-edit").selectedIndex = UrlParameters["protecttype"];
     window.setTimeout(function() { document.getElementById("mw-Protect-submit").click(); }, 100);
   }
   if ( ( (UrlParameters["title"] == 'Special:Log') && (UrlParameters["type"] == 'newusers') ) || (location.href.substring(location.href.indexOf("/wiki/")).search(/Special\:Log\/newusers/) != -1) ) {
    if ( (UrlParameters["limit"] < 51) || (document.body.getElementsByTagName("p")[1].childNodes[0].nodeValue.match(/\d+/) < 51) ) {
     var as = document.body.getElementsByTagName("ul")[0].getElementsByTagName("a");
     for (i=0; i < as.length; i++) {
       if (as[i].childNodes[0].nodeValue == "block") {
         var newlink = document.createElement('a');
         newlink.setAttribute('href', 'http://en.wikipedia.org/w/index.php?title=Special:BlockIP/' + as[i].title.replace(/Special:BlockIP\//, '') + '&blockreason=name&blockduration=infinite'); 
         var EditTextNode = document.createTextNode("fastblock");
         newlink.appendChild(EditTextNode);
         as[i].parentNode.insertBefore( newlink, as[i].nextSibling );
         as[i].parentNode.insertBefore( document.createTextNode(' | '), as[i].nextSibling );
       }
     }
    }
   }
   if (UrlParameters["title"] == 'Category:All_images_with_the_same_name_on_Wikimedia_Commons') {
     var as = document.getElementsByTagName("table")[1].getElementsByTagName("a");
     for (i=0; i<as.length; i++) {
       as[i].href = "http://en.wikipedia.org/w/index.php?title=" + as[i].href.replace(/http\:\/\/en\.wikipedia\.org\/wiki\//, '') + "&opencommons=1";
     }
   }
   if (UrlParameters["opencommons"] > "") {
     var uri = "http://commons.wikimedia.org/w/index.php?title=" + wgPageName;
     window.open(uri);
   }
   if (UrlParameters["diff"] > "") {
     function searchRollbackLink() {
       var tds = document.getElementsByTagName("td");
       for (var i=0; i<tds.length; i++) {
         var td = tds[i]; 
         if (td.className != "diff-ntitle") continue;
         var as = td.getElementsByTagName("a");
         for (var j=0; j<as.length; j++) {
           var a = as[j];
           if (!/.*action=rollback.*/(a.href)) continue;
           var newlink = document.createElement('a');
           a.setAttribute('accesskey', "s");
           newlink.setAttribute('href', a.href);
           var EditTextNode = document.createTextNode("normal rollback");
           newlink.appendChild(EditTextNode);
           as[j].parentNode.insertBefore( newlink, as[j].nextSibling );
           as[j].parentNode.insertBefore( document.createTextNode(' | '), as[j].nextSibling );
           return a;
         }
       }
       return tds;
     }
 
     function RollAndSpam(rolluri) {
       location.href = rolluri;
       var backrolled = rolluri.split("from=")[1].split("&token=")[0];
       var vandalizedpage = wgPageName;
       var uri = "http://en.wikipedia.org/w/index.php?title=User talk:" + backrolled + "&vandalizedpage=" + vandalizedpage + "&action=edit&spam=1";
       window.setTimeout(function() { location.href = uri; }, 500);
     }
     var revlink = searchRollbackLink();
     revlink.onclick = function() { RollAndSpam(revlink.href); return false; }
   }
   if ( (UrlParameters["spam"] > "") && (UrlParameters["vandalizedpage"] > "") ) {
       document.editform.wpMinoredit.checked=true;
       var splitted = document.forms["editform"].wpTextbox1.value.split("<!--");
       var lastsplitted = splitted[splitted.length-1];
       var now = new Date();
       var actual_time = now.getTime();
       var last_time = lastsplitted.match(/([\:\d]+)\, (\d+) ([^\d]+) (\d+)/);
       var last_timestamp = Date.parse(RegExp.$2 + " " + RegExp.$3 + " " + RegExp.$4 + " " + RegExp.$1 + ":00 GMT");
       var difftime = last_timestamp + 86400000 - actual_time;
       if (!difftime) {
         var now = new Date();
         var actual_time = now.getTime();
         var last_time = splitted[splitted.length-2];
         if (last_time) last_time = last_time.replace(/.*\]\]/g,'').match(/([\:\d]+)\, (\d+) ([^\d]+) (\d+)/g);
         var last_timestamp = Date.parse(RegExp.$2 + " " + RegExp.$3 + " " + RegExp.$4 + " " + RegExp.$1 + ":00 GMT");
         var difftime = last_timestamp + 86400000 - actual_time;
       }
       var matchedtemplate = lastsplitted.match(/uw\-([^\d]*)(\d)/);
       var matchedtemplatename = RegExp.$1;
       var matchednumber = RegExp.$2;
       var matchedtemplate2 = lastsplitted.match(/Template\:Test(\d)/);
       var matchednumber2 = RegExp.$1;
       if (lastsplitted.search(/Uw\-Blank(\d)/) != -1) {
         var matchednumber = RegExp.$1;
         var matchedtemplatename = 'vandalism';
       } else if (lastsplitted.search(/Uw\-Blank[^\d]/) != -1) {
         var matchednumber = 1;
         var matchedtemplatename = 'vandalism';
       }
       if ((lastsplitted.search(/Uw\-bv/) != -1) || (lastsplitted.search(/Blatantvandal/) != -1) || (lastsplitted.search(/longterm/) != -1)) {
         var matchednumber = 4;
         var matchedtemplatename = 'vandalism';
       }
       if ((!matchedtemplatename) || (matchedtemplatename == 'cluebotwarning') || (matchedtemplatename == 'w/index.php?title=') || (matchedtemplatename == 'block') || (matchedtemplatename == 'huggle') || (matchedtemplatename == 'huggleblock') || (difftime < 0) || (matchedtemplatename.search(/\d/) != -1)) { 
         var matchedtemplatename = 'vandalism';
       }
       if ((document.forms["editform"].wpTextbox1.value == "") || (!last_time)) {
         document.editform.wpSummary.value = "Caution: " + matchedtemplatename + " on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
         document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\{\{subst\:uw-" + matchedtemplatename + "2\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
         document.editform.wpSave.click();
         window.setTimeout(function() { window.close(); }, 750);
       } else {
         if (difftime < 0) {
           document.editform.wpSummary.value = "Caution: " + matchedtemplatename + " on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
           document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst\:uw-" + matchedtemplatename + "2\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
           document.editform.wpSave.click();
           window.setTimeout(function() { window.close(); }, 750);
         } else {
             if ((matchednumber == 4) || (matchednumber2 == 4)) {
               if (wgTitle.match(/\d+\.\d+\.\d+\.\d+/)) {
 
                function newRequest()
                {
                  try {
                    if (window.XMLHttpRequest) {
                      return new XMLHttpRequest();
                    } else {
                      return new ActiveXObject("MSXML2.XMLHTTP");
                    }
                  } catch (e) {
                    return false;
                  }
                }
 
                var req;
                if (req = newRequest()) {
                  var text = "/w/api.php?format=xml&action=query&list=logevents&letype=block&letitle=User:" + wgTitle;
                  req.open("GET", text, false);
                  req.send("");
 
                  var blocks = req.responseXML.getElementsByTagName("block");
                  if (blocks.length > 0) {
                    if (blocks[0].getAttribute('duration').search(/\./) == -1) {
                      var duration = blocks[0].getAttribute('duration');
                    } else {
                      var duration = "12 hours";
                    }
                  } else {
                    var duration = "12 hours";
                  }
                }
 
                if (duration.search(/(\d+) (\w+)/) != -1) {
                  var newblockdurationnumber = 2 * RegExp.$1;
                  var lastblockdurationname = RegExp.$2;
                  if (lastblockdurationname.search(/s\b/) != -1) {
                    var newblockdurationname = lastblockdurationname;
                  } else {
                    var newblockdurationname = lastblockdurationname + "s";
                  }
                  var blockurl = "http://en.wikipedia.org/w/index.php?title=Special:BlockIP/" + wgTitle + "&blockduration=" + newblockdurationnumber + "%20" + newblockdurationname + "&blockreason=vandalism";
                } else {
                  var blockurl = "http://en.wikipedia.org/w/index.php?title=Special:BlockIP/" + wgTitle;
                }
               } else {
                 var blockurl = "http://en.wikipedia.org/w/index.php?title=Special:BlockIP/" + wgTitle + "&blockduration=infinite&blockreason=vandalism-only%20account";
               }
               window.setTimeout(function() { location.href = blockurl; }, 750);
             } else if ((wgUserName != 'KnowledgeOfSelf') || (matchednumber == 3) || (matchednumber2 == 3)) {
               document.editform.wpSummary.value = "Final warning: " + matchedtemplatename + " on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
               document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst\:uw-vandalism4\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
               document.editform.wpSave.click();
               window.setTimeout(function() { window.close(); }, 750);
             } else {
               document.editform.wpSummary.value = "Warning: " + matchedtemplatename + " on \[\[" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\]\]";
               document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst\:uw-" + matchedtemplatename + "3\|" + UrlParameters["vandalizedpage"].replace(/\_/g, ' ') + "\}\} " + usersignature;
               document.editform.wpSave.click();
               window.setTimeout(function() { window.close(); }, 750);
             }
         }
       }
   }
   if (UrlParameters["addtemplate"] > '') {
     document.editform.wpMinoredit.checked=true;
     if (UrlParameters["addtemplate"] == 1) {
       document.editform.wpSummary.value = "You have been temporarily blocked from editing the encyclopedia.";
       document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst\:uw-block1\|time=" + UrlParameters["blockduration"] + "\|reason\=vandalism\|subst\=subst\:\}\}";
     } else if (UrlParameters["addtemplate"] == 2) {
       document.editform.wpSummary.value = "You have been indefinitely blocked from editing the encyclopedia.";
       document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\{\{subst\:uw\-block3|sig=" + usersignature + "\}\}";
     } else if (UrlParameters["addtemplate"] == 3) {
       document.editform.wpSummary.value = "You have been blocked for violation of the \[\[Wikipedia\:Username_policy\|Username policy\]\].";
       document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst:uw-ublock|sig=" + usersignature + "\}\}";
     } else if (UrlParameters["addtemplate"] == 4) {
       document.editform.wpSummary.value = "You have been blocked for violation of the \[\[Wikipedia\:Username_policy\|Username policy\]\].";
       document.forms["editform"].wpTextbox1.value = document.forms["editform"].wpTextbox1.value + "\n\n\{\{subst:uw-uhblock|sig=" + usersignature + "\}\}";
     }
     document.editform.wpSave.click();
     window.setTimeout(function() { window.close(); }, 1000);
   }
 
 if (wgUserName == "DerHexer") {
     if (UrlParameters["title"] == "User:DerHexer/redirects" && UrlParameters["action"] == "edit") {
              if (UrlParameters["number"]) {
                var namespace = new Array ();
                namespace = ["", "Wikipedia ", "Bild ", "MediaWiki ", "Template ", "Help ", "Category ", "Portal "];
                var namespace_number = new Array ();
                namespace_number = [0, 4, 6, 8, 10, 12, 14, 100];
                var number = UrlParameters["number"];
 
                function newRequest()
                {
                  try {
                    if (window.XMLHttpRequest) {
                      return new XMLHttpRequest();
                    } else {
                      return new ActiveXObject("MSXML2.XMLHTTP");
                    }
                  } catch (e) {
                    return false;
                  }
                }
 
                var beginning = UrlParameters["beginning"];
                var req;
                if (req = newRequest()) {
                  var text = "/w/query.php?format=xml&what=allpages&aplimit=100&apnamespace=" + (namespace_number[number] + 1) + "&apfrom=" + beginning + "&apfilterredir=redirects";
                  req.open("GET", text, false);
                  req.send("");
 
                  var redir = req.responseXML.getElementsByTagName("title");
                }
 
                for (i = 0; i < redir.length; i++) {
 
                  var redir2 = "/w/query.php?format=xml&what=allpages&aplimit=1&apnamespace=" + namespace_number[number] + "&apfrom=" + redir[i].childNodes[0].nodeValue.replace(new RegExp(namespace[number] + "Talk:"), "").replace(/ /g, "%20").replace(/&/g, "%26").replace(/\"/g, "%22").replace(/\+/g, "%2B").replace(/\'/g, "%27") + "&apfilterredir=redirects";
 
                  var redir4 = redir[i].childNodes[0].nodeValue.replace(/ /g, "%20").replace(/&/g, "%26").replace(/\"/g, "%22").replace(/\+/g, "%2B").replace(/\'/g, "%27");
 
                  var req;
                  if (req = newRequest()) {
                    req.open("GET", redir2, false);
                    req.send("");
 
                    var redir_compare = req.responseXML.getElementsByTagName("title");
                    var redir_compare_disk = namespace[number] + "Talk:" + redir_compare[0].childNodes[0].nodeValue.replace(new RegExp(namespace[number].replace(/ /, "") + ":"), "");
 
                    if (redir[i].childNodes[0].nodeValue == redir_compare_disk) {
                      var redir3 = "/w/query.php?format=xml&what=backlinks&bllimit=1&titles=" + redir_compare_disk;
 
                      var req;
                      if (req = newRequest()) {
                        req.open("GET", redir3, false);
                        req.send("");
 
                        var linked = req.responseXML.getElementsByTagName("bl");
                        if (linked.length == 0) {
                          window.open("http://en.wikipedia.org/w/index.php?title=" + redir4 + "&redirect=no&action=delete&deletereason=unnecessary%20redirect");
                        }
                      }
                    }
 
                    if (i == redir.length-1) {
                      location.href = "http://en.wikipedia.org/w/index.php?title=User:DerHexer/redirects&action=edit&beginning=" + redir4.replace(new RegExp(namespace[number] + "Talk:"), "") + "&number=" + number + "&pages=" + UrlParameters["pages"];
                      // document.editform.wpPreview.click();
                    }
                  }
                }
              }
    }
 }
 if ((UrlParameters["action"] == "history") && (UrlParameters["selfrevert"] > '')) {
   var reverteduser = document.getElementsByTagName('ul')[0].getElementsByTagName('a')[2].innerHTML;
   if(reverteduser == 'Snowolf') {
     location.href=document.getElementsByTagName('ul')[0].getElementsByTagName('a')[8]+'&bot=1';
   }
 }
 }
 
 
 if ( ((UrlParameters["action"] == "history") && (UrlParameters["selfrevert"] > '')) || (UrlParameters["action"] == "delete") || (UrlParameters["action"] == "rollback") || (UrlParameters["deletereason"] > "") || ( (UrlParameters["blockreason"] > "") && (UrlParameters["blockduration"] > "") )  || ( (UrlParameters["protectreason"] > "") && (UrlParameters["protectduration"] > "") && (UrlParameters["protecttype"] > "") ) || ( ( (UrlParameters["title"] == 'Special:Log') && (UrlParameters["type"] == 'newusers') ) || (location.href.substring(location.href.indexOf("/wiki/")).search(/Special\:Log\/newusers/) != -1) ) || (UrlParameters["title"] == 'Category:All_images_with_the_same_name_on_Wikimedia_Commons') || (UrlParameters["opencommons"] > "") || (UrlParameters["diff"] > "") || ( (UrlParameters["spam"] > "") && (UrlParameters["vandalizedpage"] > "") ) || (UrlParameters["addtemplate"] > '') || (UrlParameters["title"] == "User:DerHexer/redirects" && UrlParameters["action"] == "edit") ) {
   addOnloadHook(fillActionPage);
 }
 
 // <nowiki>
 
 // Funktionen im Quickbar (monobook.js)
 var usedropdown = false;        // Wenn keine Dropdowns gewünscht sind, hier false eintragen!
 var qbnewpage = false;           // sollen Seiten aus dem QuickBar im neuen Fenster aufgerufen werden?
 var timeout = 50000;            // 50 Sekunden auf das Neuladen der Seite warten
 var zeigeversion = false;        // monobook-Version anzeigen?
 var zeigehilfe = true;          // kurze Hilfetexte beim überfahren mit der Maus anzeigen ? default true
 var debugme = false;            // Debug-Modus?
 var usersignature = '\~\~\~\~';         //Standardsignatur
 
 // Modul: admin.js
 
 var delreason = true;             // Löschgründe ergänzen?
 var deletereasons = "G1|\[\[WP:PN%7CPatent nonsense\]\]||G1:Nonsense; G2|Test page||G2:Test; G3|\[\[WP:VAND%7CPure vandalism\]\]||G3:Vandalism; G3|Redirect made as a result of the cleanup of page-move vandalism||G3:Pagemove; G4|Recreation of deleted material||G4:Repost; G5|Page made by a \[\[WP:BANNED%7Cbanned user]]||G5:Banned; G6|Temporary deletion in order to merge page histories||G6:Histmerge; G6|Making way for a non-controversial move||G6:Move; G6|Deleting page per result of AfD discussion||G6:AFD; G6|Non-controversial housekeeping deletion||G6:Housekeeping; G7|Only one editor has made substantial edits to this page and he or she has requested its deletion or blanked the page||G7:Author; G8|Was a talk page whose corresponding page does not exist||G8:Talk; G10|\[\[WP:ATP%7CAttack page\]\]||G10:Attack; G11|\[\[WP:SPAM%7CBlatant advertising\]\]||G11:Spam; G12|\[\[WP:C%7CBlatant copyright infringement\]\]||G12:Copyvio; A1|Very short article providing little or no context||A1:Nocontext; A2|Foreign language article that exists on another Wikimedia project||A2:Foreign; A3|No content whatsoever except possibly links elsewhere, a rephrasing of the title, and/or attempts to correspond||A3:Nocontent; A5|Properly transwikied elsewhere||A5:Transwiki; A7|Biographical article that does not assert the \[\[WP:BIO%7Csignificance\]\] of its subject||A7:Bio; A7|Article about a web site or other online forum that did not assert the \[\[WP:WEB%7Csignificance\]\] of its subject||A7:Web; A7|Article about a company that did not assert the \[\[WP:CORP%7Csignificance\]\] of its subject||A7:Corp; A7|Article about a club or group that does not assert significance||A7:Club; A7|Article about a band that did not assert \[\[WP:MUSIC%7Csignificance\]\]||A7:Band; R1|Redirect to non-existent page||R1:Redirnone; R2|Redirect to User/User talk namespaces from mainspace||R2:Rediruser; R3|Redirect based on an implausible typo||R3:Redirtypo; I1|Redundant to another image||I1:Redundantimage; I2|Image is corrupted||I2:Noimage; I3|Licensed as for non-commercial use only, non-derivative use or used with permission\, uploaded on or after May 19, 2005, and no assertion of fair use was provided||I3:Noncom; I4|Image lacking sources or licensing information for more than seven days||I4:Nosource; I5|was an unfree image that was not used for more than seven days||I5:unfree; I6|No \[\[WP:FURG%7Cjustification\]\] given for fair use for more than seven days||I6:Norat; I7|Bad \[\[WP:FURG%7Cjustification\]\] given for fair use and the uploader was notified more than 48 hours ago||I7:Badrat; I8|Image exists on the Commons||I8:Nowcommons; C1|Category is empty for 4 days or more||C1:Emptycat; C3|Category solely populated from a now-deleted template||C3:catfd; U1|User or user subpage of which the corresponding user requests deletion||U1:Userreq; U2|Userpage of non-existent user||U2:Nouser; U3|Userpage that is primarily a gallery of fair use images||U3:Fugallery; T1|Divisive and inflammatory template||T1:Divisive; P2|Underpopulated portal||P2:Emptyportal";
 
 var blockreason = true;             // Blockgründe ergänzen?
 var blockreasons = "\[\[Wikipedia:Vandalism%7CVandalism\]\]||7||B(v+7h); \[\[Wikipedia:Vandalism%7CVandalism\]\]||24||B(v+24h); vandalism||31||B(v+31h); \[\[Wikipedia:Vandalism%7CVandalism\]\]||3 days||B(v+3d); \[\[Wikipedia:Vandalism%7CVandalism\]\]||1 week||B(v+1w); \[\[Wikipedia:Vandalism%7CVandalism\]\]||1 month||B(v+1m); \[\[Wikipedia:Vandalism%7CVandalism\]\]||3 months||B(v+3m); \[\[Wikipedia:Vandalism%7CVandalism\]\]||6 months||B(v+6m); \[\[Wikipedia:Vandalism%7CVandalism\]\]||1 year||B(v+1a); \[\[Wikipedia:Vandalism%7CVandalism\]\]-only account||infinite||B(voa+i); \{\{uw-ublock\}\}||infinite||B(name+i); \{\{uw-uhblock\}\}||infinite||B(hard+i)";
 
 var protectreason = true;             // Schutzgründe ergänzen?
 var protectreasons = "IP vandalism||1 day||1||P(IP-V+1d); IP vandalism||1 week||1||P(IP-V+1w); IP vandalism||3 months||1||P(IP-V+3m); IP vandalism||infinite||1||P(IP-V+i); edit war||indefinite||2||P(EW+i); \{\{indefblockeduser\}\}||infinite||2||P(indefblock+i); \{\{unblock\}\} abuse||infinite||2||P(unblock+i); protection removed||infinite||0||P(!protection+i)";
 
 var blockedtext = "Zwei Stunden.";             // Standardtext für die VM
 
 // **************** SETUP Ende ***********************************
 
 var user  = wgUserName ; // username wird automatisch übernommen
 
  // page type variables: namespaces
 var isArticle       = (wgNamespaceNumber == 0);
 var isArticleTalk   = (wgNamespaceNumber == 1);
 var isBild          = (wgCanonicalNamespace == "Image");
 var isCategory      = (wgCanonicalNamespace == "Category");
 var isTemplate      = (wgCanonicalNamespace == "Template");
 var isGeneric       = false;
 if ((!isBild) && (!isCategory) && (!isTemplate))
     isGeneric  = true;
 var isProject       = (wgCanonicalNamespace == "Project");
 
 // page type variables: namespace == -1
 var isSpecial  = (wgCanonicalNamespace == "Special");
 var isRestore = (isSpecial && (wgCanonicalSpecialPageName == "Undelete"));
 var isContrib = (isSpecial && (wgCanonicalSpecialPageName == "Contributions"));
 var isWatchlist = (isSpecial && (wgCanonicalSpecialPageName == "Watchlist"));
 
 // page type variables: namespace == -1
 var isTalk = (!isSpecial && isOdd(wgNamespaceNumber));
 
 // page type variables: other stuff
 var isPHP     = (document.URL.indexOf('index.php') > 0);
 var isDiff    = UrlParameters["diff"];
 var isEdit    = ((UrlParameters['action']=='edit') || (UrlParameters['action']=='submit'));
 var isHistory = (UrlParameters['action']=='history');
 
 // Admin functions
 var adminflag = false;
 if (isAdmin()) adminflag = true;
 
  /*
  * ab hier wird der Quickbar (der Kasten oben links) zusammengebaut
  *
  * zuerst die allgemeinen Variablen (hier bitte nix ändern!)
  */
 
 var Quickbar = '<div class="pBody noprint" id="p-quickbar" style="position:absolute; top:5px; z-index:10; width:14em;">';
 var showcompletebar = true;
 var showcompletebar2 = '';
 var xxx      = '';
 
 var trenner='<hr />';
 var br     ='<br />';
 
 var qbtarget = '_self';
 if (qbnewpage) qbtarget = '_blank';
 
 var dropdown = usedropdown;
 var scrpt    = '';
 var scrptn   = 0;
 var indropdown;
 var ind;
 
 /*
  * Quickbar-Zusammenbau, Teil 1:
  *
  * zuerst die Reihenfolge der einzelnen Abschnitte:
  */
 
 function buildQuickbar() {
    addition = new Date(); 
    addition = new Date(addition.getTime() +1000*60*60*24*365);
    if (document.cookie) {
      var cookies = document.cookie;
      cookies = cookies.split(';');
      for (i=0; i<cookies.length; i++) {
        var cookienames = cookies[i].split('=')[0];
        var cookievalues = cookies[i].split('=')[1];
        if (cookienames.search('showcompletebar') != -1) {
          if (cookievalues.search('block') != -1) {
            showcompletebar2 = "block";
          } else {
            showcompletebar2 = "none";
          }
          document.cookie = 'showcompletebar=' + showcompletebar2 + '; path=/; expires=' + addition.toGMTString + ';';
        } else {
          if (showcompletebar) {
            showcompletebar2 = 'block';
          } else {
            showcompletebar2 = 'none';
          }
          document.cookie = 'showcompletebar=' + showcompletebar2 + '; path=/; expires=' + addition + ';';
        }
      }
    }
    // der folgende Abschnitt wird nur bei Admins eingeblendet
    qbAdminTools();
 }
 
 
 /*
  * Quickbar-Zusammenbau, Teil 2:
  *
  * die Belegung der einzelnen Abschnitte
  */
 
  function qbAdminTools() {
   if (wgUserName == "KnowledgeOfSelf") {
    w (0,trenner,'Wikipedia','');
 
    w (1,'/wiki/Wikipedia:Administrators\'_noticeboard','AN','_self','');
    w (1,'/wiki/Wikipedia:Administrators\'_noticeboard/Incidents','ANI','_self','');
    w (1,'/wiki/Wikipedia:Requests for adminship','RFA','_self','');
    w (1,'/wiki/Category:Requests_for_unblock','RFU','_self','');
    w (1,'/wiki/Category:Wikipedians_looking_for_help','HELP','_self','');
    w (1,'/wiki/Category:Candidates_for_speedy_deletion','CSD','_self','');
   }
 
    if (!adminflag) return;
 
      w (0,'<hr /><div id="adminbarlinks">','Adminbar','');
      if (delreason) {
        w (0,'<center>Delete</center>','Löschen','');
        decodeadminreasons(deletereasons);
      }
      if (blockreason) {
        w (0,'<center>Block</center>','Sperren','');
        decodeadminreasons(blockreasons);
      }
      if (protectreason) {
        w (0,'<center>Protect</center>','Schützen','');
        decodeadminreasons(protectreasons);
      }
      w (0,'</div></div>','','');
  }
 
  /*
  * hier wird der Quickbar in die Seite geschrieben
  * (ab hier bitte nichts ändern)
  */
 
 buildQuickbar();
 document.write(Quickbar);
 
 if (typeof(version) == 'undefined') var version = "?";
 if (!isEdit || zeigeversion || isPHP) {
   document.write(
      '<table width="100%"><tr><td align="left" width="15%"><a href="#" onclick="switchbars(\'completebar\');" title="switch quickbar on/off">on/off</a></td><td align="right" valign="top">',
 
    (zeigeversion) ?
      ('<a href="#" onclick="amIuptodate()" title="Versionscheck">' + (adminflag ? 'A/' : '') + version + '</a>&nbsp;&nbsp;')
         : '',
 
      '<a href="/w/index.php?title=Special%3APrefixindex&from=',user,
          '&namespace=2" target="', qbtarget, '" title="Special:Prefixindex">',
          (user.split(' ')[0].length < 10) ? user.split(' ')[0] : 'MyPages',
      '</a>',
 
      '</td></tr></table><div id="completebar" style="display:' + showcompletebar2 + '">');
 }                
 document.write(xxx,'</div>');
 
 if (scrpt > '') {
    document.write('<script> function _doopt (was) { switch (was) {', scrpt, '}}<\/script>');
    scrpt='';
 }
 
 //
 // ab hier functions
 //
 
 function w (was,lurl,linktext,targt,title) {
  if (!title) title=linktext;	
  if (!zeigehilfe) title='';  
  if (!dropdown) {
   switch (was) {
    case 0 : xxx=xxx+lurl;break;
    case 1 : xxx=xxx+'<a href="'+lurl+'" target="'+targt+'" title="'+title+'">'+linktext+'</a>&nbsp; ';break;
    case 2 : xxx=xxx+'<a href="#" onclick="newtext('+ lurl +')" title="'+title+'">'+linktext+'</a>&nbsp; ';break;  	
    case 3 : xxx=xxx+'<a href="#" onclick="insertTagsWrapper('+ lurl +')" title="'+title+'">'+linktext+'</a>&nbsp; ';break;  	   
    case 4 : xxx=xxx+'<a href="#" onclick="'+ lurl +'" title="'+title+'">'+linktext+'</a>&nbsp; ';break;  	   
   }	 	    
  } //if
  else //todo: Hilfe bei Dropdowns. Benutzt die überhaupt jemand????
  {
   var ltext='__________'.substr(1,ind)+linktext;
   switch (was) {
    case 0 : if (lurl==br) {xxx=xxx+'<option>'+linktext+'</option>';ind=2;} 
             else
             if (lurl==trenner) newdropdown(linktext);
             break;             
    case 1 : xxx=xxx+'<option value="1|'+lurl+'">'+ltext+'</option>';break;
    case 2 : xxx=xxx+'<option value="2|'+scrptn+'">'+ltext+'</option>';
             scrpt=scrpt+'case '+scrptn+':newtext('+lurl+');break;';scrptn++;break;    
    case 3 : xxx=xxx+'<option value="3|'+scrptn+'">'+ltext+'</option>';    
             scrpt=scrpt+'case '+scrptn+':insertTagsWrapper('+lurl+');break;';scrptn++;break;                     
    case 4 : xxx=xxx+'<option value="4|'+scrptn+'">'+ltext+'</option>';
             scrpt=scrpt+'case '+scrptn+':'+lurl+';break;';scrptn++;break;    
   } //switch	  	
  } //else	
 } //w
 
 function isEven(myNumber) {
    return (myNumber % 2 == 0);
 }
 function isOdd(myNumber) {
    return (! isEven(myNumber));
 }
 
  function isAdmin() {
   var specialrights = false;
   if (typeof wgUserGroups != 'object') return(specialrights);
   if (typeof wgUserGroups[0] != 'string') return(specialrights); 
   for (i=0;i<wgUserGroups.length;i++) {
       if (wgUserGroups[i] == "sysop") specialrights = true;
   }
   return(specialrights); 
 }
 
 function importJavascriptL(page, lang)
 {
    try {
        /* check the parameters and set defaults */
        if(!page) throw("importJavascriptL: Missing parameter page.");
        if(!lang) lang = wgContentLanguage;
 
        /* create import url */
        var import_url = 'http://' + lang + '.wikipedia.org' + wgScriptPath + '/index.php?title=User:' + page +
           '.js&action=raw&ctype=text/javascript&smaxage=2678400&dontcountme=s';
 
        /* import page */
        var Head = document.getElementsByTagName('head').item(0);
        var Script = document.createElement('script');
        Script.setAttribute('type', 'text/javascript');
        Script.setAttribute('src', import_url);
        Script.setAttribute('charset', 'utf-8');
        Head.appendChild(Script);
 
        return true;
    } catch(e) {
        alert(e.message);
        return false;
    }
 }
 
 function decodeadminreasons(adminreasons) { // DerHexer
   var adminreason = adminreasons.split('; ');
   for (i=0; i < adminreason.length; i++) {
     var adminreasoncount = adminreason[i].split("||");
     switch(adminreasoncount.length) {
       case 1 : w (4,"deleting('" + adminreasoncount[0] + "');","" + adminreasoncount[0] + ""); break;
       case 2 : w (4,"deleting('" + adminreasoncount[0] + "');","" + adminreasoncount[1] + ""); break;
       case 3 : w (4,"blocking('" + adminreasoncount[0] + "', '" + adminreasoncount[1] + "');","" + adminreasoncount[2] + ""); break;
       case 4 : w (4,"protecting('" + adminreasoncount[0] + "', '" + adminreasoncount[1] + "', '" + adminreasoncount[2] + "');","" + adminreasoncount[3] + ""); break;
       case 5 : w (4,"protecting('" + adminreasoncount[0] + "', '" + adminreasoncount[1] + "', '" + adminreasoncount[2] + "', '" + adminreasoncount[3] + "');","" + adminreasoncount[4] + ""); break;
     }
   }
 }
 
 function switchbars(ids)
 {
   addition = new Date(); 
   addition = new Date(addition.getTime() +1000*60*60*24*365);
   var element = document.getElementById(ids);
   if(element.style.display == "none")
   {
     element.style.display = "block";
     document.cookie = 'show' + ids + '=block; path=/; expires=' + addition + ';';
   }
   else
   {
     element.style.display = "none";
     document.cookie = 'show' + ids + '=none; path=/; expires=' + addition + ';';
   }
 }
 
 // ***** FOOT-Block *****
 
 if (adminflag && (delreason || blockreason || protectreason)) 
    importJavascriptL('DerHexer/admin','en'); // [[User:DerHexer/admin.js]]