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

Contenuto cancellato Contenuto aggiunto
Disabilita summary se non c'è text
m Bellifico, summary disabilitati di default
Riga 1:
/* jshint sub:true maxerr: 10000 */
/**
* Tool for mass-blocking a list of IPs/users.
Riga 92:
 
var errorHandler = function( e, user, action ) {
if ( errors[ user ] ) {
errors[ user ].push( {
action: e
} );
} else {
errors[ user ] = [ {
action: e
} ];
}
 
 
};
 
Riga 168 ⟶ 172:
} ) );
}
console.log( actionsdfd );
return $.when.apply( $, actionsdfd );
};
Riga 180 ⟶ 184:
doBlock( user )
.then(
function( data ) {
return successHandler( data );
},
function( e ) {
errorHandler( e, user, "block" );
} )
);
}
 
$.when.apply( $, deferreds ).always( function() {
console.log( deferreds );
doPostBlockActions( errors );
OO.ui.alert(
Riga 206 ⟶ 211:
 
for ( var user in errors ) {
var codes = errors[ user ].map(function function( el ) {
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>";
}
$( "#wpMassBlockFailedContainer" ).html(
Riga 252 ⟶ 257:
action: 'query',
titles: title
} ).then ( function ( data ) {
var exists = Object.keys( data.query.pages )[ 0 ] !== -1,
prType = exists ? 'edit=sysop|move=sysop' : 'create=sysop';
 
return new mw.Api().postWithToken( 'csrf', {
action: 'protect',
title: title,
protections: prType,
reason: $( "#wpMassBlockProtectReason input" ).val().trim(),
watchlist: 'nochange',
format: 'json',
} );
} );
}
 
Riga 323 ⟶ 329:
id: 'wpMassBlock'
} );
 
talkTextField = new OO.ui.MultilineTextInputWidget( {
rows: 10
} );
 
userTextField = new OO.ui.MultilineTextInputWidget( {
rows: 10
Riga 351 ⟶ 357:
}
),
new OO.ui.FieldLayout( userTextField, {
label: msg( 'upmsg' ),
align: 'top',
id: 'wpMassBlockTag'
} )
] } );
} });
 
var reasonOpts = [ {
Riga 470 ⟶ 477:
} );
 
 
talkSummaryField =
new OO.ui.TextInputWidget( {
maxLength: 255,
id: 'wpMassBlockSummaryTalk',
value: msg( 'summary-default' ),
// The text is empty by default
});
disabled: true
} );
 
talkTextField.on( 'change', function() {
talkSummaryField.setDisabled( talkTextField.getValue().trim() === '' );
} );
 
Riga 486 ⟶ 495:
maxLength: 255,
id: 'wpMassBlockSummaryUser',
value: msg( 'summary-default' ),
// The text is empty by default
disabled: true
} );
 
userTextField.on( 'change', function () {
userSummaryField.setDisabled( userTextField.getValue().trim() === '' );
} );
 
Riga 526 ⟶ 537:
userProtectCb.on( 'change', toggleProtectionFields );
 
var furtherOpts = new OO.ui.FieldsetLayout( {
label: msg( 'further-options-label' ),
items: [
new OO.ui.FieldLayout( talkSummaryField, {
label: msg( 'talksummary' )
} ),
new OO.ui.FieldLayout( userSummaryField, {
label: msg( 'upsummary' )
} ),
new OO.ui.FieldLayout( talkProtectCb, {
label: msg( 'talkprotect' )
} ),
new OO.ui.FieldLayout( userProtectCb, {
label: msg( 'upprotect' )
} ),
new OO.ui.FieldLayout( protectReasonField, {
label: msg( 'protect-reason-label' )
} )
] } );
} );
 
expiryField.on( 'change', function() {