User:Andrewds1021/global.js

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

/* 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")) { /*       helper functions */       function isNegativeZero(num) { "use strict"; return (typeof num === "number") && (num == 0) && ((1/num) == -Infinity); }       /*        string functions based on: Google Chrome 74.0.3729.169 */       if (!String.prototype.includes) { String.prototype.includes = function (str, idx) { "use strict"; return (this.indexOf(str, idx) != -1); };       }        if (!String.prototype.startsWith) { String.prototype.startsWith = function (str, idx) { "use strict"; if ((typeof idx !== "number") || (idx < 0)) { idx = 0; }               return (this.indexOf(str, idx) == Math.floor(idx)); };       }        if (!String.prototype.endsWith) { String.prototype.endsWith = function (str, idx) { "use strict"; if (typeof str !== "string") { return false; }               if (str === "") { return true; }               var idx_type = typeof idx; if ((idx_type !== "number") && (idx_type !== "undefined")) { return false; }               if ((idx_type === "undefined") || (idx > this.length)) { idx = this.length; }               idx = idx - str.length; if (idx < 0) { return false; }               return (this.lastIndexOf(str, idx) == Math.floor(idx)); };       }        /*        math functions based on: ES 6 specifications */       if (!Math.trunc) { Math.trunc = function (num) { if ((typeof num !== "number") || (num == NaN)) { return NaN; }               if (num > 0) { return Math.floor(num); }               if (num < 0) { return Math.ceil(num); }               if (isNegativeZero(num)) { return -0; }               return 0; };       }        if (!Math.sign) { Math.sign = function (num) { if ((typeof num !== "number") || (num == NaN)) { return NaN; }               if (num > 0) { return 1; }               if (num < 0) { return -1; }               if (isNegativeZero(num)) { return -0; }               return 0; };       }    } }

/* 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/UserAvatarLink",        "u:w:User:Andrewds1021/JS/UserLastActivity"    ] });