«MediaWiki:Gadget-common-action-delete.js» и «Участник:Землеройкин/delete.js»: разница между страницами

(Различия между страницами)
Перейти к навигации Перейти к поиску
Первая страница
Вторая страница
Содержимое удалено Содержимое добавлено
остаются лишние пробелы в начале
 
м оформление
 
Строка 4: Строка 4:
}
}


// "reason" <input> → <textarea>
var reasonList = OO.ui.DropdownWidget.static.infuse( '#wpDeleteReasonList'),
$( '#wpReason' ).replaceWith(
reasonInput = OO.ui.TextInputWidget.static.infuse('#wpReason');
$( '<textarea>' )
.attr( {
if ( !reasonList || !reasonInput) {
id: 'wpReason',
name: 'wpReason',
rows: '3',
maxlength: '500'
} )
.val( $( '#wpReason' ).val() )
);

var dropdown = OO.ui.DropdownWidget.static.infuse( '#ooui-php-2' ).dropdownWidget,
reason = $( '#wpReason' );
if ( !dropdown || !reason[0]) {
return;
return;
}
}
var menu = dropdown.getMenu();
reasonInput = new OO.ui.MultilineTextInputWidget( {
inputId : reasonInput.$input[0].id,
tabIndex : reasonInput.$input[0].tabIndex,
id : 'wpReason',
name : 'wpReason',
value : reasonInput.value,
});
// "reason" <input> → <textarea>
$('#wpReason' ).replaceWith( reasonInput.$element );
// save infusion data
$('#wpReason').data( 'ooui-infused', reasonInput );
$('#wpReason').attr( 'data-ooui', '' );
var reason = $( '#ooui-php-2' );

var menu = reasonList.dropdownWidget.getMenu();


// "script info" link
// "script info" link
Строка 43: Строка 40:
} )
} )
.click( function () {
.click( function () {
var focus = $( '#ooui-php-2' );
$( '#wpReason' ).val( $( '#wpReason' ).val() + '[[]]' );
if (focus && focus.is('textarea, input')) {
var text = focus.textSelection('getSelection');
text = (text) ? '[[' + text + ']]' : '[[]]';
focus.textSelection( 'encapsulateSelection', {
replace: true,
peri: text
} );
}
} )
} )
.appendTo( '#deletePage-summaryButtons' );
.appendTo( '#deletePage-summaryButtons' );
Строка 150: Строка 139:
} else if( ma = /\{\{(КУ|к удалению) *\| *(\d?\d)-(\d?\d)-(\d\d\d\d)/i.exec( reason.val() ) ) {
} else if( ma = /\{\{(КУ|к удалению) *\| *(\d?\d)-(\d?\d)-(\d\d\d\d)/i.exec( reason.val() ) ) {
reasonKU( ma[2], ma[3], ma[4] );
reasonKU( ma[2], ma[3], ma[4] );
// КБУ в параметре
} else if( ma = /\[\[ВП:КБУ#[ОСПУК]\d+\|([ОСПУК]\d+)\]\]\: [^;]*;?(.*)/i.exec( reason.val() ) ) {
reason.val( ma[2].trim() ); // cut before semicolon
selectLabel( ma[1] );
// for talk page, except user_talk
// for talk page, except user_talk
} else if( mw.config.get( 'wgNamespaceNumber' ) %2 && mw.config.get( 'wgNamespaceNumber' ) !== 3 ) {
} else if( mw.config.get( 'wgNamespaceNumber' ) %2 && mw.config.get( 'wgNamespaceNumber' ) !== 3 ) {
Строка 231: Строка 216:
function selectLabel( name, msg ) {
function selectLabel( name, msg ) {
menu.selectItemByLabel( name, true );
menu.selectItemByLabel( name, true );
reasonInput.focus();
reason.focus();
mw.notify( 'Выбрано ' + menu.findSelectedItem().getLabel() + ' ' + ( msg || '' ) );
mw.notify( 'Выбрано ' + menu.findSelectedItem().getLabel() + ' ' + ( msg || '' ) );
}
}
Строка 304: Строка 289:
}
}
if ( tail ) {
if ( tail ) {
p2 += tail;
p2 += tail
}
}
var pathname = encodeURI( p1.replace(/\?/g,'%3F' ).replace( /&/g,'%26' ) );
var pathname = encodeURI( p1.replace(/\?/g,'%3F' ).replace( /&/g,'%26' ) );