MediaWiki:Gadget-SureSureSure.js: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m meglio |
m Annullate le modifiche di Sakretsu (discussione), riportata alla versione precedente di Krinkle Etichetta: Rollback |
||
Riga 1:
/**
* Questo gadget è per te se non sai come mai MediaWiki chieda conferma
* per ringraziare qualcuno, mentre per rollbackare no. asd
* This gadget is for you if you don't know why MediaWiki asks for confirmation
* to thank someone, but it doesn't for rollbacking. asd
*
* This snippet coexists with the MediaWiki core patrol.js code by making
* sure its code runs first, and then our code calls off('click') afterward.
*
* @license [[WTFPL]] or [[GNU GPL]] or [[CC BY SA 3.0]] at your opinion
* @author [[w:User:Valerio Bozzolan]] and contributors
* @see https://phabricator.wikimedia.org/T49782
*/
$( function () {
▲ var defaultOpts = {
▲ confirm: 'sicuro sicuro sicuro?',
▲ disablePatrolAjax: false,
▲ };
▲ window.sureSureSure = window.sureSureSure || {};
▲ var opts = $.extend( defaultOpts, window.sureSureSure );
▲ }
mw.hook( 'wikipage.content' ).add( function () {
$( '.mw-rollback-link a' )
.click( function ( event ) { var yes = 'ok-guy-im-not-
if( ! $(
var $t = $(
$t.addClass(
event.preventDefault();
window.sureSureSure._yetConfirmed = true;
}
} )
.css( 'pointer-events', 'auto' ); // ready
} );
// actually this is the simpler way to prevent automatic patrol action
if ( opts.disablePatrolAjax ) {▼
// @see mediawiki.page.patrol.ajax ResourceLoader module
mw.loader.using( 'mediawiki.misc-authed-curate' ).then( function () {▼
// Temporary: Try old name instead <https://gerrit.wikimedia.org/r/598141> (until 1 June 2020)
return mw.loader.using( 'mediawiki.page.patrol.ajax' );
} ).then( function () {
$( '.patrollink[data-mw="interface"] a' ).off( 'click' );
} );
|