« MediaWiki:Gadget-CatRename.js » : différence entre les versions

Ajout de la fonction permettant aux utilisateurs sans droit de suppression d'ajouter le bandeau de suppression sur l'ancienne catégorie.
Kharmitch (discussion | contributions)
Aucun résumé des modifications
Kharmitch (discussion | contributions)
Ajout de la fonction permettant aux utilisateurs sans droit de suppression d'ajouter le bandeau de suppression sur l'ancienne catégorie.
 
(2 versions intermédiaires par le même utilisateur non affichées)
Ligne 18 : Ligne 18 :
const TAG = 'RenommageCategorie';
const TAG = 'RenommageCategorie';
const DAILY_LIMIT = 2500;
const DAILY_LIMIT = 2500;
 
const DR_TEMPLATE = '{{Suppression|utilisateur=$1}}\n\n';
// Literal non-breaking space, for situations where HTML entities can't be used
// Literal non-breaking space, for situations where HTML entities can't be used
const NBSP = String.fromCharCode( 0xA0 );
const NBSP = String.fromCharCode( 0xA0 );
Ligne 501 : Ligne 502 :
}
}


this.noSpammingDelay = 500;
this.noSpammingDelay = 50;
/*if ( this.members.length > 50 ) {
this.noSpammingDelay = 20000;
}
else if ( this.members.length > 10 ) {
this.noSpammingDelay = 10000;
}*/


this.showStatus( mw.msg( 'catrename-status-checklimits' ) );
this.showStatus( mw.msg( 'catrename-status-checklimits' ) );
Ligne 658 : Ligne 653 :
dialog.errorHandler( error );
dialog.errorHandler( error );
}
}
} );
return this.deferred;
};
/**
* Post a deletion request.
*
* @return {JQuery.Deferred} Promise telling to continue the process
* when it is its turn to execute.
*/
CatRename.prototype.postDR = function () {
var dialog = this;
this.deferred = $.Deferred();
this.showStatus( mw.msg( 'catrename-status-postdr' ) );
var content = DR_TEMPLATE
.replace( /\$1/g, mw.config.get( 'wgUserName' ) );
this.api.postWithToken( 'csrf', {
'action': 'edit',
'format': 'json',
'title': this.oldPageName,
'summary': mw.msg( 'catrename-dr-summary' ),
'tags': TAG,
'nocreate': 1,
'prependtext': content,
'formatversion': '2'
} ).then( function ( data ) {
dialog.deferred.resolve();
} ).fail( function ( error ) {
dialog.errorHandler( error );
} );
} );


Bureaucrate, commentadmin, emailconfirmed, Administrateurs d’interface, staff, Administrateur
62 734

modifications