MediaWiki:Gadget-markadmins.js

Notu:Post publikigo forviŝu la kaŝmemoron de via foliumilo por vidi la ŝanĝojn.

  • Firefox / Safari: Premu majuskligan klavon klakante Reŝarĝi, aŭ premu aŭ Stir-F5Stir-R (⌘-R kun Makintoŝo)
  • Google Chrome: Premu Stir-majuskligklavon-R (⌘-Majuskligklavo-R kun Makintoŝo)
  • Interreta Esplorilo / Edge: Premu Stir klakante Refreŝu, aŭ premu Stir-F5
  • Opera: Premu Stir-F5.
/// User:PerfektesChaos/js/markGroupMembers/eo.js/// 2015-11-18  PerfektesChaos@de.wikipedia/// Forpreno de kelkaj uzantoj pro perdo de la statuso, 2016-01-08, Tlustulimu// Mark users who are members of arbitrary groups// ResourceLoader:  compatible;//                  dependencies: mediawiki.util// Requires: JavaScript 1.5,  MediaWiki 1.23 (mw.hook, jQuery core)/// @license GPL [//www.mediawiki.org/w/COPYING] (+GFDL, LGPL, CC-BY-SA)/// <nowiki>/* global window:false                                                 *//* jshint forin:false,          bitwise:true, curly:true, eqeqeq:true, latedef:true,          laxbreak:true,          nocomma:true, strict:true, undef:true, unused:true           */( function ( mw, $ ) {   "use strict";   var Groups = [ "A", "B" ],       Users =  { "A":   [ "Blahma",                           "Gamliel Fishkin",                           "Kani",                           "KuboF",                           "KuboF Hromoslav",                           "LiMr",                           "LiMrBot",                                                      "Narvalo",                           "Salatonbv",                           "ThomasPusch",                           "Tlustulimu",                           "Yekrats" ],                  "B":   [ "Tlustulimu",                           "ThomasPusch",                           "LiMr"],                  "C":   false,                  "I":   false,                  "O":   false,                  "K":   false,                  "Ar":  false,                  "Ar+": false },       Tips =   { "A":   "Administranto",                  "B":   "Burokrato",                  "C":   "Checkuser",                  "I":   "Foriganto",                  "O":   "Revizianto",                  "K":   "Klerko",                  "Ar":  "Arbitracianto",                  "Ar+": "Rezerva arbitracianto" },       Live   = true,    // true: page is required to exist       Lower  = false,   // true: include links to subpages       Sep    = "/",       Spaces = "Uzant(?:o|ino)",   // + talk NS       Style  = "color:#0645AD;" +                "font-size:small;" +                "font-weight:bold;" +                "margin-left:0.2em;" +                "vertical-align:super;",       Badges, Learnt, Modes, REurl;   /*    * This program is free software; you can redistribute it and/or    * modify it under the terms of the GNU General Public License as    * published by the Free Software Foundation; either version 2 of the    * License, or (at your option) any later version.    *    * This program is distributed in the hope that it will be useful,    * but WITHOUT ANY WARRANTY; without even the implied warranty of    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the    * GNU General Public License for more details.    *    * You should have received a copy of the GNU General Public License    * along with this program;    * if not, write to the Free Software Foundation, Inc.,    * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.    * http://www.gnu.org/copyleft/gpl.html    */   function found( i, dom ) {      // Matching result      // i    -- element count      // dom  -- DOM element <a>      var got = REurl.exec( dom.href ),          badge, k, mode, s, sign, staff, story, suffix, users, $a;      if ( got ) {         staff = got[ 1 ].replace( /_/, " " );         try {            staff = decodeURIComponent( staff );         } catch (e) {            if ( window.console   &&                 typeof window.console.log === "function" ) {               window.console.log( "eo:Gadget-markGroupMembers decode",                                   staff );            }         }   // try decode         got = [ ];         for ( k = 0;  k < Groups.length;  k++ ) {            sign  = Groups[ k ];            users = Users[ sign ];            if ( users  &&  $.inArray( staff, users ) >= 0 ) {               got.push( sign );            }         }   // for k         if ( got.length ) {            sign = got.join();            if ( typeof Badges[ sign ] === "object" ) {               badge = Badges[ sign ];               story = badge.story;               mode  = badge.mode;            } else {               mode = ++Modes;               Badges[ sign ] = { };               for ( k = 0;  k < got.length;  k++ ) {                  s = got[ k ];                  if ( story ) {                     story  = story  + ", ";                     suffix = suffix + Sep + s;                  } else {                     story  = "";                     suffix = "(" + s;                  }               }   // for k               story  = story  + Tips[ s ];               suffix = suffix + ")";               badge  = Badges[ sign ];               badge.learnt = true;               badge.mode   = mode;               badge.story  = story;               badge.suffix = suffix;               Learnt = true;            }            $a = $( dom );            $a.attr( "title",  $a.attr( "title" ) + "\n" + story );            $a.addClass( "markGroupMembers markGroupMembers-" + mode );         }      }   }   // found()   function furnish( $area ) {      // Page content has been updated      // $area  -- jQuery $content      var badge, sign, styles;      Learnt = false;      $area.find( "a[href^=\"/wiki/\"]" ).each( found );      if ( Learnt ) {         styles = "";         for ( sign in Badges ) {            badge = Badges[ sign ];            if ( badge.learnt ) {               badge.learnt = false;               styles = styles +                        ".markGroupMembers-" + badge.mode + ":after {" +                        "content:\"" + badge.suffix + "\";" +                        Style + "}";            }         }   // for sign in Badges         mw.util.addCSS( styles );      }   }   // furnish()   function fire() {      // Initialize gadget      if ( Live ) {         REurl = "/wiki/";      } else {         REurl = "/(?:wiki/|.+[?&]title=)";      }      REurl = REurl + Spaces;      if ( Lower ) {         REurl = REurl + ":([^#?&]+)";      } else {         REurl = REurl + ":([^/#?&]+)";      }      REurl = REurl + "(?:[#?].*)?$";      Badges = { };      Modes  = 0;      REurl  = new RegExp( REurl );      mw.hook( "wikipage.content" ).add( furnish );   }   // fire()   mw.loader.using( [ "mediawiki.util" ],                    fire );}( window.mediaWiki, window.jQuery ) );// Emacs// Local Variables:// coding: utf-8-dos// End:/// EOF </nowiki>   markGroupMembers/eo.js