User:Andrewds1021/global.js

/********************* this comment is 80 characters long *********************/

if (!window.andrewds1021) { window.andrewds1021 = {}; } window.andrewds1021.oldAlert = alert; alert = function { console.log(new Error.stack); window.andrewds1021.oldAlert.apply(window, arguments); debugger; };

alert("loading personal global js");

/* check for Internet Explorer if found: load CSS corrections

if (["MSIE", "Trident/7."].some(function (arg) { return (navigator.userAgent.indexOf(arg) >= 0); })) {   var params = location.search.substr(1).split("&"); var num_params = params.length; var names = new Array(num_params); var values = new Array(num_params); var split = new Array(2); for (var i = 0; i < num_params; i++) { split = params[i].split("=", 2); names[i] = split[0]; values[i] = split[1]; }   var css_idx = names.indexOf("andrewds1021_ie11_css"); var js_idx = names.indexOf("andrewds1021_ie11_js"); if ((css_idx == -1) || (values[css_idx] != "no")) { importArticles({           type: "style",            article: "u:w:User:Andrewds1021/IE11.css"        }); }   if ((js_idx == -1) || (values[js_idx] != "no")) { if (!String.prototype.includes) { String.prototype.includes = function (str, idx) { "use strict"; if (typeof str !== "string") { return false; }               if (typeof idx !== "number") { idx = 0; }               return (this.indexOf(str, idx) != -1); };       }        if (!String.prototype.startsWith) { String.prototype.startsWith = function (str, idx) { "use strict"; if (typeof str !== "string") { return false; }               if (typeof idx !== "number") { idx = 0; }               if ((idx < 0) || (idx >= this.length)) { return false; }               return (this.indexOf(str, idx) == idx); };       } /*        if (!String.prototype.endsWith) { String.prototype.endsWith = function (str, idx) { "use strict"; if (typeof str !== "string") { return false; }               if (typeof idx !== "number") { idx = this.length; }               if ((idx < 0) || (idx >= this.length)) { return false; }               return (this.indexOf(str, idx) == this.length-str.length); };       }    } }

/* import JS scripts to be used on all wikis

importArticles({   type: "script",    articles: [        "u:dev:ToggleTestMode/code.js",        "u:dev:WhatLinksHere/code.js",        "u:transformers-legends:FormEditModifications.js"/*,        "u:transformers-legends:FullInterwikiMap.js",        "u:w:User:Andrewds1021/JS/CategoryCSS"*/,        "u:w:User:Andrewds1021/JS/UserAvatarLink"    ] });