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'); $(' Oasis').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="/index.php?title='+encodeURIComponent(wgPageName)+'&useskin=wikia">oasis</a></li>').appendTo('#p-cactions > .pBody > ul'); } //

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; });