User:FINNER/common.js

/* FINNER/Test10 START */ //expand all $(function {   var url = window.location.href;    var sRegExInput = new RegExp(url.split("#").pop, "g");    url = url.replace(sRegExInput, "").replace(/#/g , "");    var show_jump2 = "";    var show_all = document.getElementsByClassName("collapse-global-show");    for (i = 0; i < show_all.length; i++ ) {        show_all[i].id = "_" + i;        if (show_all[i].innerHTML !== "") {            show_jump2 = 'href="' + url + '#' + show_all[i].innerHTML + '"';        }        $("#_" + i).html('Expand All');    } });

//collapse all $(function {   var url = window.location.href;    var sRegExInput = new RegExp(url.split("#").pop, "g");    url = url.replace(sRegExInput, "").replace(/#/g , "");    var hide_jump2 = "";    var hide_all = document.getElementsByClassName("collapse-global-hide");    for (i = 0; i < hide_all.length; i++ ) {        hide_all[i].id = "hide_all_" + i;        if (hide_all[i].innerHTML !== "") {            hide_jump2 = 'href="' + url + '#' + hide_all[i].innerHTML + '"';        } else {            hide_jump2 = 'href="' + url + '#_' + i + '"'        }        $("#hide_all_" + i).html('Collapse All');    } }); /* FINNER/Test10 END */

/////////////////////////////////////////////////////////////////////////////////   /* FINNER/Dupes START *

dil = new Array; function findDupImages(gf) { output = ""; url = "/api.php?action=query&generator=allimages&prop=duplicatefiles&gailimit=5000&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 += " "+pages[pageID].title+" \n\n"; for (x=0;xFile:"+pages[pageID].duplicatefiles[x].name+"\n"; dil.push("File:"+pages[pageID].duplicatefiles[x].name.replace(/_/g," ")); } output += "\n\n"; } } $("#mw-dupimages").append(output); if (data["query-continue"]) setTimeout("findDupImages('"+data["query-continue"].allimages.gaifrom+"');",5000); } }); } $(function { if ($("#mw-dupimages").length) findDupImages; });

/* FINNER/Dupes END */