Benutzer:Ulli Purwin/markKatMentors.js

aus Wikipedia, der freien Enzyklopädie
< Benutzer:Ulli Purwin
Dies ist die aktuelle Version dieser Seite, zuletzt bearbeitet am 20. März 2021 um 17:09 Uhr durch imported>Jon (WMF)(2262197) (maintenance: more info ReferenceError: isDiff is not defined).
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
/////////////////////////////////////////////////////////////////////
// Erweiterg. Ulli Purwin: K-MENTOREN ANZEIGEN (markKatMentors.js) //
/////////////////////////////////////////////////////////////////////

 // Skript übernommen von [[Benutzer:Anka Friedrich/markMentors.js]] und erweitert
 //*******************************************************************************
  // <nowiki>

 function markKatMentors() {
   var isDiff;
   // Variables that should be defined in your monobook
   if (typeof(markkatmentors) == 'undefined')
       markkatmentors = true;

   if (!markkatmentors) 
       return; //nichts zu tun, schnell weg hier
 
   if (typeof(markkmsubpages) == 'undefined')
       markkmsubpages = false;
   if (typeof(dontmarkmyself) == 'undefined')
       dontmarkmyself = false;
   if (typeof(isSpecial) == 'undefined')
       isSpecial = (wgCanonicalNamespace == "Special");
   if (typeof(isHistory) == 'undefined')
       isHistory = (wgAction == 'history'); 
   if (typeof(isUserpage) == 'undefined')
       isUserpage = ( (wgCanonicalNamespace == "User") || (wgCanonicalNamespace == "User_talk") );
   if (typeof(isTalk) == 'undefined')
       isTalk = (wgNamespaceNumber %2 == 1); 
   if (typeof(isProject) == 'undefined')
       isProject = (wgCanonicalNamespace == "Project");
   if (typeof(isDatei) == 'undefined')
       isDatei = (wgCanonicalNamespace == "File");
   if (typeof(isHelp) == 'undefined')
       isHelp = (wgCanonicalNamespace == "Help");
   if (typeof(isDiff) == 'undefined' && typeof UrlParameters !== 'undefined')
       isDiff = UrlParameters["diff"];

   if (markkatmentors) {
 // statische Liste (dynamisch: http://purwin.de/WP_MP/neuversion/ex_mentoren.cfm)
 // Stand: 11.10.2012 (109)

 var katmentors=new Array('Mo4jolo', 'Wo_st_01', 'Zacke', 'Pitichinaccio', 'Logograph', 'Der_Wolf_im_Wald', 'Hans_Koberger', 'DerHexer', 'Tilla', 'Nolispanmo', 'Sargoth', 'B%C3%BCcherw%C3%BCrmlein', 'JCS', 'Emes', 'Nikkis', 'Ervaude', 'Reinhard_Kraasch', 'Redlinux', 'Church_of_emacs', 'Minderbinder', 'Leithian', 'Hannes_R%C3%B6st', 'Orci', 'Anton-kurt', 'Ziko', 'Waylon', 'Clemensfranz', 'Ukko', 'Frank_Murmann', 'Hofres', 'Geiserich77', 'Euku', 'Pittimann', 'Factumquintus', 'XenonX3', 'Yellowcard', 'Don-kun', 'Tmv23', 'Magister', 'Anka_Friedrich', 'THWZ', 'Howwi', 'Hukuk%C3%A7u', 'Carschten', 'KaiMartin', 'Juliana', 'AleXXw', 'GiordanoBruno', 'Pb1791', 'MSGrabia', 'Jbo166', 'Zipferlak', 'Philipp_Wetzlar', 'Markus_Schulenburg', 'Lady_Whistler', 'Catfisheye', 'SK_Sturm_Fan', 'Artmax', 'Memorino', 'Powerboy1110', 'SpiegelLeser', 'Grand-Duc', 'Toffel', 'Oceancetaceen', 'Carport', 'Boonekamp', 'Felix_K%C3%B6nig', 'Codc', 'Giftpflanze', 'Drahreg01', 'Krd', 'Niklas_555', 'Reimmichl-212', 'Cartinal', 'Timk70', 'Toter_Alter_Mann', 'Pitlane02', 'Fl%C3%BCgelRad', 'W._Edlmeier', 'Kingofears', 'Gamma127', '-jkb-', 'Aeggy', 'Pfieffer_Latsch', 'Plani', 'Iste_Praetor', 'Ne_discere_cessa!', 'Polarlys', 'Martin1978', 'Nirakka', 'Christian2003', 'Joe-Tomato', 'Hosse', 'Faltenwolf', 'CennoxX', 'Saehrimnir', 'Polemos', 'Itti', 'Hephaion', 'Emma7stern', 'Coyote_III', 'UweRohwedder', 'CherryX', 'Perrak', 'Dr.Heintz', 'Chricho', 'Fish-guts', 'Parzi', 'Berita', 'Jivee_Blau');

       var katmentors_str = '|'+katmentors.join('|')+'|';
 
       if (typeof(markkmtxt) == 'undefined')
           markkmtxt = "M";
   }

   if (isSpecial || isHistory || isUserpage || isTalk || isProject || isDatei || isHelp || isDiff) {
      var i;
      var kmNode;
      var allanchors = document.getElementsByTagName("A");
      var allanchorsuser = new Array();
      var followupmark; 
      var searchExp = /\/wiki\/Benutzer(in)?([ _]Diskussion)?:(.+)/;
      var searchExpTalk = /[ _]Diskussion:/;
      var marker; 
      var mainpageanchor;
      var SGSpecial;

      mw.util.addCSS('span.katmentorMark { font-weight: bold; }');
      for (i=0; i < allanchors.length; i++) {
         kmNode = allanchors[i];
         mainpageanchor = true;

         // if it's a link to a user
         if ((href = kmNode.getAttribute("href")) && (searchExp.exec(href) != null)) {
            currUser = searchExp.exec(href)[3];
            /* if (isUserpage) */ currUserClean = currUser.replace(/\/.*/,'');
             if (currUserClean != currUser) mainpageanchor = false;
             if (searchExpTalk.exec(href) != null) talkpageanchor = true;

             if (mainpageanchor) allanchorsuser[i] = currUserClean;
             else allanchorsuser[i] = "";

             followupmark = false;
             if (i>0)
                   if ((currUserClean == allanchorsuser[i-1]) && talkpageanchor)
                         followupmark = true;

             currUser= "|" + currUserClean + "|";
             marker = new Array();

               // is this user a mentor?
               if (katmentors_str.indexOf(currUser) != -1) marker.push(markkmtxt);

              // don't mark certain pages, except link to user main page
              if (mainpageanchor ||
                 (markkmsubpages && (wgCanonicalSpecialPageName != "Prefixindex")
                                && (wgCanonicalSpecialPageName != "Allpages")) ) {
                 // check finished, now append node
                 if ((marker.length > 0) && !(dontmarkmyself && (currUserClean == wgUserName))) {
                    var kmMark = document.createElement("span");
                    kmMark.className = "katmentorMark";

                    var kmMarkText = document.createTextNode(" (" + marker.join("/") + ")");
                    kmMark.appendChild(kmMarkText);
                    kmNode.appendChild(kmMark);
                 }
              }
            }
         }
      }
   }

 addOnloadHook(markKatMentors);

 // </nowiki>
/////////////////////////////////////////////////////////////////////
////// ENDE erweiterung: K-MENTOREN ANZEIGEN (markKatMentors.js) ////
/////////////////////////////////////////////////////////////////////