«MediaWiki:Gadget-common-action-delete.js» и «Участник:Землеройкин/delete.js»: разница между страницами
(Различия между страницами)
Содержимое удалено Содержимое добавлено
Stjn (обсуждение | вклад) остаются лишние пробелы в начале |
м оформление |
||
Строка 4: | Строка 4: | ||
} |
} |
||
⚫ | |||
⚫ | |||
⚫ | |||
reasonInput = OO.ui.TextInputWidget.static.infuse('#wpReason'); |
|||
$( '<textarea>' ) |
|||
.attr( { |
|||
⚫ | |||
⚫ | |||
⚫ | |||
rows: '3', |
|||
maxlength: '500' |
|||
⚫ | |||
.val( $( '#wpReason' ).val() ) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
return; |
return; |
||
} |
} |
||
⚫ | |||
reasonInput = new OO.ui.MultilineTextInputWidget( { |
|||
inputId : reasonInput.$input[0].id, |
|||
tabIndex : reasonInput.$input[0].tabIndex, |
|||
⚫ | |||
⚫ | |||
value : reasonInput.value, |
|||
⚫ | |||
⚫ | |||
⚫ | |||
// save infusion data |
|||
$('#wpReason').data( 'ooui-infused', reasonInput ); |
|||
$('#wpReason').attr( 'data-ooui', '' ); |
|||
⚫ | |||
⚫ | |||
// "script info" link |
// "script info" link |
||
Строка 43: | Строка 40: | ||
} ) |
} ) |
||
.click( function () { |
.click( function () { |
||
$( '#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 ); |
||
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' ) ); |