"सदस्य:Lupo/vector.js": अवतरणों में अंतर
Content deleted Content added
छोNo edit summary |
छोNo edit summary |
||
पंक्ति 210:
(function () { // Local scope to avoid polluting the global namespace with declarations
// Backwards compatibility stuff. We want HotCat to work with either wg* globals, or with mw.config.get().
Line 1,478 ⟶ 1,450:
evt = evt || window.event || window.Event; // W3C, IE, Netscape
var key = evt.keyCode || 0;
if (self.ime && self.lastKey === IME && !self.usesComposition && (key === TAB || key === RET || key == ESC || key === SPACE)) self.ime = false;
if (self.ime) return true;
if (key === UP || key === DOWN || key === PGUP || key === PGDOWN) {
Line 1,503 ⟶ 1,473:
evt = evt || window.event || window.Event; // W3C, IE, Netscape
var key = evt.keyCode || 0;
self.lastKey = key;
self.keyCount = 0;
Line 1,534 ⟶ 1,503:
// DOM Level 3 IME handling
try {
// Webkit does send the textInput after compositionend, but then sends a spurious keydown IME. We ignore
addEvent(text, 'compositionstart', function (evt) { log('cStart'); self.lastKey = IME; self.usesComposition = true; self.ime = true; });▼
// that in onkeydown above. Gecko, OTOH, doesn't send textInput but a keyUp with the key that terminated
addEvent(text, 'compositionend', function (evt) { log('cEnd'); self.lastKey = IME; self.usesComposition = true; self.ime = false; });▼
// the composition, so that will trigger suggestions. Except if that key was ESC (cancel composition),
addEvent(text, 'textInput', function (evt) { log('textInput ' + (typeof evt.data != 'undefined' ? evt.data : 'UNDEF')); self.ime = false; self.invokeSuggestions(false); });▼
// which we'd get with a non-IME keydown from before compositionstart. Therefore, pretend the last
// keydown had been IME if we see either composition event, which allows us to handle this ESC properly.
▲ addEvent(text, 'compositionstart', function (evt) {
▲ addEvent(text, 'compositionend', function (evt) {
▲ addEvent(text, 'textInput', function (evt) {
} catch (any) {
// Just in case some browsers might produce exceptions with these DOM Level 3 events
}
addEvent(text, 'blur', function (evt) {
}
this.text = text;
Line 2,370 ⟶ 2,344:
autoComplete : function (newVal, actVal, normalizedActVal, key, dontModify) {
if (newVal == actVal) return true;
if (dontModify || this.ime || !this.canSelect()) return false;
// If we can't select properly or an IME composition is ongoing, autocompletion would be a major annoyance to the user.
|