User:PerfektesChaos/js/externalLinkProblem/watchlist/d.js

/// User:PerfektesChaos/js/externalLinkProblem/watchlist/d.js /// 2018-08-24 PerfektesChaos@de.wikipedia // Sub-module: Handle watchlist // ResourceLoader: compatible; //                 dependencies: No MW /// Fingerprint: #0#0# /// @license GPL [//www.mediawiki.org/w/COPYING] (+GFDL, LGPL, CC-BY-SA) /// /* global window:false                                                */ /* jshint bitwise:true, curly:true, eqeqeq:true, latedef:true, laxbreak:true, nocomma:true, strict:true, undef:true, unused:true          */

( function ( mw, $ ) {  "use strict";   var Version   =  -2.8,       ELP       =  "externalLinkProblem",       Sub       =  "watchlist",       Supersed  =  "defekterWeblinkBotVorlage",       Msec      =  1000,       $Changes;   if ( typeof mw.libs[ ELP ]  !==  "object"   ||   ! mw.libs[ ELP ] ) {     mw.libs[ ELP ]  =  { };   }   mw.libs[ ELP ].type  =  ELP;   ELP                  =  mw.libs[ ELP ];

/*   * 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 */

if ( typeof ELP[ Sub ] !==  "object" ) { ELP[ Sub ] =  { }; }  ELP[ Sub ].vsn  =  Version;

function facilitated { // Mark sub-module as ready // Uses: //   >  .signature //   >  Sub //   >  .type //   mw.loader.getState //   mw.loader.state //   mw.hook // 2018-08-24 PerfektesChaos@de.wikipedia var rls, signature, sub; if ( typeof ELP.signature ===  "string" ) { sub       =  "/" + Sub; signature =  ELP.signature + sub; if ( mw.loader.getState( signature ) !==  "ready" ) { rls = { }; rls[ signature ] = "ready"; mw.loader.state( rls ); mw.hook( ELP.type + sub + ".ready" ).fire; }     }   }   // facilitated

function fade { // Warn on obsolete predecessors // Precondition: //   DOM ready // Uses: //   >  .type //   >  Supersed //   >  $Changes //   mw.util.getUrl // 2015-11-23 PerfektesChaos@de.wikipedia var hilite =  { "font-weight": "bold" }, s1     =  "Du verwendest das veraltete Skript ", s3     =  String.fromCharCode( 160, 8211 ) + " tausche es bitte bald aus gegen: ", $a     =  $( "" ), $div   =  $( " " ), $span1 =  $( " " ), $span2 =  $( " " ), $span3 =  $( " " ); $a.attr( { href:  mw.util.getUrl( "User:PerfektesChaos/js/" + ELP.type + "#" + Supersed ),                target: "_blank" } ); $a.text( ELP.type ); $a.css( hilite ); $span1.text( s1 ); $span2.text( Supersed ); $span2.css( hilite ); $span3.text( s3 ); $div.attr( { id: ELP.type + "-" + Supersed } ); $div.css( { "background-color": "#FFFFD0",                 "border":           "#808080 2px solid",                  "margin-bottom":    "1em",                  "margin-top":       "1em",                  "padding":          "1em" } ); $div.append( $span1 ); $div.append( $span2 ); $div.append( $span3 ); $div.append( $a ); $Changes.before( $div ); }  // fade

function fading { // Check for obsolete predecessors // Uses: //   >  mw.libs.fliegelflagel //   >  mw.libs.fliegelflagelDefinition //   >< .fliegelflagel //   fade // 2018-08-24 PerfektesChaos@de.wikipedia var scan, signer; if ( typeof ELP.fliegelflagel !==  "boolean" ) { scan    =  "|" + mw.config.get( "wgUserName" ) + "|"; signer  = "|Ahoek" +             // common.js 2016-02-03 flie "|Alexander Sommer" +  // common.js         2014-02 "|Dr.Haus" +           // common.js 2018+ "|ElRaki" +            // common.js         2014-02 //                  "|ExURLBot              // common.js                     "|FataMorgana" +        // common.js 2018+                     "|Germandrummer92" +    // common.js         2015-07 //                   "|Lantus" +             // common.js                     "|Lukas²³" +            // common.js         2014-12                     "|Polarlys" +           // common.js 2016-02-06 //                   "|Ptolusque" +          // common.js   fliegelflagel //                   "|Reaper35" +           // common.js   fliegelflagel                     "|";         ELP.fliegelflagel  =  ( signer.indexOf( scan )  <  0 );         ELP.fliegelflagel  =  ( !          ( typeof mw.libs.fliegelflagel  ===  "undefined"   &&            typeof mw.libs.fliegelflagelDefinition  ===  "undefined" ) );      }      if ( ! ELP.fliegelflagel ) {         fade;      }   }   // fading

function fiat { // Remove bot entries from watchlist page // Precondition: //   DOM ready, all resources available // Uses: //   >  .config.list //   >  .project.service //   >  .project.talk.signing //   >  .config.later //   >  .defekterWeblinkBotVorlage //   >  Supersed //   >  Msec //    < $Changes //   mw.user.options.get //   mw.Title.newFromText //   (fading) // 2015-11-10 PerfektesChaos@de.wikipedia var i, n, sign, staff, user, $el, $li, $list; $Changes =  $( ".mw-changeslist" ); if ( ELP.config.list ) { n =  -1; } else { n =  $Changes.length; }     if ( n === 1 ) { sign  =  ELP.project.talk.signing; staff =  ELP.project.service; $list =  $Changes.find( "li" ); for ( i = $list.length - 1; i >= 0;  i-- ) { $li  =  $list.eq( i ); $el  =  $li.find( ".mw-userlink" ); user =  mw.Title.newFromText( $el.text ); if ( user &&  user.getNameText === staff ) { $el =  $li.children( ".comment" ); if ( $el.text.indexOf( sign ) >=  0 ) { $li.remove; }           }         }   // for i-- if ( ELP.config.later ) { $Changes.show; }     }      if ( typeof ELP[ Supersed ]  ===  "boolean"           &&     ELP[ Supersed ] ) { window.setTimeout( fading, Msec ); }  }   // fiat

function fire { // Remove bot entries from watchlist page // Precondition: //   All resources available // Uses: //   >< .config.list //   >< .config.later //   mw.user.options.get //   mw.util.addCSS //   (fiat) // 2015-11-10 PerfektesChaos@de.wikipedia if ( mw.user.options.get( "watchlisthidebots" ) ) { ELP.config.list =  true; }     if ( typeof ELP.config.list  !==  "boolean" ) { ELP.config.list =  false; }     if ( ELP.config.list   ||           typeof ELP.config.later  !==  "boolean" ) { ELP.config.later =  false; }     if ( ELP.config.later ) { mw.util.addCSS( ".mw-changeslist {display:none}" ); }     $( fiat ); }  // fire

ELP[ Sub ].fire =  function  { // Start possible actions on Special:Watchlist or Recentchanges // Uses: //   >  Sub //   >  .project.trigger //   >  .config //   >  .special //   >  .config.last //   >< .request //   facilitated //   mw.loader.using //   (fire) // Remark: May be used as event handler -- 'this' is not accessed // 2015-11-10 PerfektesChaos@de.wikipedia facilitated; if ( typeof ELP.request ===  "string"   &&           ELP.request === Sub ) { ELP.request =  false; if ( typeof ELP.project ===  "object"   &&              typeof ELP.project.trigger  ===  "object"   &&              ELP.project.trigger[ 0 ] === "talk"   &&              typeof ELP.config  ===  "object"              &&     ELP.config ) { if ( ELP.special === "Watchlist"  ||                 ( typeof ELP.config.last  ===  "boolean" &&    ELP.config.last ) ) { mw.loader.using( [ "mediawiki.Title",                                 "mediawiki.util" ],                                fire ); }        }      }   };   // .watchlist.fire

function first { // Initialize sub-module // Uses: //   >  Sub //   facilitated //   .featuring //   (.watchlist.fire) // 2015-10-22 PerfektesChaos@de.wikipedia facilitated; if ( typeof ELP.featuring ===  "function" ) { ELP.featuring( ELP[ Sub ].fire ); }  }   // first first;  // autorun }( window.mediaWiki, window.jQuery ) );

// Emacs // Local Variables: // coding: utf-8-dos // fill-column: 80 // End:

/// EOF  externalLinkProblem/watchlist/d.js