MediaWiki:Gadget-Ae-to-Aelig.js: различия между версиями
Содержимое удалено Содержимое добавлено
кусы |
Нет описания правки |
||
Рæнхъ 3:
*/
var wgAe = {};▼
▲var wgAe={};
wgAe.
wgAe.setCaret = function(pos) {
wgAe.APressed=false;▼
▲wgAe.setCaret=function(pos){
} else if ($('#wpTextbox1')[0].selectionStart) {▼
▲ if (document.selection) {
}▼
▲ else if ($('#wpTextbox1')[0].selectionStart) {
$('#wpTextbox1')[0].selectionStart = pos;
$('#wpTextbox1')[0].selectionEnd = pos;
} else if ($('#wpTextbox1')[0].selectionStart == '0') {▼
} ▼
▲ else if ($('#wpTextbox1')[0].selectionStart == '0') {
▲ }
wgAe.timeFlag = 0;▼
function(e) {
var caretPosition = $('#wpTextbox1').data(
'wikiEditor-context').$textarea.textSelection(
'getCaretPosition', {
startAndEnd : true
});
: caps = false;
val = pre + ins
wgAe.setCaret(caretPosition[0]);
wgAe.APressed = false;
}
▲ wgAe.APressed = false;
});
};▼
});
}
});
▲wgAe.timeFlag=0;
▲$('#wpTextbox1').keydown(function (e){
▲ var code = (e.keyCode ? e.keyCode : e.which);
▲ if(code == 70){
▲ wgAe.timeFlag=$.now();
▲ wgAe.APressed=true;
▲ else if(wgAe.APressed && $.now()-wgAe.timeFlag<500){
▲ if(code == 84){
▲ var caps=false;
▲ val=$('#wpTextbox1').val()
▲ var enteredKey=val.slice(caretPosition[0]-1,caretPosition[0]);
▲ enteredKey.toUpperCase()===enteredKey?caps=true:caps=false;
▲ var pre=val.slice(0,caretPosition[0]-1);
▲ var ins=caps?'Ӕ':'ӕ';
▲ var val=pre+ins+val.slice(caretPosition[0],val.length);
▲ $('#wpTextbox1').val(val);
▲ wgAe.setCaret(caretPosition[0]);
▲ wgAe.APressed=false;
▲ e.stopPropagation();
▲ return false;
▲});
▲}
▲if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
▲ mw.loader.using( 'user.options', function () {
▲ if ( mw.user.options.get('usebetatoolbar') ) {
▲ mw.loader.using( 'ext.wikiEditor.toolbar', function () {
▲ $(document).ready(wgAe.init);
}
|