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
ifwpMassBlockProtectTalk (= wpMassBlockProtectTalk )&& {isInfty;
ifwpMassBlockProtectUser (= wpMassBlockProtectUser )&& {isInfty;
wpMassBlockTag = isInfty ? wpMassBlockTag : '';
 
 
var doBlock = function( user ) {
Riga 124 ⟶ 129:
var successHandler = function( response ) {
let user = response.block.user,
actionsdfdtalkDone, = [];userDone,
doProtectPage(talkPage = 'User talk:' + user ),
userPage = 'User:' + user;
 
blocked++;
 
if ( wpMassBlockMessage !== "" ) {
talkDone = doEditPage( 'User talk:' + usertalkPage, wpMassBlockMessage, wpMassBlockSummaryTalk, !isInfty )
actionsdfd.push(
doEditPage( 'User talk:' + user, wpMassBlockMessage, wpMassBlockSummaryTalk, !isInfty )
.done( function( data ) {
talkpageedited++;
if ( wpMassBlockProtectTalk ) {
return doProtectPage( talkPage, 'edit=sysop|move=sysop' )
} ) .thendone( function( data ) {
talkpageprotected++;
} );
.fail( function( e ) {
errorHandler( e, user, "protect-talk" );
} );
}
} )
.fail( function( e ) {
errorHandler( e, user, "edit-talk" );
} ) );
} else if ( wpMassBlockProtectTalk ) {
}
if talkDone (= !isInftynew mw.Api().get( {
action: 'protectquery',
// No pages should be protected, and the UP should be left as is
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';
actionsdfd.push(
return doProtectPage( 'User talk:' +talkPage, userprType )
.done( function( data ) {
talkpageprotected++;
} )
.fail( function( e ) {
errorHandler( e, user, "protect-talk" );
return } );
} )
.fail( function( e ) {
errorHandler( e, user, "protectquery-talk" );
} ) );
}
 
 
 
if ( wpMassBlockTag !== "" ) {
doEditPage(userDone 'User:'= +doEditPage( useruserPage, wpMassBlockTag, wpMassBlockSummaryUser )
actionsdfd.push(
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 ) {
format action: 'jsonquery',
actionsdfd.push(
titles: userPage
doProtectPage( 'User:' + user )
} )
.donethen( function( data ) {
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, "protectquery-user" );
} ) );
}
 
console.log( actionsdfd );
return $.when.apply( $talkDone, actionsdfduserDone );
};
 
Riga 210 ⟶ 250:
var linkedList = "";
 
forvar (errorsToCodes var= user infunction( errorsel ) {
var codeskey = errors[ user ]Object.map( functionkeys( el )[ {0 ],
var keyaction = Objectkey.keyssplit( el"-" )[ 0 ],
link = '//mediawiki.org/wiki/API:' + action + '#Possible_errors';
action = key.split( "-" )[ 0 ],
return key + ': <code style="color:red">' +
link = '//mediawiki.org/wiki/API:' + action + '#Possible_errors';
return el.key + ': </code> style(<a href="color:red' + link + '">' +
el.key + '</code> msg(<a href="'failure-help' + link) + '"</a>)' +;
};
msg( 'failure-help' ) + '</a>)';
 
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().getpostWithToken( 'csrf', {
action: 'queryprotect',
titlestitle: title,
protections: prTypeprotections,
} ).then( function( data ) {
reason: $( "#wpMassBlockProtectReason input" ).val().trim(),
var exists = Object.keys( data.query.pages )[ 0 ] !== -1,
watchlist: 'nochange',
prType = exists ? 'edit=sysop|move=sysop' : 'create=sysop';
format: 'json',
 
return new mw.Api().postWithToken( 'csrf', {
action: 'protect',
title: title,
protections: prType,
reason: $( "#wpMassBlockProtectReason input" ).val().trim(),
watchlist: 'nochange',
format: 'json',
} );
} );
}