Difference between revisions 147611 and 155946 on testwikivoid("PerfektesChaos@test/common.js 2012-10-15"); // cheat MW minimizer var suffix = "?action=raw" + "&ctype=text/javascript" + "&maxage=0&smaxage=0" + "&title=" + "user:PerfektesChaos/js/"; var script = mw.config.get("wgServer") + mw.config.get("wgScript") + script; var scriptest = "https://test.wikipedia.org/w/index.php" + suffix; var scriptmw = "https://www.mediawiki.org/w/index.php" + suffix; //----------------------------------------------------------------------- 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-09-25 "use strict"; var s; var wc; if (typeof(assign) === "object") { if (assign) { if (assign.loud !== undefined) { if (assign.loud) { if (typeof(assign.max) !== "number") { assign.max = 20; } if (typeof(assign.man) !== "number") { assign.man = 0; } if (typeof(assign.say) === "string") { s = assign/common.js 2013-01-12"); // cheat MW minimizer /// <nowiki> /*jshint curly: true, laxbreak: true, strict: true, trailing: true, white: false */ /*global jQuery: false, mw: false, Geo: false, debug: true, wikEd: false, window: false, document: false */ /*jslint forin: true, plusplus: true, regexp: true, sloppy: true, unparam: true, vars: true, white: true, maxerr: 50 */ /*globals jQuery: false, mw: false, Geo: false, debug: true, wikEd: false, window: false, document: false */ 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 "use strict"; 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 = window.console; if (typeof(wc) === "object") { s = s + applyshow; switch (action) { case 1 : if (typeof(wc.debug) === "function") { wc.debug(s); break; } case 2 : // if (typeof(wc.info) === "function") { wc.info(s); break; } case 3 : // if (typeof(wc.warn) === "function") { wc.warn(s); break; } case 4 : // if (typeof(wc.error) === "function") { wc.error(s); break; } default : // if (typeof(wc.log) === "function") { wc.log(s); } } // switch action if (add) { switch (typeof(add)) { case "function" : case "object" : if (typeof(wc.dir) === "function") { wc.dir(add); break; } case "string": // if (typeof(wc.debug) === "function") { wc.debug(add); break; } default : // if (typeof(wc.trace) === "function") { wc.trace(); break; } else { wc.log(add); } } // switch typeof(add) } if (action) { if ( ! assignopt.man && typeof(action) === "number") { if (action > 2) { window.alert("Firebug console"); assign.man = -1; } } } } else { // Fallback if (typeof(assign.man) !== "number") { assign.man = -1; } if (assign.man > assign.max) { assign.loud = false; } else { assign.man++; s = s + " #" + assignif (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(applyshow) !== "number") { s = s + "\n" + applyshow; } if ( ! window.confirm(s) ) { assignopt.loud = false; } } } } // assign.loud } // typeof assign.loud } // assign } // assign object }; // mw.log() //----------------------------------------------------------------------- window.debugging = { loud: true, say: "## (test.PC) ##" }; mw.libs.paneMarker = { opt: { lazy: true, leave: true, xlowChar: false } }; //mw.libs.paneMarker.opt.faviconICO="https://secure.wikimedia.org/favicon.ico"; //mw.libs.paneMarker.opt.faviconICO="//meta.wikimedia.org/favicon.ico"; mw.loader.load(scriptmw + "paneMarker/r.js", "text/javascript"); /* mw.loader.using( [ "mediawiki.util" ], function() { mw.loader.load("//test.wikipedia.org/w/index.php?title=" + "User:PerfektesChaos/js/purgePortlet.js" + "&action=raw&ctype=text/javascript&maxage=60&smaxage=3600&vsn=0.1", "text/javascript"); } ); */ /* if (mw.config.get("wgAction")==="edit" || mw.config.get("wgAction")==="submit") { alert("pre "+mw.config.get("wgAction")); } */ if (mw.config.get("wgIsArticle")||1) { wgPageName = mw.config.get("wgPageName"); if (wgPageName.substr(-3, 3) === ".js") { if (wgPageName.substr(0, 23) === "User:PerfektesChaos/js/" || wgPageName.substr(0, 37) === "User:PerfektesChaos/versionControl.js") { if (mw.config.get("wgAction")==="edit" || mw.config.get("wgAction")==="submit") { alert(mw.config.get("wgAction")); } mw.libs.versionControl = { proj: { testwiki: {PerfektesChaos: {}} } }; mw.loader.load("//test.wikipedia.org/w/index.php?title=" + "User:PerfektesChaos/js/versionControl/d.js" + "&action=raw&ctype=text/javascript" + "&maxage=60", "text/javascript"); } } } mw.libs.resultListSort = { auto: true }; mw.loader.load(scriptmw + "resultListSort/d.js", "text/javascript"); void("end common.js #########################"); // cheat MW minimizeropt.loud } // typeof opt.loud } // opt object } // opt }; // mw.log() //----------------------------------------------------------------------- window.PerfektesChaos = { bb: { }, mw_libs: mw.libs }; //----------------------------------------------------------------------- window.PerfektesChaos.bb.init = function (userObj) { // 2012-09-25 "use strict"; userObj.cnf = { script: "javascript" }; userObj.debugging = { wg: debug, loud: true, max: 10, man: 0, say: "~PC~" }; userObj.g = { }; window.debugging = { loud: true, say: "##??? (PC) ???##" }; mw.config.set("debug", 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 = 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 = document.getElementById("editform"); if (userObj.cnf.form_Edit) { button = userObj.cnf.form_Edit.wpSave; if (button) { if (typeof(action) === "function") { confirm = 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 // 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.base // < .debugging.debug // < .load.DISK // < debug // .flop() // .load.server.fetch() // .load.js.fun() // jQuery.cookie() // 2012-11-02 var got; var p; var re; var script; var setting = jQuery.cookie("load.base"); var sub; var swift = jQuery.cookie("local.path"); userObj.debugging.debug = userObj.flop( jQuery.cookie("wgDebug") ); if (userObj.debugging.debug) { userObj.debugging.debug = true; } debug = userObj.debugging.debug; userObj.load.server.fetch("en"); userObj.load.server.fetch("de"); userObj.load.server.fetch("test"); userObj.load.server.fetch("mw"); userObj.magic = 799; if (typeof(setting) !== "string") { setting = ""; } if (typeof(swift) === "string") { userObj.load.DISK = swift; } for (script in userObj.load.base) { p = userObj.load.base[script]; if (typeof(p.js) === "object") { re = new RegExp("~" + script + "_([-a-z:0]+/?)~", ""); got = re.exec(setting); if (got) { sub = userObj.flop(got[1]); p.js.SET = sub; } else { sub = p.js.STD; } 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 = userObj.load.js[ sub[0] ] + script; if (sub[1] !== "*") { p.js.WEB += "/" + sub[1]; } p.js.WEB += userObj.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(userObj.load.DISK) === "string") { p.js.DISK = sub + ".js"; sub = "file:/"; } else { sub = "no local.path"; mw.log(userObj.debugging, ".fetch() no local.path", 3); } } break; default : mw.log(userObj.debugging, ".fetch() Unknown: " + script + " " + sub, 3); sub = "*Unknown*"; } // switch typeof(sub) } p.js.USE = sub; } } // script in base[] if (typeof( jQuery.cookie("wikEdDiff") ) === "string") { userObj.load.js.fun("Cacycle/wikEdDiff"); } if (userObj.load.DISK) { userObj.load.file(userObj.load.DISK + "proj/user-common.css"); } else if (userObj.g.client.name === "firefox") { window.alert("DISK: local.path"); } }; // .fetch() }; // .bb.init() window.PerfektesChaos.bb.init(window.PerfektesChaos); delete window.PerfektesChaos.bb.init; //----------------------------------------------------------------------- window.PerfektesChaos.bb.load = function (userObj) { // 2012-09-25 "use strict"; userObj.load = { ready: false, path: "/w/index.php?title=", scheme: window.location.protocol + "//", server: { }, css: { path: userObj.g.name + "/css/", suffix: ".css&action=raw&ctype=text/css" }, js: { path: userObj.g.name + "/js/", suffix: ".js&action=raw" + "&ctype=text/javascript" } }; 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 // 2012-12-23 this.base = { "autoBackup": {}, "ClicksDivertimento": {}, "codeEditor": {}, "DebugWikiGlobals": {}, "defekterWeblinkBotVorlage": {}, "editToolStrIns": {}, "fileAdm": {}, "importUtility": {}, "lightSpoof": {}, "localEdit": {}, "paneMarker": {}, "resultListSort": {}, "ScanPages": {}, "ToolboxAddItems": {}, "userSubpages": {}, "Utilities": {}, "WikiSyntaxTextMod": {}, "wikEd": {}, "wikEdDiff": {} }; this.base.autoBackup.js = { "STD": "file:/", "file:/": false, "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:/": false, "de": ["de", "r"] }; this.base.editToolStrIns.js = { "STD": "mw", "mw": ["mw", "debug"], "file:/": false, "test": ["test", "d"] }; this.base.fileAdm.js = { "STD": false, "file:/": false, "test": ["test", "d"] }; this.base.importUtility.js = { "STD": false, "file:/": false, "test": ["test", "d"] }; this.base.lightSpoof.js = { "STD": "de", "de": ["de", "*"] }; this.base.localEdit.js = { "STD": false, "file:/": false, "test": ["test", "d"], "en": ["en", "d"] }; this.base.paneMarker.js = { "STD": "mw", "test": ["test", "r"], "mw": ["mw", "r"] }; this.base.resultListSort.js = { "STD": "file:/", "file:/": false, "mw": ["mw", "r"], "test": ["test", "d"], "en": ["en", "d"] }; this.base.ScanPages.js = { "STD": "test", "test": ["test", "d"], "en:d": ["en", "d"] }; this.base.ToolboxAddItems.js = { "STD": "en:x", "en:d": ["en", "d"], "en:r": ["en", "r"], "en:x": ["en", "x"] }; this.base.userSubpages.js = { "STD": false, "file:/": false }; this.base.Utilities.js = { "STD": "en:x", "en:d": ["en", "d"], "en:x": ["en", "x"] }; 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": "en", "en": "*" }; this.base.wikEdDiff.js = { "STD": "en", "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 = document.createElement("script"); domEl.setAttribute("type", "text/javascript"); domEl.setAttribute("src", "file:/" + apply); 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) { document.write(stack); } } else { r = false; } return r; }; // .load.files() }; // .bb.load() window.PerfektesChaos.bb.load(window.PerfektesChaos); delete window.PerfektesChaos.bb.load; //----------------------------------------------------------------------- window.PerfektesChaos.bb.js = function (userObj) { // 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() // .load.files() // mw.loader.load() // 2012-09-25 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.WEB) { script = p.js.WEB; } else if (p.js.DISK) { userObj.load.files(p.js.DISK); script = false; } } } 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(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" }, "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-11 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(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.DISK // .flop() // .load.files() // .load.js.fun() // 2012-12-13 var pars = { expires: 365, path: "/" }; var ud = { load: false, name: "WikiSyntaxTextMod_UserDef", page: "!UD" }; var val; var WSTM; mw.libs.WikiSyntaxTextMod = { }; WSTM = mw.libs.WikiSyntaxTextMod; WSTM.config = { data: { }, diffPage: true, lang: { }, load: { }, page: { }, portlet: { } }; 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.load.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) { 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) { if (userObj.load.DISK) { ud.load = true; userObj.load.files(val + ".js"); } } if (userObj.g.pageName === "Wikipedia:Spielwiese") { this.fun("ToolboxAddItems"); } 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:" ], 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.lang.accept = "de"; if (! ud.load) { this.fun("WikiSyntaxTextMod"); } } }; // .load.js.wstm() }; // .bb.js() window.PerfektesChaos.bb.js(window.PerfektesChaos); delete window.PerfektesChaos.bb.js; //----------------------------------------------------------------------- window.PerfektesChaos.bb.run = function (userObj) { // 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 // > .g.nsN // > .g.isArticle // > .g.title // > .dbName // >< .g.isEditing // >< .cnf.lightSpoof // >< .cnf.wikEd // < .g.client // < .g.isResource // < .g.isDiffPossible // jQuery.client.profile() // .fetch() // .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-01-12 this.g.client = jQuery.client.profile(); if (! this.g.client) { this.g.client = { }; } this.fetch(); window.PerfektesChaos_Utilities = this.afterLoad; 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 (this.g.nsN === 0) { this.load.js.fun("defekterWeblinkBotVorlage"); this.load.js.fun("ToolboxAddItems"); } else if (this.g.nsN === -1) { this.load.js.fun("resultListSort"); } else if (this.g.nsN === 2) { this.load.js.fun("localEdit"); this.load.js.fun("userSubpages"); } 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 CSS 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.isEditing) { if (this.g.isResource) { this.load.js.codeEditor(); } else { if (this.g.client.layout === "gecko") { window.wikEd = { config: { } }; window.wikEd.config.filePreview = false; this.load.js.fun("Cacycle/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.js.fun("Schnark:diff"); } this.load.js.wstm(); this.load.js.fileAdm(); this.cnf.filthy(); jQuery(document).ready(this.further); }; // .first() mw.loader.using( [ "jquery.async", "jquery.client", "jquery.cookie" ], userObj.fire ); userObj.further = function () { // Do something after loading // Precondition: // document load ready // Uses: // > .g.dbName // > .load.DISK // .load.file() // .cnf.flat() // .cnf.force() // Remark: Used as event handler -- 'this' is not userObj // 2012-12-08 userObj.load.ready = true; if (userObj.load.DISK) { userObj.load.file(userObj.load.DISK + "proj/shared.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.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.run(window.PerfektesChaos); delete window.PerfektesChaos.bb.run; //----------------------------------------------------------------------- // 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-1-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=155946.
![]() ![]() 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.
|