User:Staffan15/global.js

function fixBlogLinks { rclist = ($("#mw-rc-subentries-0").length)?$("#bodyContent > div > table:contains('Blog comment')"):$("#bodyContent ul.special li:contains('Blog comment')"); if (wgPageName == "Special:RecentChanges") rclist.each(function (i) { lnk = $(this).find("a:contains('hist')").attr("href"); if (typeof(lnk) != "undefined") { rawID = lnk.replace(/.*curid=(.*?)&.*/,"$1"); $(this).find("a:contains('User blog:')").attr("href","/wiki/User_blog:" + lnk.replace(/.*User_blog_comment:(.*?\/.*?)\/.*/,"$1") + "#comm-" + rawID); } }); } function fbl { fixBlogLinks; $("#bodyContent").bind("ajaxPageLoad",fixBlogLinks); } addOnloadHook(fbl);

// if( wgNamespaceNumber != -1 && !window.SkinSwitchLoad  ) { addOnloadHook( addSkinSwitchButton ); } var SkinSwitchLoad = true; // prevent duplication

function addSkinSwitchButton { $(' Monobook').appendTo('#page_controls'); $(' Monaco').appendTo('#page_controls'); $(' Monaco (wiki default)').appendTo('#page_controls'); $(' Dev Cookie').appendTo('#page_controls'); $(' <a id="ca-skins" href="/index.php?title='+encodeURIComponent(wgPageName)+'&useskin=wikia" rel="nofollow">Oasis</a></li>').appendTo('#page_controls'); $('<a href="/index.php?title='+encodeURIComponent(wgPageName)+'&useskin=monaco&usetheme=sapphire">monaco</a></li>').appendTo('#p-cactions > .pBody > ul'); $('<a href="/index.php?title='+encodeURIComponent(wgPageName)+'&useskin=monaco&usetheme=custom">monaco default</a></li>').appendTo('#p-cactions > .pBody > ul'); $('<a href="http://c.wikia.com/wiki/Special:DevCookie">devcookie</a></li>').appendTo('#p-cactions > .pBody > ul'); $('<a href="/index.php?title='+encodeURIComponent(wgPageName)+'&useskin=wikia">oasis</a></li>').appendTo('#p-cactions > .pBody > ul'); if (encodeURIComponent(wgNamespaceNumber) == 0 || encodeURIComponent(wgNamespaceNumber) == 4) { if (encodeURIComponent(wgCanonicalNamespace) != "Project") { $('<a href="/wiki/Project:'+encodeURIComponent(wgPageName)+'" class="">3 tabs test</a></li>').appendTo('#page_tabs'); } else { $('<a href="/wiki/Project:'+encodeURIComponent(wgPageName)+'" class="selected">3 tabs test</a></li>').appendTo('#page_tabs'); document.getElementById("ca-nstab-project").setAttribute("class", ""); } } } //

dil = new Array; function findDupImages(gf) { output = ""; url = "/api.php?action=query&generator=allimages&prop=duplicatefiles&gailimit=500&format=json"; if (gf) url += "&gaifrom=" + gf; $.getJSON(url,function (data) { if (data.query) { pages = data.query.pages; for (pageID in pages) { dils = ","+dil.join; if (dils.indexOf(","+pages[pageID].title) == -1 && pages[pageID].title.indexOf("File::") == -1 && pages[pageID].duplicatefiles) { output += " <a href='/" + pages[pageID].title + "'>"+pages[pageID].title+"</a> \n<ul>\n"; for (x=0;x<pages[pageID].duplicatefiles.length;x++) { output += "<a href='/File:" + pages[pageID].duplicatefiles[x].name + "'>File:"+pages[pageID].duplicatefiles[x].name+"</a></li>\n"; dil.push("File:"+pages[pageID].duplicatefiles[x].name.replace(/_/g," ")); } output += "</ul>\n\n" } } $("#mw-dupimages").append(output); if (data["query-continue"]) setTimeout("findDupImages('"+data["query-continue"].allimages.gaifrom+"');",5000); } }); } $(function { if ($("#mw-dupimages").length) findDupImages; });