62 734
modifications
Page créée avec « →* CatRename * * Ajoute un onglet permettant de renommer une catégorie, en déplaçant les pages * incluses dans celle-ci. Permet de faire faire l'action à un bot en un clic. * * Fonction copiée depuis Wikipédia : https://fr.wikipedia.org/wiki/MediaWiki:Gadget-CatRename.js : →<nowiki> : →globals mw, OO, $ : if ( mw.config.get( 'wgNamespaceNumber' ) === 14 ) { mw.loader.using( 'mediawiki.util', function () { 'use strict'; // Site-related parameter... » |
Ajout de la fonction permettant aux utilisateurs sans droit de suppression d'ajouter le bandeau de suppression sur l'ancienne catégorie. |
||
(4 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 316 : | Ligne 317 : | ||
// Disable actions button when a process is runing | // Disable actions button when a process is runing | ||
this.getActions().get( { actions: 'rename' } )[ 0 ].setDisabled( true ); | this.getActions().get( { actions: 'rename' } )[ 0 ].setDisabled( true ); | ||
// Except for the cancel button, which behaviour change to cancel the ongoing process | // Except for the cancel button, which behaviour change to cancel the ongoing process | ||
this.getActions().get( { actions: 'cancel' } )[ 0 ].on( 'click', function () { | this.getActions().get( { actions: 'cancel' } )[ 0 ].on( 'click', function () { | ||
Ligne 502 : | Ligne 502 : | ||
} | } | ||
this.noSpammingDelay = | this.noSpammingDelay = 50; | ||
this.showStatus( mw.msg( 'catrename-status-checklimits' ) ); | this.showStatus( mw.msg( 'catrename-status-checklimits' ) ); | ||
Ligne 659 : | 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 ); | |||
} ); | } ); | ||
Ligne 741 : | Ligne 768 : | ||
this.getActions().get( { actions: 'rename' } )[ 0 ].setDisabled( false ); | this.getActions().get( { actions: 'rename' } )[ 0 ].setDisabled( false ); | ||
this.deferred.reject( errorMessage ); | this.deferred.reject( errorMessage ); |
modifications