MediaWiki:Gadget-SpecialPages.js/WantedFiles.js

// - Easier to read Special:WantedFiles

/* removeFalsePositives */// Function to actually remove the false positives like they never happened. function removeFalsePositives { // Count how many items are on the list to start (to replace the number with a new correct number when done) var strStartCountString = $( 'ol.special li' ).length.toString.replace(/\B(?=(\d{3})+(?!\d))/g, ","); // Actually remove the false positives $( 'del' ).parent( 'li' ).remove; // Count how many items are on the list at the end (to replace the starting number with) var strEndCountString = $( 'ol.special li' ).length.toString.replace(/\B(?=(\d{3})+(?!\d))/g, ","); // Replace the starting number with the new count (should be two of them) $( 'strong' ).each( function {   $( this ).html( $( this ).html.replace( strStartCountString, strEndCountString ) );  } );// End replacing the li count // Get rid of the extra text and link when done. $( 'del' ).parent( 'p' ).html(   $( 'del' ).parent( 'p' ).html    .replace( 'Files from foreign repositories may be listed despite existing.' + ' Any such false positives will be struck out ' + ' remove.' + ' Additionally, pages that embed files that do not exist are ', 'Pages that embed files that do not exist are also ' ) );// End replace block text }// End function

// Make sure that there are always 5,000 results (max results) if ( mw.util.getParamValue( 'limit' ) === null ) { location.href = location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'limit=5000' }

// Find the -struck out- text and add a remove link after it so false positives are only removed on request. $( $( 'del' ).get( 0 ) ).after( ' remove ' );

// Add direct link to file and reupload link $( 'ol.special' ).find( 'del' ).siblings( 'a' ).each( function ( i ) { var thisImage = $( this ).siblings( 'del' ).text.replace( 'File:',  ).replace( ' ', '_' ).replace( /'/g, '\\\ );  $( this ).after( ' - file - reupload' ); } );

//