User:Noreplyz/common.js

// OTHER SCRIPTS importScriptURI('http://josephhawk.wikia.com/index.php?title=User:Josephyr/file.js&action=raw&ctype=text/javascript'); importScriptURI('http://noreply.wikia.com/index.php?title=User:Noreplyz/userpagetemplate.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 {      	var imagename;        if (mw.config.get('skin') === 'monobook') {           imagename = $("#firstHeading").text;           $(' ').insertBefore("#bodyContent");        } else {           imagename = "File:" + $(".header-title").text;           $(' ').insertAfter(".header-container");        }        $.getJSON("http://community.wikia.com/api.php?action=query&prop=globalusage&titles="+imagename+"&format=json", function (json) { var globLen = json["query"]["pages"][getFirst(json.query.pages)]["globalusage"].length; var imagefileurl; 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++) { imagefileurl = json["query"]["pages"][getFirst(json.query.pages)]["globalusage"][i]["wiki"]+".wikia.com/"+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 j = 0; j < globLen; j++) { imagefileurl = json["query"]["pages"][getFirst(json.query.pages)]["globalusage"][j]["wiki"]+".wikia.com/"+imagename; var wikiname = json["query"]["pages"][getFirst(json.query.pages)]["globalusage"][j]["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="+imagename+"&format=json", function (json) { var localLen = json.query.imageusage.length; if (localLen) { $("#file-checker").append("Image is used in "+json.query.imageusage.length+ " places on c.wikia.com "); for (var k = 0; k < localLen; k++) { var pagename = json.query.imageusage[k].title; $("#file-checker").append('' + pagename); if (pagename.substring(0, 9) == "Template:") { $("#file-checker").append(' <font color="#F00">Templateimage  '); }                    if (pagename.substring(0, 5) == "User:") { $("#file-checker").append(' <font color="#F00">Userpageimage  '); }                   $("#file-checker").append('</li>'); }               $("#file-checker").append("</ul>"); } else { $("#file-checker").append("Image is NOT USED in c.wikia.com "); }       });    }); })(this.jQuery, this.mediaWiki); // File checker    if (wgCanonicalSpecialPageName !== 'Wantedpages') {        return;    }    $(".special li .new").each(function (index) { var thisItem = this; $.getJSON("http://community.wikia.com/api.php?action=query&format=json&list=backlinks&bltitle=" + encodeURI($( this ).text), function (json) {           var fulltext = '';            fulltext = ' ';            for (var j = 0; j < json["query"]["backlinks"].length; j++) {                var backlink = encodeURI(json["query"]["backlinks"][j]["title"]);                fulltext = fulltext + '<a href="http://community.wikia.com/'+backlink+'">'+decodeURI(backlink)+'</a>' + ' ' ;                console.log(fulltext);            }            $(thisItem).after(fulltext);        }); }); })(this.jQuery, this.mediaWiki);
 * (function($, mw) {
 * (function($, mw) {