User:PerfektesChaos/js/WikiSyntaxTextMod/d.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. User:PerfektesChaos/js/WikiSyntaxTextMod/d. |
/// PerfektesChaos/js/WikiSyntaxTextMod/d.js
/// 2021-05-21 [email protected]
// ResourceLoader: compatible; dependencies:
// user, user.options, mediawiki.user, mediawiki.util, mediawiki.cookie
/// Fingerprint: #0#0#
/// @license: CC-by-sa/4.0 GPLv3
/// <nowiki>
/* global window:false, mw:true, mediaWiki:false */
/* jshint bitwise:true, curly:true, eqeqeq:true, latedef:true,
laxbreak:true,
nocomma:true, strict:true, undef:true, unused:true */
if ( typeof mediaWiki !== "object" ) { // disconnected
mw = { config: false,
libs: { },
log: function () { "use strict"; },
str: { },
util: { }
};
}
if ( typeof mw.libs.WikiSyntaxTextMod !== "object" ||
! mw.libs.WikiSyntaxTextMod ) {
mw.libs.WikiSyntaxTextMod = { bb: { } };
}
if ( ! mw.libs.WikiSyntaxTextMod.vsn ) {
mw.libs.WikiSyntaxTextMod.vsn = -7.3;
}
// This is the main script of a suite of 13 modules
// External access:
// WikiSyntaxTextMod_About()
// WikiSyntaxTextMod_Run()
if ( typeof mw.libs.WikiSyntaxTextMod.bb !== "object" ) {
mw.libs.WikiSyntaxTextMod.bb = { };
}
// Requires: JavaScript 1.3
// (String.charCodeAt String.fromCharCode String.replace)
// JavaScript 1.5 RegExp non-capturing parenthese
// Requires: MediaWiki 1.23
// (mw.hook,
// 1.18: mw.libs;
// 1.17: mw.config mw.loader mw.util
// jQuery/core jQuery.cookie)
// Uses:
// mediaWiki:: mw::
// > .config
// > .loader
// > .util
// jQuery::
// .cookie()
// .isArray()
// .ready()
// .trigger()
// .trim()
// wikEd::
// > .disabled
// .UpdateFrame()
// .Setup()
// .UpdateTextarea()
mw.libs.WikiSyntaxTextMod.bb.util = function ( WSTM ) {
// From general utility package
// 2012-05-18 [email protected]
"use strict";
if ( typeof WSTM.util !== "object" ) {
WSTM.util = { };
}
WSTM.util.fiatObjects = function ( adult, activate, assign ) {
// Ensure existence of at least empty object
// Precondition:
// adult -- parent object
// activate -- String with name of child object
// assign -- optional object with initial definition
// if containing object components,
// they will be asserted as well
// Postcondition:
// adult has been extended
// Uses:
// .util.fiatObjects() -- recursive
// 2012-05-18 [email protected]
var elt,
obj,
s;
if ( typeof adult[ activate ] !== "object" ) {
adult[activate] = ( assign ? assign : { } );
}
if ( assign ) {
obj = adult[ activate ];
for ( s in assign ) {
if ( assign.hasOwnProperty( s ) ) {
elt = assign[ s ];
if ( typeof elt === "object" ) {
WSTM.util.fiatObjects( obj, s, elt );
}
}
} // for s in obj
}
}; // .util.fiatObjects()
WSTM.util.yymmddhhmmss = function ( align ) {
// Build date and time stamp
// Precondition:
// align -- Date object
// Postcondition:
// Returns string formatted
// Uses:
// .str.fromNum()
// 2012-03-28 [email protected]
var s = ( align.getFullYear() % 100 ) * 10000
+ ( align.getMonth() + 1 ) * 100
+ align.getDate(),
t = align.getHours() * 10000
+ align.getMinutes() * 100
+ align.getSeconds();
return ( WSTM.str.fromNum( s ) + WSTM.str.fromNum( t ) );
}; // .util.yymmddhhmmss()
WSTM.util.fiatObjects( WSTM, "debugging", { loud: false } );
}; // .bb.util()
mw.libs.WikiSyntaxTextMod.bb.util( mw.libs.WikiSyntaxTextMod );
delete mw.libs.WikiSyntaxTextMod.bb.util;
//-----------------------------------------------------------------------
mw.libs.WikiSyntaxTextMod.bb.config = function ( WSTM ) {
// Variables for global usage in WSTM
// 2013-01-07 [email protected]
"use strict";
WSTM.type = "WikiSyntaxTextMod";
WSTM.doc = "[[w:de:User:PerfektesChaos/js/" + WSTM.type + "]]";
if ( typeof WSTM.g !== "object" ) {
WSTM.g = { learnt: false,
mediaWiki : false,
wDBname : undefined,
wNsIds : undefined, // wgNamespaceIds
wNsNumber : undefined,
wPageName : undefined,
wRevID : undefined, // wgCurRevisionId
wServer : undefined,
wTitle : undefined,
wUserLang : undefined, // wgUserLanguage
projLang : undefined, // ~ wgContentLanguage
projLone : undefined, // no language versions
projType : undefined, // ~ wgSiteName downcased
userLang : undefined // ~ wgUserLanguage
};
WSTM.ia = false;
} // multiple loading?
WSTM.g.fetch = function ( assign, access, apply ) {
// Set WSTM global variable by retrieving from mediaWiki context
// Precondition:
// assign -- variable
// undefined for .mediaWiki
// access -- string with name
// false for .mediaWiki
// apply -- string with local name, or false
// Postcondition:
// Returns undefined if no value found
// Uses:
// > window
// > mediaWiki
// < .g.mediaWiki
// < .g.wDBname
// < .g.wNsIds
// < .g.wNsNumber
// < .g.wPageName
// < .g.wRevID
// < .g.wServer
// < .g.wTitle
// < .g.wUserLang
// mw.config.get()
// 2020-02-01 [email protected]
var r, v;
if ( apply ) {
if ( typeof this[ apply ] !== undefined ) {
r = this[ apply ];
}
} else {
r = assign;
} // access
if ( r === undefined ) {
if ( ! this.mediaWiki ) {
if ( typeof window === "object" &&
window &&
typeof window.mediaWiki === "object" ) {
this.mediaWiki = window.mediaWiki;
r = this.mediaWiki;
}
} // this.mediaWiki
if ( this.mediaWiki ) {
if ( access ) {
v = mw.config.get( access );
if ( v !== null && access ) {
switch ( access ) {
case "wgContentLanguage" :
this.wPageLang = v;
break;
case "wgCurRevisionId" :
this.wRevID = v;
break;
case "wgDBname" :
this.wDBname = v;
break;
case "wgNamespaceIds" :
this.wNsIds = v;
break;
case "wgNamespaceNumber" :
this.wNsNumber = v;
break;
case "wgPageName" :
this.wPageName = v;
break;
case "wgServer" :
this.wServer = v;
break;
case "wgTitle" :
this.wTitle = v;
break;
case "wgUserLanguage" :
this.wUserLang = v;
break;
} // switch access
r = v;
} // val
} else {
r = this.mediaWiki;
} // access
} // mediaWiki
} // undefined
return r;
}; // .g.fetch()
// Possible user configuration
// Uses:
// .util.fiatObjects()
// 2012-11-02 [email protected]
WSTM.util.fiatObjects( WSTM, "config",
{ lang: { },
load: { },
page: { } } );
/*
if (typeof(WSTM.config.load) !== "object") {
WSTM.config.load = { after: false,
api: false,
inhibit: false,
updater: false };
}
if (typeof(WSTM.config.page) !== "object") {
WSTM.config.page = { exclude: false,
include: false,
oldid: false,
support: false };
}
*/
if ( typeof WSTM.config.load.after !== "function" ) {
WSTM.config.load.after = false;
}
}; // .bb.config()
mw.libs.WikiSyntaxTextMod.bb.config( mw.libs.WikiSyntaxTextMod );
delete mw.libs.WikiSyntaxTextMod.bb.config;
//-----------------------------------------------------------------------
mw.libs.WikiSyntaxTextMod.bb.str = function ( WSTM ) {
// Copied from string utility package.
// Uses:
// .util.fiatObjects()
// 2013-08-22 [email protected]
"use strict";
WSTM.util.fiatObjects( WSTM, "str", { } );
WSTM.str.fromNum = function ( adjust ) {
/**
Format number as string
@version 2011-10-09 [email protected]
@param adjust number to be formatted
@return adjust as string
*/
return adjust.toString();
}; // .str.fromNum()
}; // .bb.str()
mw.libs.WikiSyntaxTextMod.bb.str( mw.libs.WikiSyntaxTextMod );
delete mw.libs.WikiSyntaxTextMod.bb.str;
//-----------------------------------------------------------------------
mw.libs.WikiSyntaxTextMod.bb.api = function ( WSTM ) {
// API recommended to users
// Uses:
// .util.fiatObjects()
// 2015-03-08 [email protected]
"use strict";
WSTM.util.fiatObjects( WSTM, "api", { loaded: false } );
WSTM.api.isAppropriate = function ( advanced ) {
// Check whether WikisyntaxTextMod is appropriate
// Precondition:
// advanced -- true: interactive request
// Wikiserver environment -- not wgIsArticle
// Postcondition:
// Returns true iff current page is appropriate.
// Uses:
// >< .g.wNsNumber
// >< .g.wTitle
// >< .config.page.oldid
// >< .config.page.exclude
// >< .config.page.include
// >< .config.page.support
// .g.fetch()
// .mw.config.get()
// .main.isEditable()
// .main.isPageMatch()
// mw.util.getParamValue()
// 2016-01-01 [email protected]
var pg = WSTM.config.page,
r = false,
suffixes = ".css.js.lua.uue.",
i,
leeway,
legal,
select;
WSTM.g.fetch( false, "wgNamespaceNumber", "wNsNumber" );
WSTM.g.fetch( false, "wgTitle", "wTitle" );
if ( typeof WSTM.g.wNsNumber === "number" &&
typeof WSTM.g.wTitle === "string" ) {
leeway = false;
legal = ( WSTM.g.wNsNumber === 0 );
if ( WSTM.g.wNsNumber >= 0 &&
WSTM.g.wNsNumber % 2 === 0 &&
WSTM.g.wNsNumber !== 8 ) {
leeway = true;
if ( mw.util.getParamValue( "oldid" ) ) {
if ( typeof pg.oldid !== "boolean" ) {
pg.oldid = false;
}
leeway = pg.oldid;
legal = leeway;
} // not the standard version
if ( WSTM.g.wNsNumber ) {
if ( mw.config.get( "wgPageContentModel" )
=== "wikitext" ) {
i = WSTM.g.wTitle.lastIndexOf( "." );
if ( i > 0 ) {
select = WSTM.g.wTitle.substr( i ).toLowerCase();
if ( suffixes.indexOf( select + "." ) >= 0 ) {
leeway = false;
legal = false;
}
}
} else {
leeway = false;
legal = false;
}
} // maybe user namespace
if ( leeway && ! WSTM.main.isEditable() ) {
leeway = false;
legal = false;
} // restriction
} // no discussion or special page
if ( ! legal && leeway ) { // generally possible
if ( typeof pg.include === "object" ) {
legal = WSTM.main.isPageMatch( pg.include );
} // defined
if ( ! legal && advanced === true ) {
select = typeof pg.support;
if ( select === "object" ) {
legal = WSTM.main.isPageMatch( pg.support );
} else if ( select === "boolean" ) {
legal = pg.support;
}
} // interactive?
} // leeway
if ( legal ) { // bail out?
if ( typeof pg.exclude === "object" ) {
legal = ! WSTM.main.isPageMatch( pg.exclude );
} // defined
}
r = legal;
} else {
mw.log( WSTM.debugging,
".api.isAppropriate() failed g.fetch",
3 );
}
return r;
}; // .api.isAppropriate()
WSTM.api.load = function ( action ) {
// Request loading of outsourced modules
// Precondition:
// action -- user defined external callback function
// true: run automatic
// false: do nothing than updating
// Any Wikimedia project
// Postcondition:
// Loading of all dependencies is initiated
// Remark: May be used as event handler -- 'this' is not accessed
// Uses:
// .prefs.first()
// (.main.further)
// 2015-09-14 [email protected]
WSTM.prefs.first( function () {
WSTM.main.further( action );
} );
}; // .api.load()
WSTM.api.run = function () {
// Launch syntax and user defined replacement manually
// Precondition:
// Wikiserver environment for editpage with "editform"
// Postcondition:
// Returns void(0), as required in GUI action.
// wpTextbox1 value of "editform" is modified, if appropriate.
// Remark: May be used as event handler -- 'this' is not accessed
// Uses:
// >< .config.page.oldid
// .api.isAppropriate()
// .api.load()
// 2012-11-02 [email protected]
if ( typeof WSTM.config.page.oldid !== "boolean" ) {
WSTM.config.page.oldid = true;
}
if ( WSTM.api.isAppropriate( true ) ) { // fool proof
WSTM.api.load( true );
}
return void( 0 );
}; // .api.run()
}; // .bb.api()
mw.libs.WikiSyntaxTextMod.bb.api( mw.libs.WikiSyntaxTextMod );
delete mw.libs.WikiSyntaxTextMod.bb.api;
//-----------------------------------------------------------------------
mw.libs.WikiSyntaxTextMod.bb.errors = function ( WSTM ) {
// Detected syntax error handling
// Uses:
// .util.fiatObjects()
// 2012-10-11 [email protected]
"use strict";
WSTM.util.fiatObjects( WSTM, "errors", { } );
WSTM.errors.swift = "WikiSyntaxTextMod_errors";
WSTM.errors.fault = function () {
// Wrap external function for presenting error list
// Uses:
// .errors.format()
// Remark: Used as event handler -- 'this' is not WSTM.errors
// 2011-12-23 [email protected]
WSTM.errors.format();
}; // .errors.fault()
WSTM.errors.fetch = function () {
// Find error comment in TEXTAREA, and remove if detected
// Postcondition:
// Return true, iff found, and set .errors.story
// Uses:
// < .errors.story
// .main.textarea()
// .errors.frozen()
// (.errors.fault)
// 2012-10-11 [email protected]
var r = false,
s = WSTM.main.textarea( false, false ),
i,
j,
k,
n,
scan,
story;
this.story = false;
if ( typeof s === "string" ) {
scan = this.frozen();
i = s.indexOf( scan );
if ( i >= 0 ) {
n = scan.length;
j = s.indexOf( "-->", i + n );
if ( j >= 0 ) {
story = s.slice( i + n, j );
k = story.indexOf( "\n" );
j += 3;
if ( s.charCodeAt( j ) === 10 ) { // \n
j++;
}
s = ( i > 0 ? s.substr( 0, i ) : "" )
+ s.substr( j );
WSTM.main.textarea( s, true );
r = ( k >= 0 );
if ( r ) {
this.story = story.substr( k );
}
}
} // ErrorMsgID
} else { // Spamschutzfilter
mw.log( WSTM.debugging,
".errors.fetch() Textarea failed",
3 );
}
return r;
}; // .errors.fetch()
WSTM.errors.find = function () {
// Retrieve specific formatted error message from sessionStorage
// Postcondition:
// Return value, iff found, and set .errors.swap
// Uses:
// > sessionStorage
// > .errors.swift
// > .errors.starter
// < .errors.joint
// < .errors.swap
// sessionStorage.getItem()
// sessionStorage.()
// .errors.fixing()
// 2015-03-10 [email protected]
var r = false,
s;
this.swap = false;
if ( typeof window.sessionStorage === "object" ) {
s = window.sessionStorage.getItem( this.swift );
if ( typeof s === "string" &&
s ) {
this.fixing();
this.joint = s.indexOf( this.starter );
if ( this.joint >= 0 ) {
this.swap = s;
r = s;
}
window.sessionStorage.setItem( this.swift, "" );
}
}
return r;
}; // .errors.find()
WSTM.errors.fixing = function () {
// Ensure standardized XML identifier for formatted error message
// Uses:
// >< .g.wRevID
// >< .errors.starter
// .g.fetch()
// 2012-10-12 [email protected]
if ( ! this.starter ) {
WSTM.g.fetch( false, "wgCurRevisionId", "wRevID" );
this.starter = "<WSTM id='" + WSTM.g.wRevID + "'>";
}
}; // .errors.fixing()
WSTM.errors.frozen = function () {
// Retrieve standardized identifier for error message summaries
// Postcondition:
// Return standardized identifier
// 2011-12-23 [email protected]
var s = " ##"; // hide from dumps
return "<!-- " + "WikiSyntaxTextMod" + s + " ERROR in PAGE" + s;
}; // .errors.frozen()
}; // .bb.errors()
mw.libs.WikiSyntaxTextMod.bb.errors( mw.libs.WikiSyntaxTextMod );
delete mw.libs.WikiSyntaxTextMod.bb.errors;
//-----------------------------------------------------------------------
mw.libs.WikiSyntaxTextMod.bb.main = function ( WSTM ) {
// Top level functions (internal)
// 2018-09-14 [email protected]
"use strict";
if ( typeof WSTM.main !== "object" ) {
WSTM.main = { };
}
WSTM.main.bb = false;
WSTM.main.fiat = false;
WSTM.main.scheme = false;
WSTM.main.score = "r";
WSTM.main.self = "User:PerfektesChaos";
WSTM.main.seal = "user:PerfektesChaos/WikiSyntaxTextMod";
WSTM.main.server = "en.wikipedia.org";
WSTM.main.site = "";
WSTM.main.subdir = "WikiSyntaxTextMod";
WSTM.main.swift = "WikiSyntaxTextMod_rvIDs";
WSTM.main.vc = { next: 0,
rv: false };
if ( typeof WSTM.debugging.site === "string" ) {
WSTM.main.site = WSTM.debugging.site;
}
if ( typeof WSTM.vsn === "number" ) {
if ( typeof WSTM.debugging.prefix === "string" ) {
WSTM.main.score = WSTM.debugging.prefix;
} else if ( WSTM.vsn < 0 ) {
WSTM.main.score = "d";
} // no debugging package defined
WSTM.vsn = WSTM.main.site
+ "(" + WSTM.main.score + ")"
+ " Run=" + WSTM.vsn;
} // multiple loading?
if ( typeof WSTM.debugging.subdir === "string" ) {
WSTM.main.subdir = WSTM.debugging.subdir;
}
if ( typeof WSTM.debugging.subs === "string" ) {
WSTM.main.subs = WSTM.debugging.subs;
} else {
WSTM.main.subs = "MWCEIHTXOLUS";
if ( WSTM.main.site === "file:/" ) {
WSTM.main.subs = WSTM.main.subs + "Z";
}
}
WSTM.main.actionSubmit = function () {
// Perform action=submit mode: Possible error msg to be displayed
// Precondition:
// Interactive mode (web form) with wgAction==submit
// Remark: Used as event handler -- 'this' is not WSTM.main
// Uses:
// .errors.fetch()
// .errors.find()
// .api.load()
// (.errors.fault)
// Requires: JavaScript 1.3 charCodeAt()
// 2012-01-16 [email protected]
var load = false;
if ( WSTM.errors.fetch() ) {
load = true;
} else if ( WSTM.errors.find() ) {
load = true;
}
if ( load ) {
WSTM.api.load( WSTM.errors.fault );
}
}; // .main.actionSubmit()
WSTM.main.features = function ( arrange, alter ) {
// Handle external scripts, e.g. WikEd
// Precondition:
// arrange -- undefined: before load
// true: initialize, no decoration
// false: update
// alter -- if arrange: show pretty change, not only diffpage
// Remark: Used as event handler -- 'this' is not WSTM.main
// Uses:
// >< .ia
// (.main.features)
// > window
// > editToolStrIns::
// >< .off
// .update()
// > wikEd::
// > .disabled
// >< .turnedOn
// >< .useWikEd
// .Setup()
// .UpdateFrame()
// .UpdateTextarea()
// .util.fiatObjects()
// Notes:
// editToolStrIns:
// ...
// WikEd -- six cases:
// 1. First beginning, then major change
// -> WSTM, Diff
// true, false
// 2. First beginning, then minor changes
// -> WSTM, Setup
// true, true
// 3. First beginning, no changes
// -> WSTM, Setup
// true, true
// 4. Later started, then major change
// -> Setup?, UpdateTextarea, WSTM, Diff
// false, false
// 5. Later started, then minor changes
// -> Setup?, UpdateTextarea, WSTM, UpdateFrame
// false, true
// 6. Later started, no changes
// -> Setup?, UpdateTextarea, WSTM
// false, false
// 2020-02-25 [email protected]
var IAEXT,
wE;
if ( typeof window === "object" ) { // online interactive
WSTM.util.fiatObjects( WSTM, "ia",
{ ext: false,
$editform: false,
$textarea: false } );
if ( typeof arrange !== "boolean" ) { // before load
WSTM.util.fiatObjects( WSTM.ia, "ext", { } );
IAEXT = WSTM.ia.ext;
if ( typeof mw.libs.editToolStrIns === "object" ) {
IAEXT.editToolStrIns = false;
}
if ( typeof window.wikEd === "object"
&& window.wikEd
&& window.wikEd.UpdateTextarea
&& ! IAEXT.wikEd ) {
wE = window.wikEd;
IAEXT.wikEd = { skipWSTM: true,
setupWSTM: false,
beginWSTM: false,
disabled: wE.disabled,
highlightSyntax: wE.highlightSyntax,
turnedOn: wE.turnedOn,
useWikEd: wE.useWikEd };
if ( window.document
.getElementsByName( "wikEdStartupFlag" )[ 0 ] ) {
if ( wE.origVersion === wE.lastVersion ) {
IAEXT.wikEd.beginWSTM = true;
wE.highlightSyntax = false;
wE.disabled = true;
}
} else if ( typeof wE.Setup === "function"
&& ! wE.disabled
&& wE.turnedOn
&& wE.useWikEd) {
try {
wE.RemoveEventListener( window,
"load",
wE.Setup,
false );
} catch ( e1 ) {
}
try {
wE.RemoveEventListener( window.document,
"DOMContentLoaded",
wE.Setup,
false );
} catch ( e2 ) {
}
}
} // wikEd
} else if ( WSTM.ia.ext ) { // after load, any
IAEXT = WSTM.ia.ext;
if ( IAEXT.wikEd ) {
wE = window.wikEd;
if ( arrange ) {
if ( IAEXT.wikEd.beginWSTM ) {
if ( typeof IAEXT.wikEd.disabled === "boolean" ) {
IAEXT.wikEd.setupWSTM = true;
}
}
if ( ! IAEXT.wikEd.setupWSTM &&
! IAEXT.wikEd.beginWSTM ) {
// asynchronous overrun
if ( IAEXT.wikEd.flag ) {
IAEXT.wikEd.flag.removeAttribute( "name" );
IAEXT.wikEd.flag = false;
}
if ( typeof wE.Setup === "function" ) {
wE.Setup();
}
IAEXT.wikEd.disabled = wE.disabled;
wE.disabled = false;
IAEXT.wikEd.setupWSTM = true;
}
}
if ( ! IAEXT.wikEd.beginWSTM
&& ! wE.disabled
&& wE.turnedOn
&& wE.useWikEd ) {
if ( arrange ) {
wE.UpdateTextarea( null );
wE.config.onHook.push( WSTM.main.features );
} else {
if ( alter ) {
wE.highlightSyntax =
IAEXT.wikEd.highlightSyntax;
wE.useWikEd = IAEXT.wikEd.useWikEd;
if ( wE.useWikEd ) {
wE.UpdateFrame( null );
}
} else {
wE.disabled = true;
wE.useWikEd = false;
}
}
IAEXT.wikEd.beginWSTM = false;
}
} // "wikEd"
}
} // window
}; // .main.features()
WSTM.main.fire = function () {
// Execute appropriate major entry function by interactive call
// Precondition:
// Loading of outsourced modules complete
// Postcondition:
// .main.full() aut idem started
// Remark: May be used as event handler -- 'this' is not accessed
// Uses:
// > .g.wNsNumber
// > (.main.full)
// >< .main.fiat
// < .api.loaded
// .main.ready()
// .main.features()
// .prefs.first()
// jQuery().ready()
// (.main.fiat)
// 2015-09-19 [email protected]
var fun;
WSTM.main.ready( true );
WSTM.api.loaded = true;
if ( WSTM.g.wNsNumber === -1 ) {
WSTM.prefs.form();
} else if ( WSTM.main.fiat ) {
if ( typeof WSTM.main.fiat === "function" ) {
fun = WSTM.main.fiat;
} else {
fun = WSTM.main.full;
}
WSTM.main.fiat = false;
WSTM.main.features();
window.jQuery( function () {
WSTM.main.features();
if ( fun === WSTM.main.full ) {
WSTM.prefs.first( WSTM.main.full );
} else {
fun();
}
} );
}
}; // .main.fire()
WSTM.main.focus = function () {
// Focus interest on message region
// Postcondition:
// Return jQuery object to insert before into page, or false
// Uses:
// mw.util.addCSS()
// jQuery()
// 2021-05-21 [email protected]
var $r = false,
$e;
if ( typeof window === "object" ) { // online
if ( typeof mw.util === "object" ) {
mw.util.addCSS( ".cn-fundraiser-banner,"
+ "#mw-js-message,"
+ "#siteNotice,"
+ "#fundraising\n"
+ "{display: none;}" );
}
if ( typeof window.jQuery === "function" ) { // WMF context
if ( window.jQuery( ".mw-body-content" ).length ) {
$e = window.jQuery( ".mw-body-content" ).eq( 0 );
} else if ( window.jQuery( "#article" ).length ) {
$e = window.jQuery( "#article" );
} else {
$e = window.jQuery( "#content" );
}
if ( $e.length ) {
$r = $e;
}
}
} // window
return $r;
}; // .main.focus()
WSTM.main.follow = function () {
// Test for portlet equipping
// Precondition:
// preferencesGadgetOptions enabled
// Remark: Used as event handler -- 'this' is not WSTM.main
// Uses:
// > .config.portlet
// .prefs.fetch()
// jQuery().ready()
// (.main.force)
// 2012-10-12 [email protected]
WSTM.prefs.fetch();
if ( WSTM.config.portlet ) {
window.jQuery( WSTM.main.force );
}
}; // .main.follow()
WSTM.main.force = function () {
// Decorate skin with portlet link to Run()
// Precondition:
// Decoration is suitable and desired.
// Remark: Used as event handler -- 'this' is not WSTM.main
// Uses:
// > .vsn
// > .type
// > .config.portlet
// < .main.$portlet
// jQuery::
// .trim()
// ().get()
// ().find()
// ().click()
// mw::
// .config.get()
// .util.addPortletLink()
// 2015-02-24 [email protected]
var say = "Start WikiSyntaxTextMod * Version: " + WSTM.vsn,
scope = false,
select = "ca-WSTM-run",
show = WSTM.type,
stick = false,
swift = null,
s,
$li;
if ( typeof WSTM.config.portlet === "object" ) {
s = WSTM.config.portlet.scope;
if ( typeof s === "string" ) {
s = window.jQuery.trim( s );
if ( s.charCodeAt( 0 ) === 35 ) { // '#'
s = s.substr( 1 );
}
if ( s.length ) {
scope = s;
}
}
s = WSTM.config.portlet.show;
if ( typeof s === "string" ) {
s = window.jQuery.trim( s );
if ( s.length ) {
show = s;
}
}
s = WSTM.config.portlet.stick;
if ( typeof s === "string" ) {
s = window.jQuery.trim( s );
if ( s.length ) {
stick = s;
}
}
s = WSTM.config.portlet.swift;
if ( typeof s === "string" ) {
s = window.jQuery.trim( s );
if ( s.length ) {
swift = s;
}
}
} else {
WSTM.config.portlet = { };
}
if ( ! scope ) {
if ( mw.config.get( "skin" ) === "vector" ) {
scope = "p-cactions";
}
}
if ( scope === "p-cactions" ) {
$li = window.jQuery( window.document )
.find( "#p-cactions .menu li" );
if ( $li.length ) {
stick = $li.get( 0 );
} else {
stick = "#-";
}
} else if ( ! scope ) {
scope = "p-tb";
}
if ( ! stick ) {
if ( scope === "p-tb" ) {
stick = "#t-whatlinkshere";
}
}
if ( typeof WSTM.main.$portlet === "object" ) {
WSTM.main.$portlet.remove();
}
WSTM.main.$portlet = mw.util.addPortletLink( scope,
"#",
show,
select,
say,
swift,
stick );
WSTM.main.$portlet = window.jQuery( WSTM.main.$portlet );
WSTM.main.$portlet.click( function () { WSTM.api.load( true );
} );
}; // .main.force()
WSTM.main.further = function ( action ) {
// Perform loading of outsourced modules
// Precondition:
// action -- user defined external callback function
// true: run automatic
// false: do nothing than updating
// preferencesGadgetOptions enabled
// Any Wikimedia project
// Postcondition:
// Loading of all dependencies is initiated
// Remark: May be used as event handler -- 'this' is not accessed
// Uses:
// > .api.loaded
// > .main.subs
// > .debugging
// > .debugging.feeder
// > .debugging.loud
// > .main.score
// > .main.server
// > .main.site
// > .main.self
// > .main.subdir
// > .g.wNsNumber
// >< .main.vsn
// < .main.fiat
// < .main.sister
// .util.yymmddhhmmss()
// .prefs.first()
// WSTM.main.load()
// .main.vc.update()
// (.main.fire)
// Requires: JavaScript 1.3 charCodeAt()
// 2018-09-14 [email protected]
var lazy = ( action !== false && ! WSTM.api.loaded ),
local = false,
b,
i,
k,
n,
s,
saver,
script,
sign,
stamp,
use;
if ( ! WSTM.api.loaded &&
typeof WSTM.debugging === "object" ) {
if ( typeof WSTM.debugging.feeder === "function" ) {
if ( action ) {
local = WSTM.debugging.feeder( WSTM.main.subs );
} else {
local = true;
}
} else if ( WSTM.debugging.loud ) {
lazy = false;
}
}
if ( action ) {
b = typeof action;
if ( b === "function" || b === "boolean" ) {
WSTM.main.fiat = action;
if ( action === true ) {
WSTM.prefs.first();
}
} // action
} // action
if ( WSTM.api.loaded && action ) {
WSTM.prefs.first( WSTM.main.fire );
} else if ( ! local) {
k = ( WSTM.main.site === "test" ? 9 : 7 );
saver = false;
stamp = WSTM.util.yymmddhhmmss( new Date() );
WSTM.vsn = WSTM.vsn + "*";
n = ( action ? WSTM.main.subs.length : 0 );
script = WSTM.main.self + "/js/"
+ WSTM.main.subdir + "/" + WSTM.main.score;
stamp = stamp.substr( 0, k );
if ( n > 0 ) {
use = [ ];
for ( i = 0; i < n; i++ ) {
s = WSTM.main.subs.substr( i, 1 );
saver = WSTM.main.vc.get( s );
if ( ! saver ) {
saver = stamp;
}
sign = WSTM.main.seal + "/" + s;
WSTM.main.load( sign,
WSTM.main.server,
script + s + ".js",
saver );
use.push( sign );
} // for i
}
if ( action || WSTM.g.wNsNumber === -1 ) {
WSTM.prefs.first( WSTM.main.fire, use );
} // already loaded, continue right now
WSTM.main.vc.update();
}
}; // .main.further()
WSTM.main.isEditable = function () {
// Is the current user permitted to edit this page?
// Postcondition:
// Return true iff no restriction detected
// Uses:
// mw.config.get()
// 2015-10-24 [email protected]
var env = mw.config.get( [ "wgRestrictionEdit",
"wgUserGroups" ] ),
dont = env.wgRestrictionEdit,
r = true,
groups,
i,
j,
m,
n,
ng,
p,
trsl;
if ( dont && typeof dont === "object" ) {
n = dont.length;
if ( n ) {
groups = env.wgUserGroups;
r = false;
if ( groups ) {
ng = groups.length;
if ( ng ) {
trsl = { autoconfirmed: "autoconfirmed",
editeditorprotected: "editor",
sysop: "sysop" };
m = n;
for ( i = 0; i < n; i++ ) {
p = trsl[ dont[i] ];
if ( p ) {
for ( j = 0; j < ng; j++ ) {
if ( p === groups[ j ] ) {
m--;
break; // for j
}
} // for j
} else { // may contain "" or null
m--;
}
} // for i
r = ( m === 0 );
}
}
}
}
return r;
}; // .main.isEditable
WSTM.main.isPageMatch = function ( accomplish ) {
// Does current page accomplish?
// Precondition:
// accomplish -- array of rules
// Each rule is a string interpreted as RegExp
// Generally any matching of article / page name
// If starting with ':', it is full qualified
// Full qualified starts with ":DB:"
// DB is a project name like
// "enwiki", "commonswiki", "svwikisource"
// Postcondition:
// Returns true
// iff current page is matched by any rule in accomplish
// Uses:
// >< .g.wDBname
// >< .g.wPageName
// .g.fetch()
// jQuery.isArray()
// Requires: JavaScript 1.3 charCodeAt()
// 2012-11-11 [email protected]
var f = false,
e,
i,
k,
n,
r;
if ( window.jQuery.isArray( accomplish ) ) {
WSTM.g.fetch( false, "wgDBname", "wDBname" );
WSTM.g.fetch( false, "wgPageName", "wPageName" );
if ( WSTM.g.wDBname !== null &&
WSTM.g.wPageName !== null ) {
n = accomplish.length;
for ( i = 0; i < n; i++ ) {
e = accomplish[i];
if ( typeof e === "string" ) {
if ( e.charCodeAt( 0 ) === 58 ) { // ':'
k = WSTM.g.wDBname.length;
if ( e.charCodeAt( k+1 ) !== 58 ) { // ':'
k = false;
} else if ( e.substr( 1, k )
!== WSTM.g.wDBname ) {
k = false;
} else {
e = "^" + e.substr( k + 2 );
}
if ( ! k ) {
k = e.substr( 1 ).indexOf( ":" );
r = "^" + e.substr( 1, k ) + "$";
r = new RegExp( r, "i" );
if ( r.test( WSTM.g.wDBname ) ) {
e = "^" + e.substr( k + 2 );
} else {
e = false;
}
}
} // full qualified
if ( e ) {
r = new RegExp( e, "i" );
f = r.test( WSTM.g.wPageName );
if ( f ) {
break; // for i
} // match
} // wgDBname match
} // string
} // for i
} // crash-safe global
} // isArray
return f;
}; // .main.isPageMatch()
WSTM.main.load = function ( assigned, at, access, age, after ) {
// Load external script
// Precondition:
// assigned -- signature
// at -- domain
// access -- page name (encoded)
// age -- maxage, or not
// after -- cache appendix, or not
// Uses:
// mw.loader.getState()
// mw.loader.state()
// 2018-09-10 [email protected]
var rls, s;
if ( ! mw.loader.getState( assigned ) ) {
rls = { };
rls[ assigned ] = "loading";
mw.loader.state( rls );
s = "https://" + at + "/w/index.php?title=" + access
+ "&action=raw&ctype=text/javascript";
if ( age ) {
s = s + "&bcache=1&maxage=" + age;
}
if ( after ) {
s = s + "&" + after + "*";
}
mw.loader.load( s );
}
}; // WSTM.main.load()
WSTM.main.ready = function ( all ) {
// Declare ResourceLoader state, trigger loadWikiScript event
// Precondition:
// all -- false: head module only
// true: including any sub-module
// Uses:
// > .main.seal
// < .api.loaded
// mw.loader.getState()
// mw.loader.state()
// mw.hook()
// jQuery().trigger()
// 2018-09-03 [email protected]
var sign = this.seal + ( all ? "/*" : "" ),
rls;
if ( all ) {
WSTM.api.loaded = true;
}
if ( mw.loader.getState( sign ) !== "ready" ) {
rls = { };
rls[ sign ] = "ready";
mw.loader.state( rls );
}
if ( typeof mw.hook !== "undefined" ) {
mw.hook( "WikiSyntaxTextMod.ready" ).fire();
if ( all ) {
mw.hook( "WikiSyntaxTextMod/*.ready" ).fire();
}
}
if ( typeof window.jQuery === "function" ) { // WMF context
window.jQuery( window.document ).trigger( "loadWikiScript",
[ sign ] );
}
}; // .main.ready()
WSTM.main.textarea = function ( alter, advance ) {
// Retrieve or replace wikitext using edit area
// Precondition:
// Interactive mode (web form)
// alter -- false or undefined: Retrieve wikitext
// string: Modified wikitext to be stored
// advance -- true: no formatting required,
// quick update; diffpage will be shown next
// Postcondition:
// Return string: wpTextbox1 content if ! alter
// false: if alter
// if ! alter: editform unavailable
// or area not modifiable
// Uses:
// > .ia
// >< .ia.$editform
// >< .ia.$textarea
// .main.features()
// jQuery()
// "editform"
// >< .wpTextbox1
// 2012-02-14 [email protected]
var r = false,
$box,
$form;
if ( WSTM.ia ) { // online interactive and initialized
if ( ! WSTM.ia.$editform ) {
$form = window.jQuery( "#editform" );
if ( $form.length ) { // editing
$box = window.jQuery( "#wpTextbox1" );
if ( $box.length ) { // textarea
if ( ! $box.attr( "readonly" ) ) { // modifiable
WSTM.ia.$editform = $form;
WSTM.ia.$textarea = $box;
} // modifiable
} // textarea
} // editing
} // ! $editform
if ( WSTM.ia.$textarea ) {
this.features( true );
if ( typeof alter === "string" ) { // replace
WSTM.ia.$textarea.val( alter );
this.features( false, ! advance );
} else { // retrieve
r = WSTM.ia.$textarea.val();
} // mode
} // $textarea
} // online
return r;
}; // .main.textarea()
WSTM.main.wait = function ( aware, aged ) {
// Wait for loading of outsourced modules
// Precondition:
// aware -- letter of module finished loading: "L", "U", ...
// aged -- version number of module
// Loading of _L and _U and ... in progress
// preferencesGadgetOptions ready
// Postcondition:
// .main.full() aut idem started, when all ready
// else wait (do nothing)
// Uses:
// > .main.subs
// > .main.$portlet
// > .type
// > .g.wNsNumber
// > .api.loaded
// >< .main.bb
// >< .vsn
// jQuery().find()
// jQuery().attr()
// .main.fire()
// 2015-02-24 [email protected]
var launch = true,
n = this.subs.length,
e,
i,
s;
if ( ! this.bb ) {
this.bb = { };
}
for ( i = 0; i < n; i++ ) {
s = this.subs.substr( i, 1 );
if ( ! this.bb[ s ] ) {
this.bb[ s ] = { load: false,
vsn: 0 };
}
} // for i
for ( i = 0; i < n; i++ ) {
s = this.subs.substr( i, 1 );
e = this.bb[ s ];
if ( s === aware ) {
if ( ! e.load ) {
e.vsn = aged;
e.load = true;
WSTM.vsn = WSTM.vsn + ", " + aware + "=" + aged;
} // still working
} else if ( ! e.load ) {
launch = false;
} // missing
} // for i
if ( typeof this.$portlet === "object" ) {
s = "Start WikiSyntaxTextMod * Version: " + WSTM.vsn;
this.$portlet.find( "a" ).attr( "title", s );
}
if ( launch && ! WSTM.api.loaded ) {
this.fire();
}
}; // .main.wait()
WSTM.main.vc.format = function ( about, assign ) {
// Format revision ID of outsourced module for cookie
// Precondition:
// about -- module type (single letter)
// assign -- revision ID (number or RE string)
// Postcondition:
// Returns string to be appended
// Uses:
// > .main.score
// > .main.site
// 2012-01-14 [email protected]
var r = this.score + about + "_" + assign + "~";
if ( this.site.length ) {
r = this.site + "-" + r;
}
return r;
}; // .main.vc.format()
WSTM.main.vc.get = function ( about ) {
// Query revision IDs of outsourced modules
// Precondition:
// about -- module type (single letter)
// Postcondition:
// Returns false if unknown
// string with revision ID
// Uses:
// > localStorage
// > .main.swift
// > .main.score
// >< .main.vc.rv
// < .main.vc.next
// localStorage.getItem()
// mw.cookie.set()
// 2018-09-10 [email protected]
var i, r, rv, s, store;
if ( this.rv ) {
r = this.rv[ about ];
} else {
this.rv = { };
r = false;
if ( typeof window.localStorage === "object" ) {
try {
store = window.localStorage.getItem( WSTM.main.swift );
} catch ( err ) {
}
} else {
store = window.mw.cookie.get( WSTM.main.swift );
}
if ( store ) {
rv = store.split( "~" );
if ( rv[ 0 ] ) {
this.next = parseInt( rv[ 0 ], 10 );
if ( ! isNaN( this.next ) && this.next > 0 ) {
for ( i = 1; i < rv.length; i++ ) {
s = rv[ i ];
if ( s.substr( 0, 1 ) === WSTM.main.score ) {
this.rv[ s.substr( 1, 1 ) ] =
parseInt( s.substr( 3 ), 10 );
}
} // for i
r = this.rv[ about ];
}
}
}
}
return r;
}; // .main.vc.get()
WSTM.main.vc.put = function ( arrived ) {
// Put revision ID of outsourced module into cookie
// Precondition:
// arrived -- versionControl data
// Postcondition:
// Uses:
// > localStorage
// > .main.subdir
// localStorage.setItem()
// mw.cookie.set()
// 2018-09-10 [email protected]
var date,
e,
i,
k,
rv,
store,
sub;
if ( typeof arrived === "object"
&& arrived &&
typeof arrived.revisions === "object"
&& arrived.revisions &&
typeof arrived.revisions.length === "number" ) {
date = new Date();
store = date.valueOf() + "~";
sub = "js/" + WSTM.main.subdir + "/";
k = sub.length;
rv = arrived.revisions;
for ( i = 0; i < rv.length; i++ ) {
e = rv[ i ];
if ( typeof e === "object"
&& e &&
typeof e.src === "string" &&
typeof e.id === "number" ) {
if ( e.src.substr( 0, k ) === sub &&
e.src.substr( k +1, 1 ) !== "." &&
e.id ) {
store = store + e.src.substr( k, 2 ) + "_"
+ e.id + "~";
}
}
} // for i
if ( typeof window.localStorage === "object" ) {
try {
window.localStorage.setItem( WSTM.main.swift, store );
} catch ( err ) {
}
} else {
window.mw.cookie.set( WSTM.main.swift,
store,
{ expires: 7,
path: "/" } );
}
}
}; // .main.vc.put()
WSTM.main.vc.update = function () {
// > .main.score
// > .main.vc.next
// WSTM.main.load()
// mw.hook()
// (.main.vc.put)
// 2018-09-19 [email protected]
var date, max;
if ( typeof mw.hook !== "undefined" ) {
date = new Date();
max = ( WSTM.main.score === "d" ? 1000000 : 86400000 );
if ( date.valueOf() - max > this.next ) {
WSTM.main.load( "user:PerfektesChaos/versionControl",
"en.wikipedia.org",
"User:PerfektesChaos/js/versionControl/" +
WSTM.main.score + ".js" );
mw.hook( "user:PerfektesChaos/versionControl.retrieve" )
.fire( { "site": "en.wikipedia.org",
"space": "User:PerfektesChaos",
"store": "versionControl" },
function ( answer ) {
WSTM.main.vc.put( answer );
} );
}
}
}; // .main.vc.update()
}; // .bb.main()
mw.libs.WikiSyntaxTextMod.bb.main( mw.libs.WikiSyntaxTextMod );
delete mw.libs.WikiSyntaxTextMod.bb.main;
//-----------------------------------------------------------------------
mw.libs.WikiSyntaxTextMod.bb.prefs = function ( WSTM ) {
// Preferences (interactive on Special:Gadgets)
// 2018-09-10 [email protected]
"use strict";
WSTM.util.fiatObjects( WSTM,
"prefs",
{ loaded: false,
supply: "preferencesGadgetOptions" } );
WSTM.prefs.fetch = function () {
// Retrieve preferences and overwrite presets
// Uses:
// > .prefs.supply
// > .type
// >< .config.portlet
// < .config.diffPage
// mw.libs.preferencesGadgetOptions.fetch()
// 2015-09-15 [email protected]
var vals = false;
if ( typeof mw.libs[ this.supply ] === "object"
&& mw.libs[ this.supply ]
&& mw.libs[ this.supply ].fetch ) {
vals = mw.libs[ this.supply ].fetch( WSTM.type );
}
if ( vals ) {
WSTM.config.diffPage = vals.diffPage;
if ( ! WSTM.config.portlet
|| typeof WSTM.config.portlet === "boolean" ) {
WSTM.config.portlet = vals.portlet;
}
}
}; // .prefs.fetch()
WSTM.prefs.first = function ( after, also ) {
// Prepare ResourceLoader availability of preferencesGadgetOptions
// Precondition:
// after -- function to continue
// also -- array of more prerequisites, or false
// Postcondition:
// load requested, if not yet defined
// Uses:
// this
// > .prefs.supply
// WSTM.main.load()
// mw.loader.using()
// .prefs.follow()
// (.prefs.follow)
// 2018-09-10 [email protected]
WSTM.main.load( "ext.gadget." + this.supply,
"en.wikipedia.org",
"User:PerfektesChaos/js/" + this.supply + "/r.js",
604801 );
if ( after ) {
if ( also ) {
mw.loader.using( also,
function () { WSTM.prefs.follow( after );
} );
} else {
WSTM.prefs.follow( after );
}
}
}; // .prefs.first()
WSTM.prefs.follow = function ( action ) {
// Register main start function for launch when options ready
// Precondition:
// action -- function to continue
// Uses:
// > .prefs.supply
// >< .prefs.loaded
// mw.hook()
// (action)
// Remark: May be used as event handler -- 'this' is not accessed
// 2018-09-06 [email protected]
if ( WSTM.prefs.loaded ) {
action();
} else {
mw.hook( WSTM.prefs.supply + ".ready" )
.add( function () { WSTM.prefs.loaded = true;
action();
} );
}
}; // .prefs.follow()
}; // .bb.prefs()
mw.libs.WikiSyntaxTextMod.bb.prefs( mw.libs.WikiSyntaxTextMod );
delete mw.libs.WikiSyntaxTextMod.bb.prefs;
//-----------------------------------------------------------------------
if ( typeof window === "object" && window ) { // online
// Convenience methods (interactive)
// 2013-03-08 [email protected]
window.WikiSyntaxTextMod_About = function () {
// Pop up message box with version information, or return version
// Postcondition:
// Message box is displayed.
// Returns void(0), as required in GUI action, if browser window
// Uses:
// > window
// > .vsn
// .main.focus()
// jQuery()
/// 2018-09-03 [email protected]
"use strict";
var r = mw.libs.WikiSyntaxTextMod.vsn,
$c,
$m;
if ( typeof window === "object" ) { // online
$c = mw.libs.WikiSyntaxTextMod.main.focus();
if ( $c ) {
$m = window.jQuery( "<div>" );
$m.css( "border", "solid 1px #0000FF" )
.text( r );
$c.before( $m );
}
if ( typeof window.console === "object" &&
typeof window.console.info === "function" ) {
window.console.info( r );
}
if ( typeof window.alert === "function" ) {
window.alert( r );
}
r = void( 0 );
}
return r;
}; // WikiSyntaxTextMod_About()
window.WikiSyntaxTextMod_Run = function () {
// External access (API): Launch replacement manually
// Uses:
// .api.run()
// 2012-02-12 [email protected]
"use strict";
mw.libs.WikiSyntaxTextMod.api.run();
return void( 0 );
}; // WikiSyntaxTextMod_Run()
} // window "object"
//-----------------------------------------------------------------------
mw.libs.WikiSyntaxTextMod.bb.auto = function ( WSTM ) {
// Start execution on import
// 2012-10-03 [email protected]
"use strict";
WSTM.autoRun = function () {
// Load and start WikiSyntaxTextMod, if appropriate
// Precondition:
// Wikiserver environment
// Postcondition:
// Returns void(0), as required in GUI action, if browser window
// Remark: Used as event handler -- 'this' is not WSTM
// Uses:
// > .g.wNsNumber
// > .config.load.urlPar
// > .config.load.inhibit
// > .config.load.api
// > .config.load.updater
// >< .g.wPageName
// < .main.lockAuto
// .g.fetch()
// .prefs.first()
// .api.isAppropriate()
// mw.loader.using()
// .main.features()
// .main.actionSubmit()
// mw.util.getParamValue()
// mw.config.get()
// jQuery().ready()
// (.api.load)
// (.main.follow)
// 2016-10-08 [email protected]
var launch = false,
lookup = false,
luxury = false,
later,
learn,
load,
lock,
re,
start;
WSTM.main.lockAuto = true;
WSTM.g.fetch( false, "wgNamespaceNumber", "wNsNumber" );
lock = ( WSTM.g.wNsNumber === -1 );
if ( lock ) {
luxury = ( mw.config.get( "wgCanonicalSpecialPageName" )
=== "Blankpage" );
} else {
WSTM.config.load.urlPar = mw.util.getParamValue( "wstm" );
if ( typeof WSTM.config.load.urlPar === "string" ) {
re = new RegExp( "^(0|false$|n|inhibit)" );
if ( re.test( WSTM.config.load.urlPar ) ) {
lock = true;
}
} // &wstm=
if ( typeof WSTM.config.load.inhibit === "boolean" ) {
lock = WSTM.config.load.inhibit;
}
load = ! lock;
if ( load &&
WSTM.g.fetch( undefined, false ) ) {
load = ! mw.config.get( "wgIsArticle" );
} // ! wgIsArticle
}
if ( load ) {
start = mw.util.getParamValue( "action" );
learn = false;
if ( start === "edit" ) {
learn = ( ! ( mw.util.getParamValue( "undo" ) ||
mw.util.getParamValue( "undoafter" ) ) );
} else if ( start === "submit" ) {
lookup = true;
}
if ( learn || lookup ) {
load = WSTM.api.isAppropriate( false );
launch = learn;
if ( lookup ) {
lookup = ( WSTM.g.wNsNumber % 2 === 0 );
if ( lookup ) {
lookup = WSTM.api.isAppropriate( true );
}
}
}
} // "edit" is always a non-regular page, never IsArticle
if ( ! load ) {
if ( typeof WSTM.config.load.updater === "string" ) {
if ( WSTM.config.load.updater.length ) {
WSTM.g.fetch( false, "wgPageName", "wPageName" );
if ( WSTM.g.wPageName !== null ) {
re = new RegExp( WSTM.config.load.updater, "i" );
load = ( re.test( WSTM.g.wPageName ) );
} // wgPageName
} else {
load = true;
}
} // config.load.updater
} // .config.load.inhibit
if ( load || luxury || WSTM.config.load.api ) {
WSTM.api.load( launch || luxury );
} // Do it!
if ( lookup || launch ) {
if ( lookup ) {
WSTM.main.features();
WSTM.prefs.first( function () {
window.jQuery( WSTM.main.actionSubmit );
} );
}
if ( ! lookup && launch ) {
later = WSTM.api.isAppropriate( true );
} else {
later = lookup;
}
if ( later ) {
WSTM.prefs.first( WSTM.main.follow );
}
}
return void( 0 );
}; // .autoRun()
if ( typeof window === "object"
&& window && // online
typeof WSTM.main.lockAuto !== "boolean" &&
typeof mw === "object"
&& mw &&
typeof mw.loader === "object" &&
typeof window.jQuery !== "undefined"
&& window.jQuery ) {
WSTM.main.lockAuto = true;
WSTM.main.ready( false );
mw.loader.using( [ "user",
"user.options",
"mediawiki.user",
"mediawiki.util",
"mediawiki.cookie" ],
WSTM.autoRun );
}
if ( typeof WSTM.config.load === "object"
&& WSTM.config.load &&
typeof WSTM.config.load.after === "function" ) {
WSTM.config.load.after();
}
}; // .bb.auto()
mw.libs.WikiSyntaxTextMod.bb.auto( mw.libs.WikiSyntaxTextMod );
delete mw.libs.WikiSyntaxTextMod.bb.auto;
void( 0 );
// Emacs
// Local Variables:
// coding: iso-8859-1-dos
// fill-column: 80
// End:
/// EOF </nowiki> WikiSyntaxTextMod/d.js