MediaWiki:Gadget-SureSureSure.js: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
copiato da Utente:Valerio Bozzolan/common.js |
m namo bene Etichetta: Annulla |
||
(29 versioni intermedie di 4 utenti non mostrate) | |||
Riga 1:
/**
*
* consente a tutti i rollback successivi di partire all'istante come di consueto.
* L'uso è configurabile a seconda di touch screen e dimensioni della finestra.
*
* @license [[WTFPL]] or [[GNU GPL]] or [[CC BY SA 3.0]] at your opinion
* @author [[w:User:Valerio Bozzolan]] and contributors
*/
window.sureSureSure = {};▼
window.sureSureSure.opts = {▼
confirm: 'Sicuro sicuro sicuro?'▼
$( function () {
var defaultOpts = {
$('.mw-rollback-link a').click( function (event) {▼
var yes = 'ok-guy-im-not-accidetally-clicking-this';▼
disablePatrolAjax: false,
if( ! $(this).hasClass(yes) ) {▼
hasTouchScreen: undefined,
$(this).addClass(yes).text( window.sureSureSure.opts.confirm );▼
maxScreenWidth: Infinity
event.preventDefault();▼
var opts = $.extend( defaultOpts, window.sureSureSure );
var isIOS = /iPad|iPhone|iPod/.test( navigator.platform ); // Safari iOS pre 13
if (
opts.maxScreenWidth < window.innerWidth ||
opts.hasTouchScreen !== undefined &&
opts.hasTouchScreen !== ( isIOS ? isIOS : navigator.maxTouchPoints > 0 )
) {
return;
}
mw.hook( 'wikipage.content' ).add( function () {
var $t = $( this );
▲ event.preventDefault();
}
} );
} );
if ( opts.disablePatrolAjax ) {
mw.loader.using( 'mediawiki.misc-authed-curate' ).then( function () {
$( '.patrollink[data-mw="interface"] a' ).off( 'click' );
} );
}
} );
|