MediaWiki:Gadget-Purge.js

Da Wikinotizie, le notizie a contenuto aperto

Nota: dopo aver pubblicato, potrebbe essere necessario pulire la cache del proprio browser per vedere i cambiamenti.

  • Firefox / Safari: tieni premuto il tasto delle maiuscole Shift e fai clic su Ricarica, oppure premi Ctrl-F5 o Ctrl-R (⌘-R su Mac)
  • Google Chrome: premi Ctrl-Shift-R (⌘-Shift-R su un Mac)
  • Internet Explorer / Edge: tieni premuto il tasto Ctrl e fai clic su Aggiorna, oppure premi Ctrl-F5
  • Opera: premi Ctrl-F5.
/**
 * Aggiunge la linguetta "Purge".
 */
$( function () {
	if ( $( '#ca-history' ).length ) {
		var portletLink = mw.util.addPortletLink(
			'p-cactions',
			'#',
			'Purge',
			'ca-purge',
			'Pulisci la cache',
			'*'
		);
		$( portletLink ).click( function ( e ) {
			e.preventDefault();
			new mw.Api().post( {
					action: 'purge',
					titles: mw.config.get( 'wgPageName' )
				} ).then(
					function () {
						location.reload();
					}, function () {
						mw.notify( 'Errore purge', { type: 'error' } );
					}
				);
		} );
	}
} );