User:Andrewds1021/common.js

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

/* import JS scripts to be used on this wiki

if (mw.config.get("wgPageName") === "User:Andrewds1021/Test_Page") { importArticles({       type: "script",        articles: [            "u:dev:MediaWiki:TimeanddateClock.js",            "u:dev:Mediawiki:UserAvatarLink.js",            "u:dev:MediaWiki:UserLastActivity.js"        ]    }); }

(function {    "use strict";    if (window.andrewds1021 && window.andrewds1021.custom && window.andrewds1021.custom.covid19 && window.andrewds1021.custom.covid19.has_run) return;   if (!window.andrewds1021) {        window.andrewds1021 = {            custom: {                covid19: {}            }        };    } else if (!window.andrewds1021.custom) {        window.andrewds1021.custom = {            covid19: {}        };    } else if (!window.andrewds1021.custom.covid19) {        window.andrewds1021.custom.covid19 = {};    }    window.andrewds1021.custom.covid19.has_run = true;    jQuery.getJSON("https://corona.lmao.ninja/all", function (data) { Array.prototype.slice.call(document.querySelectorAll( ".COVID19Data")).forEach(function (value) {           var stat = value.getAttribute("data-covid19-stat");            if (stat && data[stat]) {                value.textContent = data[stat];            } else {                value.textContent = data.cases;            }        }); }); });