„Benutzer:NBarchiv/markKatmentors.js“ – Versionsunterschied

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen
Inhalt gelöscht Inhalt hinzugefügt
NBarchiv (Diskussion | Beiträge)
upd. ; 74.
Entlinkt (Diskussion | Beiträge)
wikibits-Migration auf ausdrücklichen Wunsch, vgl. Special:Diff/165123370
Zeile 7: Zeile 7:
// <nowiki>
// <nowiki>
mw.loader.using('mediawiki.util', function () { $(function () {
function markKatmentors() {
// Variables that should be defined in your monobook
// Variables that should be defined in your monobook
Zeile 35: Zeile 35:
isHelp = (wgCanonicalNamespace == "Help");
isHelp = (wgCanonicalNamespace == "Help");
if (typeof(isDiff) == 'undefined')
if (typeof(isDiff) == 'undefined')
isDiff = UrlParameters["diff"];
isDiff = mw.util.getParamValue('diff') !== null;
if (markkatmentors) {
if (markkatmentors) {
Zeile 61: Zeile 61:
var SGSpecial;
var SGSpecial;
appendCSS('span.katmentorMark { font-weight: bold; }');
mw.util.addCSS('span.katmentorMark { font-weight: bold; }');
for (i=0; i < allanchors.length; i++) {
for (i=0; i < allanchors.length; i++) {
kmNode = allanchors[i];
kmNode = allanchors[i];
Zeile 104: Zeile 104:
}
}
}
}
}
}); });
addOnloadHook(markKatmentors);
// </nowiki>
// </nowiki>

Version vom 3. Mai 2017, 00:50 Uhr

/////////////////////////////////////////////////////////////////////
// Erweiterg. Ulli Purwin: K-MENTOREN ANZEIGEN (markKatMentors.js) //
/////////////////////////////////////////////////////////////////////
 
 // Skript übernommen von [[Benutzer:Anka Friedrich/markMentors.js]] und erweitert
 //*******************************************************************************
  // <nowiki>
 
 mw.loader.using('mediawiki.util', function () { $(function () {
 
   // 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')
       isDiff = mw.util.getParamValue('diff') !== null;
 
   if (markkatmentors) {
 // statische Liste (dynamisch: http://purwin.de/WP_MP/neuversion/ex_mentoren.cfm)
 // Ausgangsstand: 28.12.2012 (111)
 // Aktualisierung auf die letzte Änderung vom 05.03.2017: (74)
 
var katmentors=new Array('Aeggy', 'Albinfo', 'Alraunenstern', 'Altsprachenfreund', 'Anka_Friedrich', 'Anton-kurt', 'Artregor', 'Artmax', 'Austriantraveler', 'Barnos', 'Berita', 'Boonekamp', 'CennoxX', 'Chewbacca2205', 'Chricho', 'Codc', 'CTHOE', 'DCB', 'DerHexer', 'DerMaxdorfer', 'Der_Wolf_im_Wald', 'Doc.Heintz', 'Don-kun', 'Emes', 'Faltenwolf', 'Fish-guts', 'Gamma127', 'Graf_Umarov', 'Grueslayer', 'Gulaschkanone99', 'Hans_Koberger', 'Hephaion', 'HerrSonderbar', 'Hofres', 'Icy2008', 'Innobello', 'Itti', 'JCS', 'Jivee_Blau', 'KaiMartin', 'Kenny_McFly', 'Logograph', 'M._Krafft', 'MAGISTER', 'Manfred_Kuzel', 'Markus_Schulenburg', 'Memorino', 'Mussklprozz', 'Nikkis', 'Nolispanmo', 'Orci', 'Parzi', 'Perrak', 'Plani', 'Polarlys', 'Ptolusque', 'Queryzo', 'Redlinux', 'Reinhard_Kraasch', 'RudolfSimon', 'Schnabeltassentier', 'SDKmac', 'Thomas_Glintzer', 'THWZ', 'Timk70', 'Tkarcher', 'Tkkrd', 'Tmv23', 'Toffel', 'UweRohwedder', 'Werner_von_Basil', 'Wo_st_01', 'Zulu55', 'Zweioeltanks');
        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);
                 }
              }
            }
         }
      }
   }); });
 
 // </nowiki>
/////////////////////////////////////////////////////////////////////
////// ENDE erweiterung: K-MENTOREN ANZEIGEN (markKatMentors.js) ////
/////////////////////////////////////////////////////////////////////