Converted to SASS
This commit is contained in:
@@ -129,9 +129,7 @@ let showVirtualNumpad = (heading: string, maxlength = 4, isPassword: boolean, al
|
||||
setKeyboardLayout('default')
|
||||
}
|
||||
|
||||
let showVirtualKeyboard = (heading: string, maxlength = 32, isPassword = false, submitFunction :Function = () => {
|
||||
hideVirtualKeyboard()
|
||||
}) => {
|
||||
let showVirtualKeyboard = (heading: string, maxlength = 32, isPassword = false, submitFunction :Function = () => {hideVirtualKeyboard()}) => {
|
||||
let keyboard = $('#virtualKeyboard')
|
||||
let inputBox = $('#virtualKeyboardInput')
|
||||
|
||||
@@ -143,14 +141,13 @@ let showVirtualNumpad = (heading: string, maxlength = 4, isPassword: boolean, al
|
||||
keyboard.data('maxlength', maxlength)
|
||||
keyboard.data('password', isPassword)
|
||||
keyboard.data('submitfunction', submitFunction)
|
||||
|
||||
$(document).off('keyup')
|
||||
inputBox.trigger('focus')
|
||||
$(document).on('keyup', e => {
|
||||
let key = e.key
|
||||
if (key == 'Enter')
|
||||
if (key == 'Enter' && inputBox.val().toString().length > 0) {
|
||||
key = 'submit'
|
||||
|
||||
virtualKeyboardInput(key)
|
||||
virtualKeyboardInput(key)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -166,13 +163,13 @@ let showVirtualNumpad = (heading: string, maxlength = 4, isPassword: boolean, al
|
||||
case 'backspace':
|
||||
case 'delete':
|
||||
let newText = inputBox.text().slice(0, -1);
|
||||
inputBox.text(newText)
|
||||
inputBox.val(newText)
|
||||
keyboard.data('value', newText);
|
||||
break;
|
||||
case 'submit':
|
||||
hideVirtualKeyboard();
|
||||
let submitFunction = keyboard.data('submitfunction')
|
||||
submitFunction(inputBox.text());
|
||||
submitFunction(inputBox.val());
|
||||
break;
|
||||
case 'shift':
|
||||
if (Application.keyboard.capsLock) break;
|
||||
@@ -196,17 +193,17 @@ let showVirtualNumpad = (heading: string, maxlength = 4, isPassword: boolean, al
|
||||
if (input.length == 1) {
|
||||
if (Application.keyboard.shift || Application.keyboard.capsLock) {
|
||||
input = input.toUpperCase()
|
||||
|
||||
//If shift, reload lowercase
|
||||
if (Application.keyboard.shift) {
|
||||
Application.keyboard.shift = false
|
||||
setKeyboardLayout('default');
|
||||
}
|
||||
}
|
||||
|
||||
let newText = inputBox.text() + input;
|
||||
let newText = inputBox.val() + input;
|
||||
keyboard.data('value', newText);
|
||||
inputBox.text(newText)
|
||||
|
||||
//If shift, reload lowercase
|
||||
if (Application.keyboard.shift) {
|
||||
Application.keyboard.shift = false
|
||||
setKeyboardLayout('default');
|
||||
}
|
||||
inputBox.val(newText)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user