Complete project revamp with a bunch of commits #37
1 changed files with 19 additions and 5 deletions
|
@ -7,14 +7,14 @@
|
|||
"{tab} q w e r t z u i o p \u00FC +",
|
||||
"{lock} a s d f g h j k l \u00F6 \u00E4 #",
|
||||
"{shift} < y x c v b n m , . - {shift}",
|
||||
".com @ {space}",
|
||||
"@ {space}",
|
||||
],
|
||||
shift: [
|
||||
'\u00B0 ! " \u00A7 $ % & / ( ) = ? ` {bksp}',
|
||||
"{tab} Q W E R T Z U I O P \u00DC *",
|
||||
"{lock} A S D F G H J K L \u00D6 \u00C4 '",
|
||||
"{shift} > Y X C V B N M ; : _ {shift}",
|
||||
".com @ {space}",
|
||||
"@ {space}",
|
||||
],
|
||||
}
|
||||
const layout_en = {
|
||||
|
@ -23,14 +23,14 @@
|
|||
"{tab} q w e r t y u i o p [ ] \\",
|
||||
"{lock} a s d f g h j k l ; '",
|
||||
"{shift} z x c v b n m , . / {shift}",
|
||||
".com @ {space}",
|
||||
"@ {space}",
|
||||
],
|
||||
shift: [
|
||||
"~ ! @ # $ % ^ & * ( ) _ + {bksp}",
|
||||
"{tab} Q W E R T Y U I O P { } |",
|
||||
'{lock} A S D F G H J K L : "',
|
||||
"{shift} Z X C V B N M < > ? {shift}",
|
||||
".com @ {space}",
|
||||
"@ {space}",
|
||||
],
|
||||
}
|
||||
const layout_numeric = {
|
||||
|
@ -72,15 +72,29 @@
|
|||
}
|
||||
// virtual keyboard
|
||||
const Keyboard = window.SimpleKeyboard.default;
|
||||
const myKeyboard = new Keyboard({
|
||||
const keyboard = new Keyboard({
|
||||
theme: theme,
|
||||
// choose german layout if language is de,
|
||||
// else choose english layout
|
||||
layout: layout,
|
||||
onChange: (input) => {
|
||||
keyboardInputElement.value = input;
|
||||
},
|
||||
onKeyPress: (button) => {
|
||||
if (button === "{shift}" || button === "{lock}") handleShift();
|
||||
}
|
||||
});
|
||||
// additional handlers
|
||||
keyboardInputElement.addEventListener("input", event => {
|
||||
keyboard.setInput(event.target.value);
|
||||
});
|
||||
function handleShift(input) {
|
||||
let currentLayout = keyboard.options.layoutName;
|
||||
let shiftToggle = currentLayout === "default" ? "shift" : "default";
|
||||
keyboard.setOptions({
|
||||
layoutName: shiftToggle
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
})()
|
Loading…
Add table
Add a link
Reference in a new issue