Utente:Daimona Eaytoy/Massblock.js: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m Bellifico, summary disabilitati di default |
Proteggi soltanto dopo aver editato (se la pagina va editata) per evitare conflitti con il tipo di protezione |
||
Riga 106:
var isInfty = isInfinity( wpMassBlockExpiry );
// Several actions can only be executed if the block is infinite
wpMassBlockTag = isInfty ? wpMassBlockTag : '';
var doBlock = function( user ) {
Riga 124 ⟶ 129:
var successHandler = function( response ) {
let user = response.block.user,
userPage = 'User:' + user;
blocked++;
if ( wpMassBlockMessage !== "" ) {
▲ doEditPage( 'User talk:' + user, wpMassBlockMessage, wpMassBlockSummaryTalk, !isInfty )
.done( function( data ) {
talkpageedited++;
if ( wpMassBlockProtectTalk ) {
return doProtectPage( talkPage, 'edit=sysop|move=sysop' )
talkpageprotected++;
.fail( function( e ) {
errorHandler( e, user, "protect-talk" );
} );▼
}▼
} )
.fail( function( e ) {
errorHandler( e, user, "edit-talk" );
}
} else if ( wpMassBlockProtectTalk ) {
▲ }
titles: talkPage
return;▼
} )
.then( function( data ) {
var exists = Object.keys( data.query.pages )[ 0 ] !== -1,▼
▲ if ( wpMassBlockProtectTalk ) {
prType = exists ? 'edit=sysop|move=sysop' : 'create=sysop';▼
return doProtectPage(
.done( function( data ) {
talkpageprotected++;
} )
.fail( function( e ) {
errorHandler( e, user, "protect-talk" );
} )
.fail( function( e ) {
errorHandler( e, user, "
}
}
if ( wpMassBlockTag !== "" ) {
▲ doEditPage( 'User:' + user, wpMassBlockTag, wpMassBlockSummaryUser )
.done( function( data ) {
userpageedited++;
if ( wpMassBlockProtectUser ) {
return doProtectPage( userPage, 'edit=sysop|move=sysop' )
.done( function( data ) {
userpageprotected++;▼
} )
.fail( function( e ) {
errorHandler( e, user, "protect-user" );
} );
}▼
} )
.fail( function( e ) {
errorHandler( e, user, "edit-user" );
}
} else if ( wpMassBlockProtectUser ) {
▲ }
userDone = new mw.Api().get( {
▲ if ( wpMassBlockProtectUser ) {
titles: userPage
▲ doProtectPage( 'User:' + user )
} )
. var exists = Object.keys( data.query.pages )[ 0 ] !== -1,
▲ userpageprotected++;
prType = exists ? 'edit=sysop|move=sysop' : 'create=sysop';
return doProtectPage( userPage, prType )
.done( function( data ) {
userpageprotected++;
} )
.fail( function( e ) {
errorHandler( e, user, "protect-user" );
} );
} )
.fail( function( e ) {
errorHandler( e, user, "
}
}
return $.when
};
Riga 210 ⟶ 250:
var linkedList = "";
var
return key + ': <code style="color:red">' +
▲ link = '//mediawiki.org/wiki/API:' + action + '#Possible_errors';
};
for ( var user in errors ) {
▲ } );
var codes = errors[ user ].map( errorsToCodes );
linkedList += "<li><a href=\"" + mw.config.get( 'wgScript' ) + "?title=Special:Contributions/" + encodeURIComponent( user ) + "\">" + user + "</a>:" +
codes.join( ", " ) + "</li>";
Riga 253 ⟶ 294:
* Protect the given page
*/
function doProtectPage( title, protections ) {
return new mw.Api().
action: '
▲ } ).then( function( data ) {
▲ var exists = Object.keys( data.query.pages )[ 0 ] !== -1,
▲ prType = exists ? 'edit=sysop|move=sysop' : 'create=sysop';
format: 'json',
▲ action: 'protect',
▲ protections: prType,
▲ reason: $( "#wpMassBlockProtectReason input" ).val().trim(),
▲ watchlist: 'nochange',
▲ format: 'json',
▲ } );
} );
}
|