User:Tomas9970/common.js

// START Randomize wiki logo /*$(function {   var images = [      'https://vignette.wikia.nocookie.net/frozen/images/0/02/Wiki_Logo_-_Anna.png/revision/latest?cb=20200512230902',      'https://vignette.wikia.nocookie.net/frozen/images/7/78/Wiki_Logo_-_Elsa.png/revision/latest?cb=20200512230953',      'https://vignette.wikia.nocookie.net/frozen/images/d/da/Wiki_Logo_-_Hans.png/revision/latest?cb=20200512231012',      'https://vignette.wikia.nocookie.net/frozen/images/f/f6/Wiki_Logo_-_Kristoff.png/revision/latest?cb=20200512231024',      'https://vignette.wikia.nocookie.net/frozen/images/2/24/Wiki_Logo_-_Marshmallow.png/revision/latest?cb=20200512231042',      'https://vignette.wikia.nocookie.net/frozen/images/f/fb/Wiki_Logo_-_Olaf.png/revision/latest?cb=20200512231053',      'https://vignette.wikia.nocookie.net/frozen/images/0/0a/Wiki_Logo_-_Sven.png/revision/latest?cb=20200512231057',    ];    $('.wds-community-header__wordmark img').attr('src', images[Math.floor(Math.random * images.length)]); });*/ // END Randomize wiki logo

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:AjaxDiff/code.js',    ] });

// Display images from external source // usage:  // order of arguments doesn't matter //Width and alignment are optional. In case the image URL is missing, it will print out an error $(function {   //create a list of external images on a page    var images = document.getElementsByClassName("ExtImage");    //go through each of the images and process it to make it visible    for (a = 0; a < images.length; a++)     {        //split arguments of each image        //arguments are stored in data-args attribute of the span element        var args = images[a].dataset.args.split(" ");        console.log("args: " + args);        //define properties that will be applied to the image as it is displayed        //these variables also contain default values that will be used in case no other are specified        var source = "";        var width = 250;        var align = "right";        //go through each of the arguments, identify it's type and set the properties above as specified        for (b = 0; b < args.length; b++)        {            //if the argument is "left" or "right", it specifies the alignment of the image if(args[b] == "left" || args[b] == "right") {               align = args[b]; }           //otherwise if an argument can be parsed, it's a number that specifies the width of the image. //!!!!! This if always returns true !!!!! else if(parseInt(args[b], 10) != isNaN) {               width = parseInt(args[b], 10); }           //otherwise if an argument does not meet any above criteria, it's probably a link to the image itself //check is still required to handle any blank entry else if(args[b] !== "") {               source = args[b]; }       }        //change content of the HTML span to the image with a hyperlink //if the image source is not blank, change content of the HTML span to the image with a hyperlink //template to follow ; if(source !== "") {           images[a].innerHTML = " "; }       //otherwise change content of the span to an error message else {           images[a].innerHTML = " External image error. No source specified "; }       console.log("source:" + source); console.log("width:" + width); console.log("align:" + align); } });

console.log("page: " + wgPageName);