Currently there may be errors shown on top of a page, because of a missing Wiki update (PHP version and extension DPL3).
Navigation
Topics Register • News • History • How to • Sequences statistics • Template prototypes

MediaWiki:Gadget-Vorlagenmeister.js

From Prime-Wiki
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/**
* Project:  Vorlagen-Meister SCOUT
* Version:  0.5, Date: 2014-07-13 or later (see VERSION)
*/

/*jshint curly:true, eqeqeq:true, latedef:true, laxbreak:true,
         strict:true, trailing:true, undef:true                        */
/*global window:false                                                  */



( function ( mw, $ ) {
   "use strict";
   var VERSION     = "(Scout) 0.5 2014-07-13",
       MW_LIB      = "vorlagenmeister",
       OPTIONS;


   if ( typeof( mw.libs[ MW_LIB ] ) !== "object"   ||
        ! mw.libs[ MW_LIB ] ) {
      mw.libs[ MW_LIB ] = { };
   }
   OPTIONS = mw.libs[ MW_LIB ];



   function fire() {
      // Start possible actions on current page
      // Precondition:
      //    mediawiki.util and configs have been loaded
      // Postcondition:
      //    /core.js will be loaded, if appropriate
      // 2014-07-13 PerfektesChaos@de.wikipedia
      var scan   = "|edit|submit|",
          seek   = mw.util.getParamValue( "action" ),
          server = "//de.wikipedia.beta.wmflabs.org",
          env;
      if ( scan.indexOf( seek ) > 0 ) {
         env = mw.config.get( [ "wgIsProbablyEditable",
                                "wgNamespaceNumber",
                                "wgPageContentModel",
                                "wgServer",
                                "wgTitle" ] );
         if ( env.wgIsProbablyEditable                &&
              env.wgPageContentModel === "wikitext"   &&
              ! ( env.wgNamespaceNumber === 10  &&
                  /\/XML$/.test( env.wgTitle ) ) ) {
            if ( typeof( OPTIONS.vsn ) === "undefined" ) {
               OPTIONS.vsn  =  VERSION;
            }
            if ( env.wgServer !== server ) {
               server = "//de.wikipedia.org";
            }
            mw.loader.load( server
                            + "/w/index.php?title="
                            + "MediaWiki:Gadget-Vorlagenmeister/core.js"
                            + "&maxage=259200"   // 3 d
                            + "&action=raw&ctype=text/javascript" );
         }
      }
   }   // fire()



   if ( typeof( OPTIONS.loader ) !== "boolean" ) {
      OPTIONS.loader = true;
      mw.loader.using( [ "mediawiki.util",
                         "jquery.client",
                         "site",
                         "user",
                         "user.options" ],
                       fire );
   }
}( window.mediaWiki, window.jQuery ) );