Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 1x 1x 1x 9x 1x 9x 9x 9x 1x 1x 1x 9x 9x 9x 1x 1x 1x 9x 9x 1x 1x 8x 8x 8x 25x 25x 25x 25x 25x 25x 25x 8x 8x 25x 25x 25x 8x 9x 9x 1x | import {KeyboardHandler} from "./KeyboardHandler"; interface KeyEventFunctions{ beforeKeyEvent?(): void; afterKeyEvent?():void; } //declare var jQuery: JQueryStatic; export class BanglaLayout implements KeyEventFunctions { keyboard: KeyboardHandler; sourceField: string; constructor(id:string, keyEvents?:KeyEventFunctions) { this.sourceField = id; this.keyboard = new KeyboardHandler(); if(typeof keyEvents === "object"){ this.beforeKeyEvent = typeof keyEvents.beforeKeyEvent === "function" ? keyEvents.beforeKeyEvent : this.beforeKeyEvent; this.afterKeyEvent = typeof keyEvents.afterKeyEvent == "function" ? keyEvents.afterKeyEvent : this.afterKeyEvent; } this.setupKeyboardHooks(); // chainability return this; } beforeKeyEvent(): void{}; afterKeyEvent(): void {}; setupKeyboardHooks(){ var inputbox = document.getElementById(this.sourceField); if (inputbox === null) { throw new Error("No textarea/text input was found with the provided ID."); } var hasHookedAlready:boolean = false; var root = this; var returnComputeFn = function(keyEvent:any){ var oEvent = keyEvent; var oSource = oEvent.srcElement || oEvent.target; root.beforeKeyEvent(); var returnValue = root.keyboard.handleKeyboardInput(oEvent, oSource); root.afterKeyEvent(); return returnValue; }; try { inputbox.onkeydown = function(keyEvent) { hasHookedAlready = returnComputeFn(keyEvent); return hasHookedAlready; }; inputbox.onkeyup = function (keyEvent) { if (!!keyEvent) keyEvent.preventDefault(); }; } catch (e) { if (console) console.log(e.message); } } } |