/// Gadget-importUtility/mod.js
/// 2018-08-24 [email protected]
// Modify (user) page
// ResourceLoader: compatible; dependencies: user, mediawiki.util
// Namespaces: 2
// Documentation: ]
/// Fingerprint: #0#0#
/// @license GPL (+GFDL, LGPL, CC-BY-SA)
/// <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,
Self = "mod",
IUTIL = "importUtility",
SIG = "ext.gadget." + IUTIL,
SIGNATURE = SIG + "." + Self;
if ( typeof mw.libs !== "object" ||
! mw.libs ) {
mw.libs = { };
}
mw.libs.type = IUTIL;
IUTIL = mw.libs;
if ( typeof IUTIL.vsn === "string" ) {
IUTIL.vsn = IUTIL.vsn + " ";
} else {
IUTIL.vsn = "";
}
IUTIL.vsn = IUTIL.vsn + Self.substr( 0, 1 ) + "=" + Version;
//-----------------------------------------------------------------------
if ( typeof IUTIL.mod !== "object" ) {
// Open edit action on user page
// Dependencies: mediawiki.api
IUTIL.mod = { };
IUTIL.mod.fiat = function () {
// Start page adaption
// Precondition:
// resources available
// Uses:
// this
// > .type
// >< mw.libs.WikiSyntaxTextMod
// < .mod.source
// < .mod.wstm
// mw.util.getParamValue()
// mw.loader.load()
// (.mod.finalize)
// Remark: Used as event handler -- 'this' is not IUTIL.mod
// 2014-10-10 [email protected]
var g, shift, slang;
IUTIL.mod.source = mw.util.getParamValue( IUTIL.type );
if ( IUTIL.mod.source ) {
g = /^(+):/.exec( IUTIL.mod.source );
if ( g ) {
slang = g;
}
}
alert(".mod.fiat() "+slang+" * Noch nicht soweit");
slang=(mw.config.get("wgUserName")==="PerfektesChaos"?slang:false);
if ( slang ) {
shift = mw.config.get( "wgContentLanguage" );
if ( typeof mw.libs.WikiSyntaxTextMod !== "object"
|| ! mw.libs.WikiSyntaxTextMod ) {
mw.libs.WikiSyntaxTextMod = { };
}
IUTIL.mod.wstm = mw.libs.WikiSyntaxTextMod;
IUTIL.mod.wstm.config =
{ lang: { accept: slang,
write: { lang: shift,
linklang: slang } },
mod: { hook: IUTIL.mod.finalize,
template: { noop: true } }
};
if ( typeof IUTIL.mod.wstm.api === "object" ) {
IUTIL.mod.wstm.api.run();
} else {
mw.loader.load( "https://en.wikipedia.org/w/index.php"
+ "?title=User:PerfektesChaos"
+ "/js/WikiSyntaxTextMod/r.js"
+ "&bcache=1&maxage=86400"
+ "&action=raw&ctype=text/javascript",
"text/javascript" );
}
}
}; // .mod.fiat()
IUTIL.mod.finalize = function ( adjust ) {
// Postprocess page content
// Precondition:
// adjust -- text content
// Postcondition:
// Returns modified text content
// Uses:
// this
// > .mod.source
// > .type
// .cnf.feature()
// 2014-10-10 [email protected]
var r = adjust;
if ( adjust.indexOf( "{{Importartikel}}" ) < 0 ) {
r = "{{Importartikel}}\n\n" + adjust
+ "\n\n----\n\n]";
} else {
window.alert( IUTIL.type + "\n\n"
+ IUTIL.cnf.feature( "ErrorAlready",
false ) );
}
return r;
}; // .mod.finalize()
IUTIL.mod.fire = function () {
// Initialize page adaption
// Uses:
// >< .start
// mw.loader.using()
// (.mod.fiat)
// 2014-10-10 [email protected]
if ( typeof IUTIL.start === "string" ) {
IUTIL.start = false;
mw.loader.using( ,
this.fiat );
}
}; // .mod.fire()
} // .mod
//-----------------------------------------------------------------------
function fire() {
// Script unit has been loaded
// Uses:
// > SIGNATURE
// > .type
// > Self
// > Version
// mw.loader.getState()
// mw.loader.state()
// mw.hook()
// 2018-08-24 [email protected]
var rls, sign;
if ( mw.loader.getState( SIGNATURE ) !== "ready" ) {
rls = { };
rls = "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.fire );
}
} // fire()
fire();
}( window.mediaWiki, window.jQuery ) );
// Emacs
// Local Variables:
// End:
/// EOF importUtility/mod.js </nowiki>