Difference between revisions 158141 and 183008 on testwikivoid("PerfektesChaos/common.js 2013-02-18"); // 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 debug: true, window: false, document: false */ /*jslint forin: true, plusplus: true, regexp: true, sloppy: true, unparam: true, vars: true, white: true, maxerr: 50 */ /*globals debug: true, window: false, document: false */ // ==UserScript== // @include http://de.wikipedia.org/* // @include http://de.wikisource.org/* // ==/UserScript==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 (contracted; show full) opt.man = 0; } if (typeof(opt.say) === "string") { s = opt.say + " "; } else { s = ""; } wc = win dow.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 (window.PerfektesChaos.g.client) { if (window.PerfektesChaos.g.client.name === "firefox") { window.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 ( ! window.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) { // 20123-09-254-14 "use strict"; userObj.cnf = { script: "javascript" }; userObj.debugging = { wg: win.debug, loud: true, max: 10, man: 0, say: "~PC~" }; userObj.g = { }; window.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 (contracted; show full) // >< .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; var, 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 = window.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 // > .load.js.lockcal.lock // >< .local.storage // >< .load.base // < .debugging.debug // < .load.js.DISK // < win.debug // jQuery.cookie()⏎ // .flop() // .load.server.fetch() // .load.js.fun() // jQuery.cooki.local.file() // 2013-02-189-04 var got; var p; var re; var script; var setting = jQuery.cookie("load.base")""; var sub; if (! this.load.DISKcal.storage) { sub = jQuery.cookiewin.localStorage.getItem("local.path"); if (typeof(sub) === "string") { this.load.DISKcal.storage = sub; } else if (this.g.client.name === "firefox") { window.alert("DISK: local.path"); }⏎ } 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; if (typeof(setting) !== "string") { setting = ""; }⏎ 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.loadcal.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.load.DISKcal.storage) === "string") { p.js.DISK = sub + ".js"; sub = "file:/"; } else if (! this.loadcal.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.load.DISK) { this.load.file(this.load.DISKcal.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-02-078-24 "use strict"; if ( ! userObj.load ) { userObj.load = { }; } userObj.load.ready = false; userObj.load.path = "/w/index.php?title="; userObj.load.scheme = window.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-02-1810-02 this.base = { "autoBackup": {}, "ClicksDivertimento": {}, "codeEditor": booksourcesDirect": {}, "ClicksDivertimento": {}, "editorContent": {}, "DebugWikiGlobals": {}, "defekterWeblinkBotVorlage": {}, "editToolStrIns": {}, "fileAdm": {}, "importUtility": {}, "lightSpoof": {}, "listPageOptions": {},⏎ "localEdit": {}, "paneMarker": {}, "preferencesGadgetOptions": {},⏎ "resultListSort": {}, "ScanPages": {}, "ToolboxAddItems": {}, "userspaceLinks": {}, "Utilities": {}, "watchlistTools":Categories": {}, "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.codeEditor.js = { "STD": false, "mw": ["mw", "*"] };⏎ 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, "test": ["test", "d"],⏎ "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.watchlistTools.js = { "STD": "en:r", "file:/": true, "en:d":Categories.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(); userObj.load.file = function (apply) { // Load script if document ready, or prepare statement // Precondition: // apply -- (local) path // Postcondition: // Return string, with HTML statement to be written // or SPC if already appended // or "" if nothing done // Uses: // > .load.ready // mw.html.element() // jQuery() // Using ideas from: mw.loader::addScript() // 2012-02-20 var domEl; var r = ""; if (apply.slice(-3) === ".js") { if (userObj.load.ready) { domEl = window.document.createElement("script"); domEl.setAttribute("type", "text/javascript"); domEl.setAttribute("src", "file:/" + apply); window.document.body.appendChild(domEl); r = " "; } else { /* r = mw.html.element("script", { "type": "text/javascript", "src": "file:/" + apply, "charset": "iso-8859-1"}, ""); */ jQuery("head").append( jQuery("<script/>", { "type": "text/javascript", "src": "file:/" + apply, "async": "async", "charset": "iso-8859-1"} ) ); } } else if (apply.slice(-4) === ".css") { jQuery("head").append( jQuery("<link/>", { "rel": "stylesheet", "type": "text/css", "href": "file:/" + apply, "charset": "iso-8859-1"} ) ); } return r; }; // .load.file() userObj.load.files = function (apply) { // Try to load resources from local environment // Precondition: // apply -- identifier string, or Array with identifiers // Postcondition: // Return local file path if available and loading // Uses: // > .load.DISK // .load.file() // jQuery.isArray() // jQuery.trimLeft() // Using ideas from: mw.loader::addScript() // 2012-03-07 var i; var r = this.DISK; var s; var stack; if (r) { s = typeof(apply); stack = ""; if (s === "string") { stack = this.file(r + apply); } else if (s === "object") { if (jQuery.isArray(apply)) { for (i = 0; i < apply.length; i++) { s = apply[i]; if (typeof(s) === "string") { stack = stack + this.file(r + s); } } // for i } } if (jQuery.trimLeft(stack).length) { window.document.write(stack); } } else { r = false; } return r; }; // .load.files()⏎ ⏎ ⏎ ⏎ }; // .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() // .loadcal.files() // mw.loader.load() // 2013-02-108-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; case "codeEditor" : script = userObj.load.server[ userObj.load.base[ add ] ] + userObj.load.path + "MediaWiki:Gadget-CodeEditor"; use = [ "jquery.ui.resizable", "jquery.wikiEditor" ]; break;⏎ } // switch add if (script) { script = script + this.suffix; } else { if (p) { if (p.js) { if (p.js.DISK && ! userObj.loadcal.lock) { userObj.loadcal.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.codeEditor = function () { // Uses: // > .g.isResource // > .load.base // > .load.base.*.js // > .load.server // > .load.path // > .load.js.suffix // mw.loader.using() // 2012-06-05 var script; var src; if (userObj.g.isResource) { src = userObj.load.base.codeEditor.js.USE; if (src) { jQuery(window.document).ready( function () { // this.fun("codeEditor") script = userObj.load.server[src[0]] + userObj.load.path + "MediaWiki:Gadget-CodeEditor" + userObj.load.js.suffix; // "worker-javascript.js" mw.loader.using( [ "jquery.ui.resizable", "jquery.wikiEditor" ], function () { mw.loader.load(script, "text/javascript"); } ); } ); } } }; // .load.js.codeEditor()⏎ ⏎ ⏎ ⏎ 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" }, (contracted; show full) 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 dow.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 // > .load.DISKcal.storage // > .g.nsN // .flop() // .load.files() // .load.js.fun() // 2013-02-06 var pars = { expires: 365, path: "/" }; var ud = { name: "WikiSyntaxTextMod_UserDef", page: "!UD" }; var val; var WSTM; mw.libs.WikiSyntaxTextMod = { };cal.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.loadcal.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"; (contracted; show full) ":dewiki:Wikipedia:Löschkandidaten/", ":dewiki:Wikipedia:Meinungsbild", ":dewiki:Wikipedia:Projekt", ":dewiki:Wikipedia:Redaktion ", ":dewiki:Wikipedia:.*Redundanz/", ":dewiki:Wikipedia:WikiProjekt" ] }; WSTM.config.warn = { "tag": { "big": true, "blockquote": true, "center": true, "u": true } }; if (userObj.g.pageName === "Wikipedia:Spielwiese") { this.fun("ToolboxAddItems"); } val = userObj.flop(jQuery.cookie(ud.name)); if (val) { if (val.charCodeAt(0) === 45) { val = false; } else if (val === "?" || val === "!" || val === "/") { val = ud.page; jQuery.cookie(ud.name, val, pars); } } if (val && userObj.load.DISK) { userObj.load.files(val + ".user.js"); } if (userObj.bb.wstmcnf) { userObj.bb.wstmcnf(WSTM); } thi}; 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 = window.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 // < .loadcal.lock // < .g.isResource // < .g.isDiffPossible // jQuery.client.profile() // .fetchmw.util.getParamValue() // .fetch() // .local.file() // .load.js.fun() // .load.js.autoBackup() // .isNamespace() // .isEditPermitted() // .load.js.codeEditor()⏎ // .load.js.editToolStrIns() // .load.js.wstm() // .load.js.fileAdm() // .cnf.filthy() // jQuery, mw, document // 2013-02-169-28 var re, special; this.g.client = jQuery.client.profile(); if (! this.g.client) { this.g.client = { }; } this.load.lock = (this.g.client.layout !== "gecko"); this.fetch(); window.PerfektesChaos_Utilities = this.afterLoad; if (userObj.load.DISK) { if (! userObj.load.xz) { userObj.load.file(userObj.load.DISK + "projcal.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 } }; 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.nsN === 0) { if (this.g.dbName === "dewiki") { this.load.js.fun("defekterWeblinkBotVorlage"); } this.load.js.fun("ToolboxAddItems"); } else if (this.g.nsN === -1) { this.load.js.fun("resultListSort"); this.load.js.fun("watchlistTools"); } else if (this.g.nsN === 2) { this.load.js.fun("localEdit"); } 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 % 2 === 0); } // suppress JavaScript and CSSswitch (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.isResource) { if (this.g.dbName === "enwiki") { mw.util.addCSS("#ca-ve-edit{display:none"); } } if (this.g.isEditing) { if (this.g.isResource) { this.load.js.codeEditor(); } else if (this.g.client.name !== "opera") { window.wikEd = { config: { } }; windownsN >= 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.load.lock) { this.load.js.fun("Schnark:diff"); } if (this.g.nsN % 2 === 0) { this.load.js.wstm(); } if ( this.isNamespace( [ -1, 2, 4, 6, 14, 100 ] ) ) { this.load.js.fileAdm(); } this.cnf.filthy(); jQuery(window.document).ready(this.further); }; // .first() mw.loader.using( [cal.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: // > .load.DISKcal.storage // > .load.xz // > .g.dbName // < .load.ready // .loadcal.file() // .cnf.flat() // .cnf.force() // Remark: Used as event handler -- 'this' is not userObj // 2013-02-07 userObj.load.ready = true; if (userObj.load.DISK) { if (! userObj.load.xz) { userObj.load.file(userObj.load.DISK + "proj/after.js"); } } if (userObj.g.isEditing) { /* if (jQuery.client) { if (jQuery.client.layout === "gecko") { if (typeof(window.wikEd) !== "object") { window.wikEd = { config: { } }; } window.wikEd.config.filePreview = false; if (userObj.g.isResource) { window.wikEd.useWikEd = false; } } } */ if (userObj.g.dbName === "dewiki" && ! userObj.load.xz) { 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, mw, jQuery) { // 2013-02-06 "use strict"; var bbs = [ "mw", "cnf", "load", "js", "run" ]; var i; var n = bbs.length; var s; for (i = 0; i < n; i++) { s = bbs[ i ]; if (userObj.bb[ s ]) { userObj.bb[ s ](userObj, mw, jQuery); delete userObj.bb[ s ]; } } // for i }; // .bb.common() if (window.mediaWiki) { window.PerfektesChaos.bb.common(window.PerfektesChaos, window.mediaWiki, window.jQuery); } // mediaWikical.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: iso-8859-1utf-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?diff=prev&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.
|