User:Noreplyz/common.js

// OTHER SCRIPTS importScriptURI('http://josephhawk.wikia.com/index.php?title=User:Josephyr/file.js&action=raw&ctype=text/javascript');

// File checker function getFirst(obj) { for (var i in obj) return i; } if (mw.config.get("wgCanonicalNamespace") != 'File') { return; }   $(function {        $(' ').insertAfter(".header-container");        var imagename = $(".header-title").text;        $.getJSON("http://community.wikia.com/api.php?action=query&prop=globalusage&titles=File:"+imagename+"&format=json", function (json) { var globLen = json["query"]["pages"][getFirst(json.query.pages)]["globalusage"].length; if (globLen > 0) { if (globLen === 10) { $("#file-checker").append("Image is used in more than "+globLen+" other wikis "); for (var i = 0; i < globLen; i++) { var imagefileurl = json["query"]["pages"][getFirst(json.query.pages)]["globalusage"][i]["wiki"]+".wikia.com/File:"+imagename; var wikiname = json["query"]["pages"][getFirst(json.query.pages)]["globalusage"][i]["wiki"]; $("#file-checker").append(''+wikiname+''); }                   $("#file-checker").append(""); } else { $("#file-checker").append("Image is used in "+globLen+" other wikis "); for (var i = 0; i < globLen; i++) { var imagefileurl = json["query"]["pages"][getFirst(json.query.pages)]["globalusage"][i]["wiki"]+".wikia.com/File:"+imagename; var wikiname = json["query"]["pages"][getFirst(json.query.pages)]["globalusage"][i]["wiki"]; $("#file-checker").append(''+wikiname+''); }                   $("#file-checker").append(""); }           }            else { $("#file-checker").append("Image is NOT USED globally "); }       });        $.getJSON("http://community.wikia.com/api.php?action=query&list=imageusage&iutitle=File:"+imagename+"&format=json", function (json) { if (json.query.imageusage.length) { $("#file-checker").append("Image is used in "+json.query.imageusage.length+ " places on c.wikia.com "); } else { $("#file-checker").append("Image is NOT USED in c.wikia.com "); }       });    }); })(this.jQuery, this.mediaWiki);
 * (function($, mw) {