User:Noreplyz/common.js

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

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 "+json["query"]["pages"][getFirst(json.query.pages)]["globalusage"].length+" other wikis "); } else { $("#file-checker").append("Image is used in "+json["query"]["pages"][getFirst(json.query.pages)]["globalusage"].length+" other wikis "); }           }            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) {