Utente:Daimona Eaytoy/Massblock.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Tutti gli errori in un oggetto, raggruppati per utente
Report errori: specifica l'azione, link alla pagina relativa su m.o per ogni codice
Riga 6:
* Overwrite values in localMsg below to localize.
*
* @todo docs!!, change how protection level is retrieved?, handle failures nicely
* disable summary fields if no text, counters aren't updated.
* improve error reporting: make each error code a link
* to the page of the corrisponding module on m.o,
* specify which action raised the error;
* counters aren't updated.
*/
( function( mw, $ ) {
Riga 95 ⟶ 91:
wpMassBlockProtectUser = $( "#wpMassBlockProtectUser input" ).prop( 'checked' );
 
var errorHandler = function( e, user, action ) {
if (errors[user]){
errors[user].push( { action: e } );
} else {
errors[user] = [ { action: e } ];
}
Riga 134 ⟶ 130:
} )
.fail( function( e ) {
errorHandler( e, user, "edit-talk" );
} ) );
}
Riga 149 ⟶ 145:
} )
.fail( function( e ) {
errorHandler( e, user, "protect-talk" );
} ) );
}
Riga 159 ⟶ 155:
} )
.fail( function( e ) {
errorHandler( e, user, "edit-user" );
} ) );
}
Riga 169 ⟶ 165:
} )
.fail( function( e ) {
errorHandler( e, user, "protect-user" );
} ) );
}
Riga 188 ⟶ 184:
},
function( e ) {
errorHandler( e, user, "block" );
} )
);
Riga 210 ⟶ 206:
 
for ( var user in errors ) {
var codes = errors[user].map(function (el) {return '<code style="color:red">' + el + '</code>';});
var key = Object.keys( el )[0],
action = key.split( "-" )[0],
link = '//mediawiki.org/wiki/API:' + action + '#Possible_errors';
return key + ': <code style="color:red">' +
el.key + '</code> (<a href="' + link + '">' +
msg( 'failure-help') + '</a>)';
});
linkedList += "<li><a href=\"" + mw.config.get( 'wgScript' ) + "?title=Special:Contributions/" + encodeURIComponent( user ) + "\">" + user +"</a>:" +
codes.join( ", " ) + "</li>";