Utente:Sakretsu/common.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m svuoto
Etichetta: Svuotamento
test
Riga 1:
const defaultOpts = {
confirm: 'sicuro sicuro sicuro?',
disablePatrolAjax: false,
};
window.sureSureSure = window.sureSureSure || {};
var opts = $.extend( defaultOpts, window.sureSureSure );
$( function () {
mw.hook( 'wikipage.content' ).add( function () {
$( '.mw-rollback-link a' )
.click( function ( event ) {
var yes = 'ok-guy-im-not-accidetally-clicking-this';
if( ! $(this).hasClass(yes) && ! window.sureSureSure._yetConfirmed ) {
var $t = $(this);
$t.addClass(yes).text( $t.text() + ": " + opts.confirm );
event.preventDefault();
window.sureSureSure._yetConfirmed = true;
}
} );
} );
 
// actually this is the simpler way to prevent automatic patrol action
// @see mediawiki.page.patrol.ajax ResourceLoader module
if( opts.disablePatrolAjax ) {
mw.loader.using( 'mediawiki.misc-authed-curate' ).catch( 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' );
} );
}
} );