MediaWiki:Gadget-importUtility.js

In diesem Artikel geht es um das Thema MediaWiki:Gadget-importUtility.js, das aufgrund seiner vielfältigen Implikationen in unterschiedlichen Bereichen derzeit auf großes Interesse stößt. MediaWiki:Gadget-importUtility.js war Gegenstand von Studien und Forschungen durch Experten verschiedener Disziplinen, die versucht haben, seine Eigenschaften, seine Auswirkungen und seine Relevanz für die Gesellschaft gründlich zu verstehen. Von seinen Anfängen bis zu seiner heutigen Entwicklung hat MediaWiki:Gadget-importUtility.js Debatten und Überlegungen über seinen Einfluss auf Kultur, Wirtschaft, Politik, Technologie, Umwelt und andere grundlegende Aspekte des menschlichen Lebens ausgelöst. Ziel dieses Artikels ist es, eine umfassende und aktuelle Sicht auf MediaWiki:Gadget-importUtility.js zu präsentieren und seine vielen Facetten und seine Bedeutung in der heutigen Welt zu untersuchen.
/// Gadget-importUtility.js
//  Support sysop on importing and exporting pages
/// 2018-08-24 [email protected]
//  ResourceLoader: compatible; dependencies: NONE
//  Namespaces:     -1, 2, 4
//  Documentation:  ]
/// Fingerprint:    #0#0#
/// @license GPL  (+GFDL, LGPL, CC-BY-SA)
// In memoriam Lady Whistler.
/// <nowiki>
/* 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    =  0.901,
       IUTIL      =  "importUtility",
       MaxAge     =  604800,
       SIGNATURE  =  "ext.gadget." + IUTIL;
   if ( ! mw.loader.getState( SIGNATURE ) ) {
      ( function () {
         var rls  =  { };
         rls  =  "loading";
         mw.loader.state( rls );
      }() );
   }
   if ( typeof mw.libs  !==  "object"   ||
        ! mw.libs ) {
      mw.libs  =  { };
   }
   mw.libs.type  =  IUTIL;
   IUTIL                  =  mw.libs;
   if ( typeof IUTIL.vsn  ===  "string" ) {
      IUTIL.vsn  =  "!=" + Version + " " + IUTIL.vsn;
   } else {
      IUTIL.vsn  =  "*=" + Version;
   }
   IUTIL.signature  =  SIGNATURE;



   if ( typeof IUTIL.doc  !==  "string" ) {
      if ( typeof IUTIL.cnf  !==  "object"   ||   ! IUTIL.cnf ) {
         IUTIL.cnf  =  { };
      }
      IUTIL.cnf.dewiki  = { archive:
                            { offer:    ,
                              sectDone: "(erl.)",
                              sectTerm: "(erledigt)",
                              solved:   "{{Erledigt|",
                              stop:     "{{Nicht archivieren"
                                        + "|Zeigen=nein}}"
                            },
                            difflink:
                            { start:   "<init time=\"",
                              suggest: "Antrag"
                            },
                            edit:
                            { delIss: ,
                              shift:    "\\* *'''Ziel:''' *"
                                      + "\\[{{fullurl:"
                                      + "(*)"
                                      + "\\|action=history",
                              sketch:   "Versionsanzahl:",
                              source:   "\\* *'''Fremdlemma:''' *"
                                      + "\\[{{fullurl:"
                                      + "(+):"
                                      + "(+).*"
                                      + "\\|action=history",
                              staff:  "Versionen",
                              swap:   "{{Anfrage auf Upload stellen}}"
                            },
                         // lenient: false,   // permit template request
                            hold:
                            { section:  "(in Arbeit)",
                              stamp:    "/In Arbeit"
                            },
                            listed:
                            { search: "Wikipedia:Importwünsche/"
                                      + "Teilimport"
                            },
                            notify:
                            { sect:     "Dein Importwunsch zu"
                                        + " ]",
                              skeleton: "Wikipedia:Importwünsche/"
                                        + "Benutzernachricht"
                            },
                            quiet:
                            { source: "Wikipedia:Importwünsche/Robinson"
                            },
                            spec:
                            { "sourceTW": "WP:IMP",
                              "sourceIU": "WP:IU"
                            },
                            table:
                            { source:  "Benutzer:Importartikel",
                              support: "Importwünsche/Wartung"
                            },
                            minutes:  60,   // timeoffset
                            section:  "h2",
                            slang:    "de",
                            submitUP: "Importwünsche/Importupload",
                            submitTW: "Importwünsche"
                          };   // 2015-07-05
      IUTIL.doc  =  "[[w:de:Wikipedia:"
                    + "Technik/Skin/Gadgets/importUtility]]";
   }



   function family() {
      // Establish appropriate project configuration
      // Uses:
      //    >  .cnf.(DBname)
      //     < .cnf.project
      //    mw.config.get()
      //    mw.log()
      //    window.alert()
      // 2014-09-28 [email protected]
      var self  =  mw.config.get( "wgDBname" ),
          r;
      if ( typeof IUTIL.cnf  ===  "object" ) {
         IUTIL.cnf.project  =  IUTIL.cnf;
         r                  =  true;
      } else {
         mw.log( {loud:true},  "IUTIL family() " + self,  4 );
         window.alert( "importUtility *FATAL* Unknown wiki: " + self );
         r  =  false;
      }
      return r;
   }   // family()



   function fetch( access ) {
      // Make module available
      // Precondition:
      //    access  -- identifier of module
      // Postcondition:
      //    Returns true, if module already available and ready
      // Uses:
      //    >  .signature
      //    >  MaxAge
      //    >  .type
      //    mw.loader.getState()
      //    mw.config.get()
      //    mw.loader.load()
      // 2015-11-06 [email protected]
      var r          =  false,
          signature  =  IUTIL.signature + "." + access,
          maxage     =  0,
          server     =  "//de.wikipedia.beta.wmflabs.org";
      if ( mw.loader.getState( signature ) ) {
         if ( typeof IUTIL  ===  "object" ) {
            r  =  ( typeof IUTIL.fire  ===  "function" );
         }
      } else {
         if ( mw.config.get( "wgServer" )  !==  server ) {
            server  =  "https://de.wikipedia.org";
            maxage  =  MaxAge;
         }
         mw.loader.load( server + "/w/index.php?title="
                         + "MediaWiki:Gadget-"
                                      + IUTIL.type + "/" + access + ".js"
                         + "&bcache=1&maxage=" + maxage
                         + "&action=raw&ctype=text/javascript",
                         "text/javascript" );
      }
      return r;
   }   // fetch()



   function fire() {
      // Start additional tasks
      // Uses:
      //    >  .start
      //    fetch()
      // 2018-08-24 [email protected]
      var launch  =  fetch( "utl" );
      if ( fetch( IUTIL.start )  &&  launch ) {
         IUTIL.fire();
      }
   }   // fire()



   function first() {
      // Start additional tasks, obey user options
      // Uses:
      //    mw.loader.using()
      //    (fire)
      // 2018-08-24 [email protected]
      mw.loader.using( ,
                       fire );
   }   // first()



   IUTIL.fire  =  function () {
      // Analyze any page loading; try async ressource loading first
      // Uses:
      //    this
      //    document
      //    >  .cnf.project.submitTW
      //    >  .cnf.project.submitUP
      //    >  .cnf.project.table.support
      //    >  .type
      //    >  .signature
      //     < .mode
      //     < .start
      //    mw.config.get()
      //    family()
      //    first()
      //    mw.loader.state()
      // 2018-08-24 [email protected]
      var env  =  mw.config.get( [ "wgAction",
                                   "wgNamespaceNumber" ] ),
          rls  =  { },
          launch, s;
      switch ( env.wgNamespaceNumber ) {
         case -1 :   // Special:
            switch ( mw.config.get( "wgCanonicalSpecialPageName" ) ) {
               case "Import" :
                  this.mode  =  -1;
                  break;
               case "Export" :
                  this.mode  =  -9;
                  break;
               default:
                  this.mode  =  0;
            }   // switch wgCanonicalSpecialPageName
            if ( this.mode  &&  family() ) {
               this.start  =  "spec";
            }
            break;
         case 2 :   // User:
            if ( env.wgAction === "edit" ) {
               s  =  "&" + this.type + "=";
               if ( window.document.URL.indexOf( s )  >  0
                    &&   family() ) {
                  this.mode   =  10;
                  this.start  =  "mod";
               }
            }
            break;
         case 4 :   // Project:
            s  =  "|view|edit|submit|";
            if ( s.indexOf( env.wgAction )  >  0 ) {
               if ( env.wgAction === "edit" ) {
                  launch  =  ( window.document.URL.indexOf( "&section=" )
                               >  0 );
               } else {
                  launch  =  true;
               }
               if ( launch && family() ) {
                  switch ( mw.config.get( "wgTitle" ) ) {
                     case this.cnf.project.submitTW :
                        this.mode   =  1;
                        this.start  =  "proj";
                        break;
                     case this.cnf.project.submitUP :
                        this.mode   =  2;
                        this.start  =  "proj";
                        break;
                     case this.cnf.project.table.support :
                        this.mode   =  3;
                        this.start  =  "table";
                        break;
                  }   // switch wgTitle
               }
            }
            break;
      }   // switch wgNamespaceNumber
      if ( typeof IUTIL.start  ===  "string" ) {
         first();
      }
      rls  =  "ready";
      mw.loader.state( rls );
   };   // .fire()



   if ( typeof IUTIL.loaded  ===  "boolean" ) {
      if ( typeof IUTIL.start  ===  "string"   &&   family() ) {
         first();
      }
   } else {
      IUTIL.loaded  =  true;
      IUTIL.fire();
   }
}( window.mediaWiki, window.jQuery ) );



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

/// EOF   importUtility.js    </nowiki>