Revision 183008 of "User:PerfektesChaos/common.js" on testwikivoid("PerfektesChaos/common.js"); // cheat MW minimizer
/// <nowiki>
// ==UserScript==
// @name common
// @version 2013-10-02
// @namespace file
// @include http://de.wikipedia.org/*
// @include http://de.wikisource.org/*
// @include https://de.wikipedia.org/*
// @include https://de.wikisource.org/*
// @grant none
// @run-at document-start
// ==/UserScript==
/*jshint curly:true, forin:false, laxbreak:true, strict:true,
trailing:true, white:false */
/*global window:false */
/*jslint forin: true, plusplus: true, regexp: true, sloppy: true,
unparam: true, vars: true, white: true, maxerr: 50 */
/*globals window: false */
if ( ! window.PerfektesChaos ) {
window.PerfektesChaos = { };
}
if ( ! window.PerfektesChaos.bb ) {
window.PerfektesChaos.bb = { };
}
//-----------------------------------------------------------------------
window.PerfektesChaos.bb.mw = function (userObj, mw, jQuery, win) {
"use strict";
userObj.mw_libs = mw.libs;
mw.log = function (assign, apply, action, add) {
// Popup message, if under development
// assign -- debugging object
// > .max number of message boxes
// > .say identification of app
// >< .loud false: silent
// >< .man current message box count
// apply -- message string
// action -- level: 0=log 1=debug 2=info 3=warn 4=error
// add -- additional object; true: trace
// Uses:
// Firebug support
// 2012-11-18
var opt = assign;
var show = apply;
var s;
var wc;
if (typeof(opt) === "string" &&
typeof(show) !== "string") {
show = opt;
opt = true;
}
if (opt === true) {
opt = { loud: true,
say: ".log" };
}
if (opt) {
if (typeof(opt) === "object") {
if (opt.loud !== undefined) {
if (opt.loud) {
if (typeof(opt.max) !== "number") {
opt.max = 20;
}
if (typeof(opt.man) !== "number") {
opt.man = 0;
}
if (typeof(opt.say) === "string") {
s = opt.say + " ";
} else {
s = "";
}
wc = win.console;
if (typeof(wc) === "object") {
s = s + show;
switch (action) {
case 1 :
if (typeof(wc.debug) === "function") {
wc.debug(s);
break;
} // might fall through
case 2 :
if (typeof(wc.info) === "function") {
wc.info(s);
break;
} // might fall through
case 3 : //
if (typeof(wc.warn) === "function") {
wc.warn(s);
break;
} // might fall through
case 4 : //
if (typeof(wc.error) === "function") {
wc.error(s);
break;
} // might fall through
default : //
if (typeof(wc.log) === "function") {
wc.log(s);
} // might fall through
} // switch action
if (add) {
switch (typeof(add)) {
case "function" :
case "object" :
if (typeof(wc.dir) === "function") {
wc.dir(add);
break;
} // might fall through
case "string": //
if (typeof(wc.debug) === "function") {
wc.debug(add);
break;
} // might fall through
default : //
if (typeof(wc.trace) === "function") {
wc.trace();
break;
} else {
wc.log(add);
}
} // switch typeof(add)
}
if (action) {
if ( ! opt.man
&& typeof(action) === "number") {
if (action > 2) {
if (win.PerfektesChaos.g.client) {
if (win.PerfektesChaos.g.client.name
=== "firefox") {
win.alert("Firebug console");
opt.man = -1;
}
}
}
}
}
} else { // Fallback
if (typeof(opt.man) !== "number") {
opt.man = -1;
}
if (opt.man > opt.max) {
opt.loud = false;
} else {
opt.man++;
s = s + " #" + opt.man;
if (typeof(action) === "number") {
s = s + " " + action;
}
if (typeof(show) !== "number") {
s = s + "\n" + show;
}
if ( ! win.confirm(s) ) {
opt.loud = false;
}
}
}
} // opt.loud
} // typeof opt.loud
} // opt object
} // opt
}; // mw.log()
}; // .bb.mw()
//-----------------------------------------------------------------------
window.PerfektesChaos.bb.cnf = function (userObj, mw, jQuery, win) {
// 2013-04-14
"use strict";
userObj.cnf = { script: "javascript" };
userObj.debugging = { wg: win.debug,
loud: true,
max: 10,
man: 0,
say: "~PC~" };
userObj.g = { };
win.debugging = { loud: true,
say: "##??? (PC) ???##" };
if (typeof(win.debug) === "boolean") {
mw.config.set("debug", win.debug);
}
userObj.fundamentals = function () {
// Define available script locations (autorun)
// Uses:
// < .g.*
// < .cnf.lightSpoof
// 2012-10-29
this.g.name = "User:PerfektesChaos";
this.g.action = mw.config.get("wgAction");
this.g.dbName = mw.config.get("wgDBname");
this.g.isArticle = mw.config.get("wgIsArticle");
this.g.nsN = mw.config.get("wgNamespaceNumber");
this.g.pageName = mw.config.get("wgPageName");
this.g.skin = mw.config.get("skin");
this.g.title = mw.config.get("wgTitle");
this.g.isEditing = ! this.g.isArticle;
this.g.isResource = false;
if (this.g.isEditing) {
this.g.isEditing = (this.g.action === "edit" ||
this.g.action === "submit");
}
this.cnf.lightSpoof = true;
}; // .fundamentals()
userObj.fundamentals();
userObj.flop = function (arg) {
// Interprete arg
// Postcondition:
// Return false if arg indicates 'undesirable'
// 2012-02-14
var r = arg;
if (arg === null) {
r = false;
} else if (typeof(arg) === "string") {
if (arg.substr(0, 1) === "n" ||
arg === "0" ||
arg === "-" ||
arg === "null" ||
arg === "false") {
r = false;
}
}
return r;
}; // .flop()
userObj.isEditPermitted = function () {
// Is the current user permitted to edit the current page?
// Postcondition:
// Return true iff no restriction detected
// 2012-05-16
var r = true,
dont = mw.config.get("wgRestrictionEdit"),
groups, i, j, m, n, ng, p;
if (dont) {
if (typeof(dont) === "object") {
n = dont.length;
if (n) {
groups = mw.config.get("wgUserGroups");
r = false;
if (groups) {
ng = groups.length;
if (ng) {
m = n;
for (i = 0; i < n; i++) {
p = 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);
}
}
}
}
}
return r;
}; // .isEditPermitted()
userObj.isNamespace = function (applicable) {
// Is the current page in certain namespace?
// Precondition:
// applicable -- Array of namespace numbers
// Postcondition:
// Return true iff current namespace in applicable list
// Uses:
// this
// > .g.nsN
// 2013-01-11
var r = false,
i,
n = applicable.length;
for (i = 0; i < n; i++) {
if (applicable[i] === this.g.nsN) {
r = true;
break; // for i
}
} // for i
return r;
}; // .isNamespace()
userObj.cnf.flat = function () {
// Remove minordefault tic if not appropriate
// Precondition:
// apply -- (local) path
// Postcondition:
// Form tic removed/set for some conditions
// Uses:
// this
// > .g.nsN
// > .g.isResource
// >< .cnf.form_Edit
// 2012-11-11
var box;
var low = true;
var s;
var textarea;
if ( ! this.form_Edit ) {
this.form_Edit = win.document.getElementById("editform");
}
if (this.form_Edit && typeof(this.form_Edit) === "object") {
box = this.form_Edit.wpMinoredit;
if (box && typeof(box) === "object") { // section != new
if (userObj.g.isResource ||
userObj.g.nsN % 2) {
low = false;
} else {
textarea = this.form_Edit.wpTextbox1;
if (textarea && typeof(textarea) === "object") {
s = textarea.value;
if (s.indexOf(" (CE") > 0) {
if (s.indexOf(" (CET)") > 0 ||
s.indexOf(" (CEST)") > 0) {
low = false;
}
}
}
}
box.checked = low;
} // box
} // form_Edit
}; // .cnf.flat()
userObj.cnf.force = function (action) {
// Confirm save button
// Precondition:
// action --
// Uses:
// > .cnf.script
// < .cnf.form_Edit
// document
// Remark: Used as event handler -- 'this' is not userObj
// 2012-11-11
var button, confirm;
userObj.cnf.form_Edit = win.document.getElementById("editform");
if (userObj.cnf.form_Edit) {
button = userObj.cnf.form_Edit.wpSave;
if (button) {
if (typeof(action) === "function") {
confirm = win.document.createElement("A");
confirm.id = "thresholdSave";
confirm.href = userObj.cnf.script
+ ":PerfektesChaos."
+ "cnf.force(true);";
confirm.textContent = "Speichern";
button.parentNode.insertBefore(confirm, button);
// button.type = "hidden";
button.setAttribute("style", "display:none");
} else {
// button.type = "submit";
button.removeAttribute("style");
}
} // button
} // form_Edit
}; // .cnf.force()
userObj.cnf.filthy = function () {
// Disable central notices
// Uses:
// > .cnf.script
// < .cnf.form_Edit
// document
// jQuery.cookie()
// 2012-11-15
if (! jQuery.cookie("centralnotice_default")) {
jQuery.cookie("centralnotice_default",
"hide",
{ expires: 365,
path: "/" });
/*
jQuery.cookie("centralnotice_default",
"hide",
{ expires: 365,
path: "/w/" });
jQuery.cookie("centralnotice_default",
"hide",
{ expires: 365,
path: "/wiki/" });
jQuery.cookie("centralnotice_fundraising",
"hide",
{ expires: 365,
path: "/" });
*/
}
if (jQuery.cookie("clicktracking-session")) {
jQuery.cookie("clicktracking-session", null);
}
}; // .cnf.filthy()
userObj.fetch = function () {
// Define current configuration depending on cookies
// Uses:
// > .load.js
// > .load.js.suffix
// > .local.lock
// >< .local.storage
// >< .load.base
// < .debugging.debug
// < .load.js.DISK
// < win.debug
// jQuery.cookie()
// .flop()
// .load.server.fetch()
// .load.js.fun()
// .local.file()
// 2013-09-04
var got;
var p;
var re;
var script;
var setting = "";
var sub;
if (! this.local.storage) {
sub = win.localStorage.getItem("local.path");
if (typeof(sub) === "string") {
this.local.storage = sub;
}
}
if (this.local.storage) {
setting = win.localStorage.getItem("load.base");
if ( ! setting) {
setting = "";
}
} else if ("|chrome|firefox".indexOf(this.g.client.name) > 0) {
win.alert("DISK: local.path");
}
this.debugging.debug = this.flop( jQuery.cookie("wgDebug") );
if (this.debugging.debug) {
this.debugging.debug = true;
}
win.debug = this.debugging.debug;
this.load.server.fetch("en");
this.load.server.fetch("de");
this.load.server.fetch("test");
this.load.server.fetch("mw");
this.magic = 799;
for (script in this.load.base) {
p = this.load.base[script];
if (typeof(p.js) === "object") {
re = new RegExp("~" + script + "_([-a-z:0]+/?)~", "");
got = re.exec(setting);
if (got) {
sub = this.flop(got[1]);
p.js.SET = sub;
} else {
sub = p.js.STD;
if (sub && p.js["file:/"] && ! this.local.lock) {
sub = "file:/";
}
}
if (sub) {
if (p.js[sub]) {
sub = p.js[sub];
} else if (sub === "file:/") {
sub = script;
} else {
sub = false;
}
switch (typeof(sub)) {
case "object" :
p.js.WEB = this.load.js[ sub[0] ] + script;
if (sub[1] !== "*") {
p.js.WEB += "/" + sub[1];
}
p.js.WEB += this.load.js.suffix;
break;
case "boolean" :
if (! sub) {
break;
}
sub = script; // fall through
case "string" : //
if (sub !== "*") {
if (sub === "0") {
sub = false;
} else if (typeof(this.local.storage)
=== "string") {
p.js.DISK = sub + ".js";
sub = "file:/";
} else if (! this.local.lock) {
sub = "no local.path";
mw.log(this.debugging,
".fetch() no local.path",
3);
}
}
break;
default :
mw.log(this.debugging,
".fetch() Unknown: " + script
+ " " + sub,
3);
sub = "*Unknown*";
} // switch typeof(sub)
}
p.js.USE = sub;
}
} // script in base[]
if (typeof( jQuery.cookie("wikEdDiff") ) === "string") {
this.load.js.fun("Cacycle/wikEdDiff");
}
if (this.local.storage && ! this.local.lock) {
this.local.file(this.local.storage + "proj/user-common.css");
}
}; // .fetch()
}; // .bb.cnf()
//-----------------------------------------------------------------------
window.PerfektesChaos.bb.load = function (userObj, mw, jQuery, win) {
// 2013-08-24
"use strict";
if ( ! userObj.load ) {
userObj.load = { };
}
userObj.load.ready = false;
userObj.load.path = "/w/index.php?title=";
userObj.load.scheme = win.location.protocol + "//";
userObj.load.server = { };
userObj.load.css = { path: userObj.g.name + "/css/",
suffix: ".css&action=raw&ctype=text/css" };
userObj.load.js = { path: userObj.g.name + "/js/",
suffix: ".js&action=raw"
+ "&ctype=text/javascript" };
if ( ! userObj.local ) {
userObj.local = { };
}
userObj.load.server.fetch = function (attempt) {
// Precondition:
// attempt -- "en", "de", "test", "mw"
// Uses:
// > .load.scheme
// > .load.path
// > .load.js.path
// < .load.server[]
// < .load.js
// 2012-02-10
var r;
r = userObj.load.scheme;
switch (attempt) {
case "en" :
case "de" :
case "test" :
r = r + attempt + ".wikipedia.org";
break;
case "mw" :
r = r + "www.mediawiki.org";
break;
} // switch s
userObj.load.server[attempt] = r;
userObj.load.js[attempt] = r + userObj.load.path
+ userObj.load.js.path;
return r;
}; // .load.server.fetch()
userObj.load.furnish = function () {
// Define available script locations (autorun)
// Uses:
// this
// 2013-10-02
this.base = { "autoBackup": {},
"booksourcesDirect": {},
"ClicksDivertimento": {},
"editorContent": {},
"DebugWikiGlobals": {},
"defekterWeblinkBotVorlage": {},
"editToolStrIns": {},
"fileAdm": {},
"importUtility": {},
"lightSpoof": {},
"listPageOptions": {},
"localEdit": {},
"paneMarker": {},
"preferencesGadgetOptions": {},
"resultListSort": {},
"ScanPages": {},
"ToolboxAddItems": {},
"userspaceLinks": {},
"Utilities": {},
"watchCategories": {},
"wikiExport": {},
"WikiSyntaxTextMod": {},
"wikEd": {},
"wikEdDiff": {} };
this.base.autoBackup.js = { "STD": "en:r",
"file:/": true,
"en:r": ["en", "r"],
"mw": ["mw", "r"],
"test": ["test", "d"] };
this.base.ClicksDivertimento.js = { "STD": "en:d",
"en:d": ["en", "d"] };
this.base.DebugWikiGlobals.js = { "STD": "en:d",
"en:r": ["en", "r"],
"en:d": ["en", "d"] };
this.base.defekterWeblinkBotVorlage.js =
{ "STD": "de",
"file:/": true,
"de": ["de", "r"] };
this.base.editorContent.js = { "STD": "en:r",
"file:/": true,
"en:d": ["en", "d"],
"en:r": ["en", "r"] };
this.base.editToolStrIns.js = { "STD": "mw",
"file:/": true,
"mw": ["mw", "debug"],
"test": ["test", "d"] };
this.base.fileAdm.js = { "STD": false,
"file:/": true,
"test": ["test", "d"] };
this.base.importUtility.js = { "STD": false,
"file:/": true,
"test": ["test", "d"] };
this.base.lightSpoof.js = { "STD": "de",
"de": ["de", "*"] };
this.base.listPageOptions.js = { "STD": "en:r",
"file:/": true,
"beta:d": ["beta", "d"],
"test:d": ["test", "d"],
"en:d": ["en", "d"],
"en:r": ["en", "r"] };
this.base.localEdit.js = { "STD": false,
"file:/": true,
"test": ["test", "d"],
"en": ["en", "d"] };
this.base.paneMarker.js = { "STD": "mw",
"file:/":
"paneMarker/paneMarker",
"test": ["test", "r"],
"mw": ["mw", "r"] };
this.base.resultListSort.js = { "STD": "mw",
"file:/": true,
"mw": ["mw", "r"] };
this.base.preferencesGadgetOptions.js = { "STD": false,
"file:/": true };
this.base.ScanPages.js = { "STD": false,
"file:/": true,
"test": ["test", "d"],
"en:d": ["en", "d"] };
this.base.ToolboxAddItems.js = { "STD": "en:x",
"file:/": false,
"en:d": ["en", "d"],
"en:r": ["en", "r"],
"en:x": ["en", "x"] };
this.base.userspaceLinks.js = { "STD": "file:/",
"file:/": true,
"mw": ["mw", "r"] };
this.base.Utilities.js = { "STD": "en:x",
"en:d": ["en", "d"],
"en:x": ["en", "x"] };
this.base.watchCategories.js = { "STD": "en",
"file:/": true,
"en": ["en", "d"],
"en:r": ["en", "r"] };
this.base.wikiExport.js = { "STD": "en",
"file:/": true,
"en": ["en", "d"],
"en:r": ["en", "r"] };
this.base.WikiSyntaxTextMod.js = { "STD": "en:r",
"file:/": "WSTM",
"test:r": ["test", "r"],
"en:r": ["en", "r"],
"en:d": ["en", "d"],
"de:r": ["de", "r"] };
this.base.wikEd.js = { "STD": false,
"en": "*" };
this.base.wikEdDiff.js = { "STD": false,
"en": "*" };
}; // .load.furnish()
userObj.load.furnish();
}; // .bb.load()
//-----------------------------------------------------------------------
window.PerfektesChaos.bb.js = function (userObj, mw, jQuery, win) {
// 2012-09-25
"use strict";
userObj.load.js.fun = function (add, append, access) {
// Load current (cookie controlled) version of add
// Precondition:
// add -- identifier
// append -- subpage
// access -- distinction
// Uses:
// > .load.base
// > .load.server
// > .load.path
// > .load.js
// > .g.skin
// .load.js.lightSpoof()
// .local.files()
// mw.loader.load()
// 2013-08-24
var p = userObj.load.base[add];
var script = false;
var schnark = userObj.load.server.de + userObj.load.path
+ "User:Schnark/js/";
var use = false;
if (typeof(access) !== "string") {
access = append;
}
switch (add) {
case "Schnark:diff" :
//[[Benutzer:Schnark/js/diff]]
script = schnark + "diff";
break;
case "lightSpoof" :
if (p.js.USE[0] === "de") {
this.lightSpoof(schnark);
}
break;
case "Cacycle/wikEd" :
case "Cacycle/wikEdDiff" :
p = userObj.load.base[ add.substr(8) ];
if (p.js.USE) {
script = userObj.load.server.en + userObj.load.path
+ "User:" + add;
}
break;
} // switch add
if (script) {
script = script + this.suffix;
} else {
if (p) {
if (p.js) {
if (p.js.DISK && ! userObj.local.lock) {
userObj.local.files(p.js.DISK);
script = false;
} else if (p.js.WEB) {
script = p.js.WEB;
}
}
} else {
mw.log(userObj.debugging,
".load.js.fun() unknown " + add,
3);
}
}
if (script) {
if (use) {
mw.loader.using( use,
function () {
mw.loader.load(script,
"text/javascript");
} );
} else {
mw.loader.load(script, "text/javascript");
}
}
}; // .load.js.fun()
userObj.load.js.autoBackup = function () {
// Uses:
// .load.js.fun()
// 2012-11-11
if ( typeof mw.libs.autoBackup !== "object" ||
! mw.libs.autoBackup ) {
mw.libs.autoBackup = { };
}
mw.libs.autoBackup.debugging = { loud: true,
say: "autoBAK" };
this.fun("autoBackup");
}; // .load.js.autoBackup()
userObj.load.js.editToolStrIns = function () {
// .load.js.fun()
// 2012-11-02
if (typeof(mw.libs.editToolStrIns) !== "object") {
mw.libs.editToolStrIns = { };
}
mw.libs.editToolStrIns.user =
{ "config": { "cookieName": "editToolStrIns-vector" },
"custom": [ "0", true,
"[[]]", true,
"Xsux", "Keilschrift",
"Phli", "Pahlavi",
"TeX", true,
"TeX_ar", true,
"TeX_bi", true,
"TeX_di", true,
"TeX_gr", true,
"TeX_tx", true ],
"defs": { "Xsux": [ { "font-family": "Akkadian,"
+ " CuneiformComposite,"
+ " Free Idg Serif" } ],
"Phli": [ { "font-family": "ZH Mono" } ] } };
mw.libs.editToolStrIns.debugging = { loud: true,
man: 0,
max: 20,
say: "etSI" };
this.fun("editToolStrIns");
}; // .load.js.editToolStrIns()
userObj.load.js.fileAdm = function () {
// Uses:
// .isNamespace()
// jQuery.cookie()
// .load.fun()
// 2013-01-29
var FA;
if ( userObj.isNamespace( [ -1, 4, 6, 14, 100 ] ) ) {
mw.libs.fileAdm = { debugging: { loud: true } };
FA = mw.libs.fileAdm;
FA.debugging.skin = jQuery.cookie("fileAdm_Skin");
if (typeof(FA.debugging.skin) === "string") {
if (FA.debugging.skin === userObj.g.skin) {
FA.options = { "lessMini": false,
"multiWin": false };
userObj.load.js.fun("fileAdm");
} else {
FA.debugging = false;
}
} else {
FA.debugging = false;
}
if ( ! mw.libs.fileAdm.debugging ) {
delete mw.libs.fileAdm;
}
}
}; // .load.js.fileAdm()
userObj.load.js.lightSpoof = function (access) {
// 2012-10-05
mw.loader.load("jquery.async");
mw.loader.load(access + "highlight" + this.suffix,
"text/javascript");
/// </nowiki>
//[[Benutzer:Schnark/js/highlight]]
jQuery(win.document).bind("loadWikiScript",
function (e, name) {
var s = "Benutzer:Schnark/js/highlight.js";
if (name === s) {
mw.loader.load(access + "antispoof"
+ userObj.load.js.suffix,
"text/javascript");
//[[Benutzer:Schnark/js/antispoof]]
}
});
/// <nowiki>
}; // .load.js.lightSpoof()
userObj.load.js.wstm = function () {
// Uses:
// this
// > .local.storage
// > .g.nsN
// .flop()
// .local.files()
// .load.js.fun()
// 2013-08-24
var val, WSTM,
ud = { stop: "WSTM_NoUDF",
storage: "wstm.udfPath" };
if ( ! mw.libs.WikiSyntaxTextMod) {
mw.libs.WikiSyntaxTextMod = { };
}
WSTM = mw.libs.WikiSyntaxTextMod;
WSTM.config = { data: { },
diffPage: true,
lang: { },
load: { },
page: { },
portlet: { },
warn: { } };
WSTM.debugging = { loud: true,
man: 0,
max: 20,
say: "WSTM",
timer: false };
WSTM.debugging.feeder = function (acquire) {
var i;
var local = (WSTM.debugging.site === "file:/");
var q;
if (local) {
q = [ ];
for (i = 0; i < acquire.length; i++) {
q.push("WSTM_"
+ acquire.substr(i, 1)
+ ".js");
} // for i
local = userObj.local.files(q);
}
return local;
}; // WSTM.debugging.feeder()
val = userObj.load.base.WikiSyntaxTextMod.js.USE;
if (val === "file:/") {
WSTM.debugging.site = "file:/";
WSTM.debugging.prefix = "X";
} else if (typeof(val) === "object") {
WSTM.debugging.prefix = val[1];
val = val[0];
if (val.length <= 2) {
val = "";
}
WSTM.debugging.site = val;
val = true;
} else {
val = false;
}
if (val) {
WSTM.config.lang.accept = "de";
WSTM.config.portlet = true;
WSTM.config.page =
{ include: [ ":dewiki:Benutzer:PerfektesChaos/js/",
":dewiki:Benutzer:PerfektesChaos/LocalEdit",
":dewiki:Wikipedia:Spielwiese",
"Vorlage:.+/(Meta|Doku)",
":commonswiki:Commons:",
":.+:User:PerfektesChaos(/.+)?$",
":.+:File:.*" ],
support: [ ":dewiki:Datei:",
":dewiki:Hilfe:",
":dewiki:Kategorie:",
":dewiki:Wikipedia:",
":commonswiki:Help:" ],
exclude: [ ":dewiki:Wikipedia:Administratoren/",
":dewiki:Wikipedia:Fragen zur ",
":dewiki:Wikipedia:Löschkandidaten/",
":dewiki:Wikipedia:Meinungsbild",
":dewiki:Wikipedia:Projekt",
":dewiki:Wikipedia:Redaktion ",
":dewiki:Wikipedia:.*Redundanz/",
":dewiki:Wikipedia:WikiProjekt" ]
};
WSTM.config.warn = { };
if (userObj.g.pageName === "Wikipedia:Spielwiese") {
this.fun("ToolboxAddItems");
}
if (userObj.local.storage) {
val = userObj.flop(jQuery.cookie(ud.stop));
if (val) {
if ( ! /^[-0]/.test(val) ) {
val = false;
}
}
if (! val) {
val = win.localStorage.getItem("wstm.udfPath");
if (val) {
userObj.local.files(val + ".user.js");
}
}
}
if (userObj.bb.wstmcnf) {
userObj.bb.wstmcnf(WSTM, mw);
}
userObj.load.js.fun("WikiSyntaxTextMod");
}
}; // .load.js.wstm()
}; // .bb.js()
//-----------------------------------------------------------------------
window.PerfektesChaos.bb.run = function (userObj, mw, jQuery, win) {
// 2012-09-25
"use strict";
userObj.afterLoad = function () {
// Do something after loading loadResources()
// Uses:
// Remark: Used as event handler -- 'this' is not userObj
// 2012-11-09
var shared = "[[Benutzer:PerfektesChaos/css/shared.css]]";
var sf = win.loadResources(shared);
var ressources = userObj.load;
ressources.ready = true;
// Utilities
/*
moduleLink("user:PerfektesChaos/DebugWikiGlobals",
"[[:w:en:User:PerfektesChaos/js/DebugWikiGlobals/r.js]]"
);
externalFunction("user:PerfektesChaos/DebugWikiGlobals",
postponedDebug);
*/
}; // .afterLoad()
userObj.fire = function () {
// Remark: Used as event handler -- 'this' is not userObj
// 2012-06-08
userObj.first();
}; // .fire()
userObj.first = function () {
// Initialization (autorun)
// Precondition:
// jQuery.client available
// Uses:
// this
// > .local.storage
// > .g.nsN
// > .g.isArticle
// > .g.title
// > .g.dbName
// > .g.nsN
// >< .g.isEditing
// >< .cnf.lightSpoof
// < .g.client
// < .local.lock
// < .g.isResource
// < .g.isDiffPossible
// jQuery.client.profile()
// mw.util.getParamValue()
// .fetch()
// .local.file()
// .load.js.fun()
// .load.js.autoBackup()
// .isNamespace()
// .isEditPermitted()
// .load.js.editToolStrIns()
// .load.js.wstm()
// .load.js.fileAdm()
// .cnf.filthy()
// jQuery, mw, document
// 2013-09-28
var re, special;
this.g.client = jQuery.client.profile();
if (! this.g.client) {
this.g.client = { };
}
this.local.lock = (this.g.client.layout !== "gecko" &&
this.g.client !== "webkit");
this.fetch();
win.PerfektesChaos_Utilities = this.afterLoad;
if (this.local.storage) {
if (! userObj.load.xz && ! userObj.local.lock ) {
this.local.file(this.local.storage + "Greaze/FF/before.js");
}
}
this.load.js.fun("Utilities"); // required: loadResources()
/*
mw.libs.paneMarker = { opt: { faviconICO:
"https://secure.wikimedia.org/favicon.ico"
}
};
*/
mw.libs.autoBackup = { opt: { portlet: true }
};
switch (this.g.nsN) {
case -1:
special = mw.config.get("wgCanonicalSpecialPageName");
switch (special) {
case "Gadgets" :
this.load.js.fun("preferencesGadgetOptions");
break;
case "Watchlist" :
this.load.js.fun("watchCategories");
break;
}
this.load.js.fun("resultListSort");
this.load.js.fun("listPageOptions");
break;
case 0:
if (this.g.dbName === "dewiki") {
this.load.js.fun("defekterWeblinkBotVorlage");
}
this.load.js.fun("ToolboxAddItems");
break;
case 2:
this.load.js.fun("localEdit");
break;
}
this.load.js.autoBackup();
this.load.js.fun("paneMarker");
if ( userObj.isNamespace( [ -1, 4 ] ) ) {
this.load.js.fun("importUtility");
}
if ( userObj.isNamespace( [ -1, 2, 3 ] ) ) {
this.load.js.fun("userspaceLinks");
}
if (this.g.isArticle || this.g.isEditing) {
if (this.g.title.slice(-4) === ".css" ||
this.g.title.slice(-3) === ".js") {
this.g.isResource = (this.g.nsN
&& this.g.nsN % 2 === 0);
if (this.g.isResource) {
if (this.g.title.slice(-3) === ".js") {
mw.config.set("wgCodeEditorCurrentLanguage",
"javascript");
} else if (this.g.title.slice(-4) === ".css") {
mw.config.set("wgCodeEditorCurrentLanguage", "css");
}
}
} else if (this.g.nsN === 2) {
if (this.g.title.indexOf("/Modul:") > 0) {
this.g.isResource = "lua";
mw.config.set("wgCodeEditorCurrentLanguage", "lua");
}
} else if (this.g.nsN === 828) {
if (this.g.title.indexOf("/") < 0) {
this.g.isResource = "lua";
} else {
switch (this.g.dbName) {
case "dewiki" :
re = /\/Doku$/;
break;
case "enwiki" :
re = /\/doc$/;
break;
}
if (re) {
if (! re.test(this.g.title)) {
this.g.isResource = "lua";
}
} else {
this.g.isResource = "lua";
}
}
} // suppress JavaScript, CSS and Lua
if (this.g.isEditing) {
this.g.isEditing = this.isEditPermitted();
}
} // view edit submit
this.load.js.fun("ClicksDivertimento");
if (this.cnf.lightSpoof) {
if (this.g.isArticle || this.g.isEditing) {
if (this.g.client.layout === "gecko") {
if (this.g.isResource) {
this.cnf.lightSpoof = false;
} // suppress JavaScript and CSS
if (this.cnf.lightSpoof) {
this.load.js.fun("lightSpoof");
}
}
}
}
if (this.g.nsN >= 0) {
this.load.js.fun("editorContent");
}
if (this.g.isEditing) {
if (this.g.isResource) {
jQuery.cookie("wikiEditor-0-codeEditor-enabled", "0");
} else if ("|chrome|firefox".indexOf(this.g.client.name) > 0) {
win.wikEd = { config: { } };
win.wikEd.config.filePreview = false;
this.load.base.wikEd.js = { STD: "en", USE: "*" };
this.load.base.wikEdDiff.js = { STD: "en", USE: "*" };
this.load.js.fun("Cacycle/wikEd");
this.load.js.fun("wikEd");
}
this.load.js.editToolStrIns();
}
this.g.isDiffPossible = this.g.isEditing;
if ( ! this.g.isDiffPossible) {
if (mw.util.getParamValue("diff")) {
this.g.isDiffPossible = true;
}
}
if (this.g.isDiffPossible && ! this.local.lock) {
this.load.js.fun("Schnark:diff");
}
if (this.g.nsN % 2 === 0 || this.g.nsN === -1) {
switch (this.g.nsN) {
case -1:
if (special !== "Gadgets") {
this.load.js.wstm = false;
}
break;
case 828:
if (this.g.title.indexOf("/") < 0) {
this.load.js.wstm = false;
}
break;
} // switch .g.nsN
if (this.load.js.wstm) {
this.load.js.wstm();
}
}
if ( this.isNamespace( [ -1, 2, 4, 6, 14, 100 ] ) ) {
this.load.js.fileAdm();
}
this.cnf.filthy();
jQuery(win.document).ready(this.further);
}; // .first()
mw.loader.using( [ "mediawiki.util",
"jquery.async",
"jquery.client",
"jquery.cookie" ],
userObj.fire );
userObj.further = function () {
// Do something after loading
// Precondition:
// document load ready
// Uses:
// > .local.storage
// > .load.xz
// > .g.dbName
// < .load.ready
// .local.file()
// .cnf.flat()
// .cnf.force()
// Remark: Used as event handler -- 'this' is not userObj
// 2013-02-07
userObj.load.ready = true;
if (userObj.local.storage) {
if (! userObj.load.xz) {
userObj.local.file(userObj.local.storage
+ "Greaze/FF/after.js");
}
}
if (userObj.g.isEditing) {
/*
if (jQuery.client) {
if (jQuery.client.layout === "gecko") {
if (typeof(win.wikEd) !== "object") {
win.wikEd = { config: { } };
}
win.wikEd.config.filePreview = false;
if (userObj.g.isResource) {
win.wikEd.useWikEd = false;
}
}
}
*/
if (win.location.host === "de.wikipedia.org") {
userObj.cnf.force(userObj.cnf.force);
}
if (userObj.g.nsN) { // talk, project etc.
if (userObj.g.action === "edit") {
userObj.cnf.flat();
} // edit
} // wgNamespaceNumber
}
}; // .further()
}; // .bb.run()
//-----------------------------------------------------------------------
window.PerfektesChaos.bb.common = function (userObj) {
// 2013-08-31
"use strict";
var bbs, i, n, s;
if (! window.PerfektesChaos.bb.loaded) {
bbs = [ "mw", "cnf", "load", "js", "run" ];
n = bbs.length;
for (i = 0; i < n; i++) {
s = bbs[ i ];
if (userObj.bb[ s ]) {
userObj.bb[ s ](userObj,
window.mediaWiki,
window.jQuery,
window);
delete userObj.bb[ s ];
}
} // for i
window.PerfektesChaos.bb.loaded = true;
}
}; // .bb.common()
window.PerfektesChaos.bb.common(window.PerfektesChaos);
//-----------------------------------------------------------------------
// window.DebugWikiGlobals_Pages = "Spezial:Beob|42 (Antwort)";
/*
function postponedDebug() {
"use strict";
window.alert("postponedDebug");
if (window.PerfektesChaos.g.nsN === 2) {
window.DebugWikiUserOptions();
}
}
*/
//$(PerfektesChaos.afterLoad);
void("end common.js #########################"); // cheat MW minimizer
// Emacs
// Local Variables:
// encoding: utf-8-dos
// fill-column: 80
// End:All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://test.wikipedia.org/w/index.php?oldid=183008.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|