MediaWiki:Common.js/DuplicateImages.js

/* Any JavaScript here will be loaded for all users on every page load. */ dil = new Array; function findDupImages(gf) { indicator = stylepath + '/common/progress-wheel.gif'; output = ""; url = "/api.php?action=query&generator=allimages&prop=duplicatefiles&gailimit=500&format=json"; if (!($('#dupImagesProgress').length)) { $("#mw-dupimages").prepend('  '); }	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; x < pages[pageID].duplicatefiles.length; x++ ) {						output += "File:" + 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('" + encodeURIComponent(data["query-continue"].allimages.gaifrom).replace(/'/g, "%27") + "');", 5000); }	} ); } $( function { if ( $("#mw-dupimages").length ) { findDupImages; } else { $('#dupImagesProgress').hide; } } );