/// User:PerfektesChaos/js/refNames/prego/d.js
/// 2022-07-28 [email protected]
// <ref name="..."> preferencesGadgetOptions
// ResourceLoader: compatible;
// dependencies: user.options,
// mediawiki.API, mediawiki.storage, mediawiki.util
/// Fingerprint: #0#0#
/// License: CC-by-sa/4.0
// Documentation: ]
/// <nowiki>
/* global window: 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 = -1.0,
Signature = "refNames",
THIS = { doc: false,
opts: { },
sub: "prego" };
THIS.texts = {
// 2022-07-28 [email protected]
"^show": {"en": Signature},
"^suffix": {"en": "– <ref name="">" +
" Show and change ref identifiers",
"de": "– <ref name="">" +
" Anzeige und Änderung von ref-Bezeichnern"},
"^^spaces": {"en": "Space separated list of namespace numbers," +
" or star '*' for all",
"de": "Namensraum-Nummern,"
+ " durch Leerzeichen getrennt, oder" +
" Stern '*' für alle"},
"^^strange": {"en": "Regular expression"
+ " for undesired name patterns",
"de": "Regulärer Ausdruck"
+ " für unerwünschte Muster von name="},
"^^shoot": {"en": "Namespace numbers to launch at preview"
+ " (space separated)",
"de": "Namensraum-Nummern"
+ " zur Auslösung in der Seitenvorschau"
+ " (durch Leerzeichen getrennt)"}
}; // .texts
function fiat() {
// Equip Special:Blankpage page with entry and form
// Uses:
// > THIS.pars
// > THIS.texts
// > THIS.opts
// > Signature
// > THIS.doc
// > THIS.prego.fn
// favourite()
// mw.libs.preferencesGadgetOptions.form()
// 2022-07-01 [email protected]
var opts = ,
dialog, i, s;
for ( i = 0; i < THIS.pars.length; i++ ) {
s = THIS.pars;
opts.push( { signature: s,
type: "text",
show: THIS.texts,
val: THIS.opts } );
} // for i
dialog = { script: Signature,
show: THIS.texts,
suffix: THIS.texts,
opts: opts };
if ( THIS.doc ) {
dialog.support = THIS.doc.server + "Special:MyLanguage/"
+ THIS.doc.support;
}
if ( typeof THIS.prego.fn.form === "function" ) {
THIS.prego.fn.form( dialog );
}
} // fiat()
function fired( above ) {
// Initialize on scout request
// Precondition:
// above -- object, with scout details
// mediawiki.util has been loaded
// Uses:
// > THIS.special
// < THIS.prego.fn
// < THIS.doc
// < THIS.pars
// fiat()
// 2022-07-01 [email protected]
var e, i, s;
if ( typeof above === "object"
&& above &&
typeof above.prego === "object"
&& above.prego &&
typeof above.prego.signature === "string" &&
typeof above.prego.pars === "object"
&& above.prego.pars &&
typeof above.prego.pars.length === "number" ) {
if ( THIS.special.indexOf( "/" + above.prego.signature ) > 0
&&
typeof mw.libs === "object"
&& mw.libs ) {
THIS.prego = { fn: mw.libs };
if ( typeof above.doc === "object"
&& above.doc &&
typeof above.doc.server === "string" &&
typeof above.doc.support === "string" ) {
THIS.doc = above.doc;
}
for ( i = 0; i < above.prego.pars.length; i++ ) {
e = above.prego.pars;
if ( typeof e === "string" ) {
s = e;
if ( typeof above === e ) {
THIS.opts = above;
} else if ( e === "string" ) {
THIS.opts = "";
}
THIS.pars = THIS.pars || ;
THIS.pars.push( e );
}
} // for i
if ( THIS.pars ) {
fiat();
}
}
}
} // fired()
function first() {
// Autorun on loading
// Uses:
// > Signature
// > THIS.sub
// > Version
// < THIS.signature
// < THIS.special
// mw.loader.getState()
// mw.loader.state()
// mw.config.get()
// mw.hook()
// (fired)
// 2022-07-01 [email protected]
var env, rls, s;
THIS.signature = "ext.gadget." + Signature + "." + THIS.sub;
if ( mw.loader.getState( THIS.signature ) !== "ready" ) {
rls = { };
rls = "ready";
mw.loader.state( rls );
s = Signature + "." + THIS.sub;
env = mw.config.get( [ "wgCanonicalSpecialPageName",
"wgTitle" ] );
if ( env.wgCanonicalSpecialPageName === "Blankpage" &&
typeof env.wgTitle === "string" ) {
THIS.special = env.wgTitle;
mw.hook( s ).add( fired );
}
mw.hook( s + ".ready" ).fire( { type: Signature,
sub: THIS.sub,
vsn: Version } );
}
} // first()
first();
}( window.mediaWiki ) );
// Emacs
// Local Variables:
// coding: utf-8-dos
// fill-column: 80
// End:
/// EOF </nowiki> refNames/prego/d.js