Welcome to Assassin's Creed Wiki! Log in and join the community.
User:Vatsa1708/wikia.js: Difference between revisions
Jump to navigation
Jump to search
imported>Vatsa1708 mNo edit summary |
imported>Vatsa1708 m -_- |
||
| Line 1: | Line 1: | ||
/* ######################################################################## */ | /* ######################################################################## */ | ||
/* ### DUPLICATE FILE LIST ### */ | /* ### DUPLICATE FILE LIST ### */ | ||
Revision as of 15:19, 14 September 2011
/* ######################################################################## */
/* ### DUPLICATE FILE LIST ### */
/* ### ---------------------------------------------------------------- ### */
/* ### Description: Finds duplicate files on the wiki. ### */
/* ### Credit: User:pcj (http://www.wowpedia.org) ### */
/* ######################################################################## */
function findDupFiles(gf) {
var fileDiv = $('#mw-dupfiles');
if (fileDiv.length) {
dil = new Array();
ajaxIndicator = stylepath + '/common/progress-wheel.gif';
output = '';
url = '/api.php?action=query&generator=allimages&prop=duplicatefiles&gailimit=500&format=json';
if (!($('#dupFilesProgress').length)) {
fileDiv.prepend('<span style="float: right;" id="dupFilesProgress" title="In progress..."><img src="' + ajaxIndicator + '" style="vertical-align: baseline;" border="0" alt="In progress..." /></span>');
}
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 += "<h3><a href='/wiki/" + encodeURIComponent(pages[pageID].title).replace(/'/g, "%27") + "'>" + pages[pageID].title + "</a></h3>
<ul>
";
for ( x = 0; x < pages[pageID].duplicatefiles.length; x++ ) {
output += "<li><a href='/wiki/File:" + encodeURIComponent(pages[pageID].duplicatefiles[x].name).replace(/'/g, "%27") + "'>File:" + pages[pageID].duplicatefiles[x].name + "</a></li>
";
dil.push("File:" + pages[pageID].duplicatefiles[x].name.replace(/_/g, " "));
}
output += "</ul>
"
}
}
fileDiv.append(output);
if (data["query-continue"]) {
setTimeout("findDupFiles('" + encodeURIComponent(data["query-continue"].allimages.gaifrom).replace(/'/g, "%27") + "');", 5000);
} else {
$('#dupFilesProgress').hide();
}
}
} );
}
}