var ThaanaKeyboard = function () { function t(t, n) { void 0 === t && (t = ".thaana-keyboard"), void 0 === n && (n = !0), this.className = t, !0 === n && this.run() } return t.prototype.run = function () { var t = this, n = document.querySelectorAll(this.className); n.forEach(function (n) { return n.addEventListener("beforeinput", function (n) { return t.beforeInputEvent(n) }) }), n.forEach(function (n) { return n.addEventListener("input", function (n) { return t.inputEvent(n) }) }) }, t.prototype.beforeInputEvent = function (t) { var n = t; -1 !== ["insertCompositionText", "insertText"].indexOf(n.inputType) && (this.latinChar = n.data, this.char = this.getChar(this.latinChar)) }, t.prototype.inputEvent = function (t) { var n = t; if (-1 !== ["insertCompositionText", "insertText"].indexOf(n.inputType) && this.char !== this.latinChar) { var e = n.target, i = e.selectionStart, r = e.selectionEnd; e.value = e.value.split(this.latinChar).join(""); var a = e.value.substring(0, i - 1); a += this.char, a += e.value.substring(i - 1), e.value = a, e.selectionStart = i, e.selectionEnd = r } }, t.prototype.getChar = function (t) { return { q: "ް", w: "އ", e: "ެ", r: "ރ", t: "ތ", y: "ޔ", u: "ު", i: "ި", o: "ޮ", p: "ޕ", a: "ަ", s: "ސ", d: "ދ", f: "ފ", g: "ގ", h: "ހ", j: "ޖ", k: "ކ", l: "ލ", z: "ޒ", x: "×", c: "ޗ", v: "ވ", b: "ބ", n: "ނ", m: "މ", Q: "ޤ", W: "ޢ", E: "ޭ", R: "ޜ", T: "ޓ", Y: "ޠ", U: "ޫ", I: "ީ", O: "ޯ", P: "÷", A: "ާ", S: "ށ", D: "ޑ", F: "ﷲ", G: "ޣ", H: "ޙ", J: "ޛ", K: "ޚ", L: "ޅ", Z: "ޡ", X: "ޘ", C: "ޝ", V: "ޥ", B: "ޞ", N: "ޏ", M: "ޟ", ",": "،", ";": "؛", "?": "؟", "<": ">", ">": "<", "[": "]", "]": "[", "(": ")", ")": "(", "{": "}", "}": "{" }[t] || t }, t }(); window.ThaanaKeyboard = ThaanaKeyboard;
|