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
/// Gadget-importUtility/spec.js
//  Equip special page (Import, Export)
/// 2018-08-24 PerfektesChaos@de.wikipedia
//  ResourceLoader: compatible;
//    dependencies: mediawiki.util
//                  .known.fire()   OBSOLETing
//  Namespaces:     -1
//  Build:          .form, .spec
//  Documentation:  [[w:de:Wikipedia:Technik/Skin/Gadgets/importUtility]]
/// Fingerprint:    #0#0#
/// @license GPL [//www.mediawiki.org/w/COPYING] (+GFDL, LGPL, CC-BY-SA)
/// <nowiki>
/* global window:false, JSON: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 Version    =  0.904,
       Self       =  "spec",
       IUTIL      =  "importUtility",
       SIG        =  "ext.gadget." + IUTIL,
       SIGNATURE  =  SIG + "." + Self,
       feed, fiat, flush;
   if ( typeof mw.libs[ IUTIL ]  !==  "object"   ||
        ! mw.libs[ IUTIL ] ) {
      mw.libs[ IUTIL ]  =  { };
   }
   mw.libs[ IUTIL ].type  =  IUTIL;
   IUTIL                  =  mw.libs[ IUTIL ];
   if ( typeof IUTIL.vsn  ===  "string" ) {
      IUTIL.vsn  =  IUTIL.vsn + " ";
   } else {
      IUTIL.vsn  =  "";
   }
   IUTIL.vsn  =  IUTIL.vsn + Self.substr( 0, 1 ) + "=" + Version;



//-----------------------------------------------------------------------



   if ( typeof IUTIL.form  !==  "object" ) {
      // Utilities for HTML form fields
      // Dependencies: mediawiki.util JSON
      IUTIL.form  =  { };



      IUTIL.form.fetch  =  function ( access ) {
         // Get data based upon most recent sessionStorage, and reset
         // Precondition:
         //    access  -- sessionStorage item
         //               object map   { id: value }
         // Postcondition:
         //    Returns object if present
         //    sessionStorage item has been cleared
         // Uses:
         //    >< window.sessionStorage
         //    JSON.parse()
         // 2014-09-23 PerfektesChaos@de.wikipedia
         var s,
             r  =  false;
         if ( window.sessionStorage ) {
            s  =  window.sessionStorage.getItem( access );
            if ( s ) {
               if ( typeof s  ===  "string" ) {
                  try {
                     r  =  JSON.parse( s );
                  } catch ( e ) {
                  }
               }
               window.sessionStorage.setItem( access, null );
            }
         }
         return r;
      };   // .form.fetch()



      IUTIL.form.fill  =  function ( assign ) {
         // Fill any form based upon object
         // Precondition:
         //    assign  -- object map   { id: value }
         //    document ready
         // Uses:
         //    >  mw.util.$content
         //    jQuery().find()
         //    jQuery().val()
         // 2018-06-20 PerfektesChaos@de.wikipedia
         var s, v, $e;
         for ( s in assign ) {
            $e  =  mw.util.$content.find( "#" + s );
            if ( $e.length ) {
               v  =  assign[ s ];
               switch ( typeof v ) {
                  case "boolean" :
                     $e.prop( "checked", v );
                     break;
                  case "string" :
                     $e.val( v );
                     break;
               }   // switch typeof v
            }
         }   // for s in assign
      };   // .form.fill()



      IUTIL.form.freeze  =  function ( access ) {
         // Disable particular control(s) on any form
         // Precondition:
         //    access  -- ID of control
         // Uses:
         //    >  mw.util.$content
         //    jQuery().find()
         //    jQuery().attr()
         //    jQuery().prop()
         // 2014-09-28 PerfektesChaos@de.wikipedia
         var $e  =  mw.util.$content.find( "#" + access );
         if ( $e.length ) {
            $e.prop( "disabled", true );
         }
      };   // .form.freeze()
   }   // .form



//-----------------------------------------------------------------------



   if ( typeof IUTIL.spec  !==  "object" ) {
      // Equip special page
      IUTIL.spec  =  { };



      feed  =  function () {
         // Perform special Import page open action   // OBSOLETING
         // Precondition:
         //    document is ready
         // Uses:
         //    this
         //    >  mw.util.$content
         //    >  .cnf.swift
         //    >< .mode
         //    jQuery().find()
         //    jQuery().eq()
         //    jQuery().attr()
         //    .form.fetch()
         //    jQuery().attr()
         //    .form.fill()
         //    .form.freeze()
         //    .known.fire()
         // 2018-06-20 PerfektesChaos@de.wikipedia
         var o =  IUTIL.form.fetch( IUTIL.cnf.swift ),   // OBSOLETING
             s, $e;
         if ( ! o ) {
            o  =  { };
         }
         if ( typeof o.interwiki  ===  "string" ) {
            s                   =  "#mw-import-upload-form";
            o.assignKnownUsers  =  false;
         } else {
            s                   =  "#mw-import-interwiki-form";
            IUTIL.mode          =  -2;
            o.assignKnownUsers  =  false;
         }
         $e  =  mw.util.$content.find( s );
         if ( $e.length ) {
            $e.hide();
         }
         IUTIL.form.fill( o );
         if ( typeof o.originator  ===  "string" ) {
            IUTIL.known.fire( o.originator );
         }
      };   // feed()



      fiat  =  function () {
         // Perform special page open action
         // Precondition:
         //    document is ready
         //    ressources are available
         // Uses:
         //    >  .cnf.project.lenient
         //    >  .mode
         //    .form.freeze()
         //    feed()
         //    flush()
         // 2014-10-10 PerfektesChaos@de.wikipedia
         var lenient  =  false;
         if ( typeof IUTIL.cnf.project.lenient  ===  "boolean" ) {
            lenient  =  IUTIL.cnf.project.lenient;
         }
         if ( ! lenient ) {
            IUTIL.form.freeze( "wpExportTemplates" );
            IUTIL.form.freeze( "interwikiTemplates" );
         }
         if ( IUTIL.mode === -1 ) {
            feed();   // OBSOLETING
         } else {
            flush();
         }
      };   // fiat()



      flush  =  function () {
         // Perform special Export page open action
         // Uses:
         // 2012-12-26 PerfektesChaos@de.wikipedia
// Nur die aktuelle Version der Seite exportieren   id=curonly   false
//  textarea   name="pages"   ausfuellen
      };   // flush()



      IUTIL.spec.fire  =  function () {
         // Process page open action and load ressources
         // Uses:
         //    >  Self
         //    >< .start
         //    mw.loader.using()
         //    jQuery().ready()
         //    (fiat)
         // 2018-04-09 PerfektesChaos@de.wikipedia
         if ( typeof IUTIL.start  ===  "string"
              &&     IUTIL.start  ===  Self ) {
            IUTIL.start  =  false;
            mw.loader.using( [ "mediawiki.util" ],
                             function () {  $( fiat );  }
                           );
         }
      };   // .spec.fire()
   }   // .spec



//-----------------------------------------------------------------------



   function fire() {
      // Script unit has been loaded
      // Uses:
      //    >  SIGNATURE
      //    >  .type
      //    >  Self
      //    >  Version
      //    >  .start
      //    >  SIG
      //    mw.loader.getState()
      //    mw.loader.state()
      //    mw.hook()
      //    .utl.fire()
      // 2018-08-24 PerfektesChaos@de.wikipedia
      var rls, sign;
      if ( mw.loader.getState( SIGNATURE )  !==  "ready" ) {
         rls  =  { };
         rls[ SIGNATURE ]  =  "ready";
         mw.loader.state( rls );
         sign  =  IUTIL.type + "." + Self;
         mw.hook( sign + ".ready" ).fire( { type: sign,
                                            vsn:  Version } );
         mw.hook( IUTIL.type + ".utl.ready" ).add( IUTIL[ Self ].fire );
      }
   }   // fire()



   fire();
}( window.mediaWiki, window.jQuery ) );



// Emacs
// Local Variables:
// End:

/// EOF   importUtility/spec.js    </nowiki>