define([ 'html!ui/templates/messages/tplTab' ], function ( tplTab ) { const extensionObj = { renderKeyboard: function () { this.find('.keyboard').remove(); let mainContainer = this.find('.main'); let container = $('
') .appendTo(mainContainer); let keyboard = { 0: 'qwertyuiop|asdfghjkl|zxcvbnm', 1: 'QWERTYUIOP|ASDFGHJKL|ZXCVBNM', 2: '1234567890|@#&*-+=()|_$"\';/' }[this.kbUpper].split(''); //Hacky: Insert control characters in correct positions //Backspace goes after 'm' if (this.kbUpper === 0) { keyboard.splice(keyboard.indexOf('z'), 0, 'caps'); keyboard.splice(keyboard.indexOf('m') + 1, 0, '<<'); } else if (this.kbUpper === 1) { keyboard.splice(keyboard.indexOf('Z'), 0, 'caps'); keyboard.splice(keyboard.indexOf('M') + 1, 0, '<<'); } else if (this.kbUpper === 2) keyboard.splice(keyboard.indexOf('/') + 1, 0, '<<'); keyboard.push(...['|', '123', ',', 'space', '.', 'send']); let row = 0; keyboard.forEach(k => { if (k === '|') { row++; const postGapCount = row === 4 ? 0 : row - 1; for (let i = 0; i < postGapCount; i++) $('').appendTo(container); $('').appendTo(container); const preGapCount = row === 3 ? 0 : row; for (let i = 0; i < preGapCount; i++) $('').appendTo(container); return; } let className = (k.length === 1) ? 'key' : 'key special'; if (k === ' ') { k = '.'; className = 'key hidden'; } className += ' ' + k; let elKey = $(`