Utente:Codicorumus/Fix GeoData duplicati.js
Nota: dopo aver salvato, potrebbe essere necessario pulire la cache del proprio browser per vedere i cambiamenti.
- Firefox / Safari: tenere premuto il tasto delle maiuscole e fare clic su Ricarica, oppure premere Ctrl-F5 o Ctrl-R (⌘-R su Mac)
- Google Chrome: premere Ctrl-Shift-R (⌘-Shift-R su un Mac)
- Internet Explorer: tenere premuto il tasto Ctrl mentre si fa clic su Refresh, oppure premere Ctrl-F5
- Opera: svuotare completamente la cache dal menu Strumenti → Preferenze
// ripulisce la pagina dai template GeoData duplicati
$( function() {
// solo in ns0
if ( mw.config.get( 'wgNamespaceNumber' ) !== 0 ) return;
function getParams( coordEl ) {
var paramsTry = /Mapsources¶ms=[^&]+/.exec(
$( coordEl )
.find( 'a.external' )
.attr( 'href' )
);
return paramsTry && paramsTry[0];
}
var
$coords = $( '[id="coordinates"]' ),
$firstCoord = $coords.first(),
firstParams = getParams( $firstCoord );
if ( ! firstParams ) return;
$coords
.filter( function() {
return (
this !== $firstCoord[0]
&& getParams( this ) === firstParams
);
} )
.hide();
} );