MediaWiki:Gadget-DeleteSection.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m uniformato stile commenti
 
(4 versioni intermedie di 4 utenti non mostrate)
Riga 98:
function addDeleteLinks() {
var summaryDialog, windowManager;
$( 'span.mw-editsection > a:lastfirst-of-type' ).each( function ( i, el ) {
var $link, sectiontitle;
sectiontitle = $( el ).attr( 'title' ).split( 'Modifica la sezione ' )[ 1 ];
Riga 104:
.attr( 'href', '#' )
.attr( 'title', 'Cancella la sezione ' + sectiontitle )
.attr( 'class', mw.config.get( 'skin' ) === 'minerva' ? 'mw-ui-icon mw-ui-icon-element mw-ui-icon-minerva-trash' : '')
.text( 'cancella' )
.click( function ( event ) {
mw.loader.using( [ 'mediawiki.api.edit', 'oojs-ui-core',
'oojs-ui-widgets', 'oojs-ui-windows' ], )
.done( function () {
if ( !summaryDialog ) {
summaryDialog = buildSummaryDialog();
windowManager = new OO.ui.WindowManager();
$( 'body' ).append( windowManager.$element );
windowManager.addWindows( [ summaryDialog ] );
}
summaryDialog.textInput.setValue ( 'Sezione ' + sectiontitle + ' eliminata' );
summaryDialog.currSection = i + 1;
windowManager.openWindow( summaryDialog );
} );
.fail( function () {
console.error( 'Impossibile avviare l\'accessorio DeleteSection.' );
} );
return false;
} );
Line 125 ⟶ 130:
 
$( function () {
if ( mw.config.get( 'wgAction' ) === 'view' && mw.config.get( 'wgNamespaceNumber' ) % 2 === 0 ) {
addDeleteLinks();
}