User:FINNER/common.js

/* FINNER/Test9 START */ $(function {   var url = window.location.href;    var sub = url.split("#").pop;    var sRegExInput = new RegExp(sub, "g");    url = url.replace(sRegExInput, "").replace(/#/g , "");    if (document.getElementById("collapse-global-hide2").innerHTML === "") {        hide2_jump = "";    } else {        hide2_jump = 'href="' + url + '#' + document.getElementById("collapse-global-hide2").innerHTML + '"';    }    if (document.getElementById("collapse-global-show2").innerHTML === "") {        show2_jump = "";    } else {        show2_jump = 'href="' + url + '#' + document.getElementById("collapse-global-show2").innerHTML + '"';    } //collapse all    $('#collapse-global-hide2').html('Collapse All'); //expand all $('#collapse-global-show2').html('Expand All'); });   /* FINNER/Test9 END */ ///////////////////////////////////////////////////////////////////////////////// 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 += " "+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; });