spiegel-keyman/web/testing/web_context_tests.js

1473 lines
35 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

if(typeof keyman === 'undefined') {
console.log('Keyboard requires KeymanWeb 10.0 or later');
if(typeof tavultesoft !== 'undefined') tavultesoft.keymanweb.util.alert("This keyboard requires KeymanWeb 10.0 or later");
} else {
KeymanWeb.KR(new Keyboard_web_context_tests());
}
function Keyboard_web_context_tests()
{
var modCodes = keyman.osk.modifierCodes;
var keyCodes = keyman.osk.keyCodes;
this._v=(typeof keyman!="undefined"&&typeof keyman.version=="string")?parseInt(keyman.version,10):9;
this.KI="Keyboard_web_context_tests";
this.KN="web_context_tests";
this.KMINVER="10.0";
this.KV={F:' 1em "Arial"',K102:0};
this.KV.KLS={
};
this.KV.BK=(function(x){
var
empty=Array.apply(null, Array(65)).map(String.prototype.valueOf,""),
result=[], v, i,
modifiers=['default','shift','ctrl','shift-ctrl','alt','shift-alt','ctrl-alt','shift-ctrl-alt'];
for(i=modifiers.length-1;i>=0;i--) {
v = x[modifiers[i]];
if(v || result.length > 0) {
result=(v ? v : empty).slice().concat(result);
}
}
return result;
})(this.KV.KLS);
this.KDU=0;
this.KH='';
this.KM=0;
this.KBVER="1.0";
this.KMBM=0 /* 0x0000 */;
this.KS=1;
this.KVKL={
"phone": {
"font": "Tahoma",
"displayUnderlying": false,
"layer": [
{
"id": "default",
"row": [
{
"id": "1",
"key": [
{
"id": "K_Q",
"text": "q"
},
{
"id": "K_W",
"text": "w"
},
{
"id": "K_E",
"text": "e"
},
{
"id": "K_R",
"text": "r"
},
{
"id": "K_T",
"text": "t"
},
{
"id": "K_Y",
"text": "y"
},
{
"id": "K_U",
"text": "u"
},
{
"id": "K_I",
"text": "i"
},
{
"id": "K_O",
"text": "o"
},
{
"id": "K_P",
"text": "p"
}
]
},
{
"id": "2",
"key": [
{
"id": "K_A",
"pad": "50",
"text": "a"
},
{
"id": "K_S",
"text": "s"
},
{
"id": "K_D",
"text": "d"
},
{
"id": "K_F",
"text": "f"
},
{
"id": "K_G",
"text": "g"
},
{
"id": "K_H",
"text": "h"
},
{
"id": "K_J",
"text": "j"
},
{
"id": "K_K",
"text": "k"
},
{
"id": "K_L",
"text": "l"
},
{
"width": "10",
"sp": "10"
}
]
},
{
"id": "3",
"key": [
{
"nextlayer": "shift",
"id": "K_SHIFT",
"sp": "1",
"text": "*Shift*"
},
{
"id": "K_Z",
"text": "z"
},
{
"id": "K_X",
"text": "x"
},
{
"id": "K_C",
"text": "c"
},
{
"id": "K_V",
"text": "v"
},
{
"id": "K_B",
"text": "b"
},
{
"id": "K_N",
"text": "n"
},
{
"id": "K_M",
"text": "m"
},
{
"id": "K_PERIOD",
"text": ".",
"sk": [
{
"id": "K_COMMA",
"text": ","
},
{
"layer": "shift",
"id": "K_1",
"text": "!"
},
{
"layer": "shift",
"id": "K_SLASH",
"text": "?"
},
{
"id": "K_QUOTE",
"text": "'"
},
{
"layer": "shift",
"id": "K_QUOTE",
"text": "\""
},
{
"id": "K_BKSLASH",
"text": "\\"
},
{
"layer": "shift",
"id": "K_COLON",
"text": ":"
},
{
"id": "K_COLON",
"text": ";"
}
]
},
{
"width": "100",
"id": "K_BKSP",
"sp": "1",
"text": "*BkSp*"
}
]
},
{
"id": "4",
"key": [
{
"nextlayer": "numeric",
"width": "150",
"id": "K_NUMLOCK",
"sp": "1",
"text": "*123*"
},
{
"width": "120",
"id": "K_LOPT",
"sp": "1",
"text": "*Menu*"
},
{
"width": "610",
"id": "K_SPACE"
},
{
"width": "150",
"id": "K_ENTER",
"sp": "1",
"text": "*Enter*"
}
]
}
]
},
{
"id": "shift",
"row": [
{
"id": "1",
"key": [
{
"id": "K_Q",
"text": "Q"
},
{
"id": "K_W",
"text": "W"
},
{
"id": "K_E",
"text": "E"
},
{
"id": "K_R",
"text": "R"
},
{
"id": "K_T",
"text": "T"
},
{
"id": "K_Y",
"text": "Y"
},
{
"id": "K_U",
"text": "U"
},
{
"id": "K_I",
"text": "I"
},
{
"id": "K_O",
"text": "O"
},
{
"id": "K_P",
"text": "P"
}
]
},
{
"id": "2",
"key": [
{
"id": "K_A",
"pad": "50",
"text": "A"
},
{
"id": "K_S",
"text": "S"
},
{
"id": "K_D",
"text": "D"
},
{
"id": "K_F",
"text": "F"
},
{
"id": "K_G",
"text": "G"
},
{
"id": "K_H",
"text": "H"
},
{
"id": "K_J",
"text": "J"
},
{
"id": "K_K",
"text": "K"
},
{
"id": "K_L",
"text": "L"
},
{
"width": "10",
"sp": "10"
}
]
},
{
"id": "3",
"key": [
{
"nextlayer": "default",
"id": "K_SHIFT",
"sp": "2",
"text": "*Shift*"
},
{
"id": "K_Z",
"text": "Z"
},
{
"id": "K_X",
"text": "X"
},
{
"id": "K_C",
"text": "C"
},
{
"id": "K_V",
"text": "V"
},
{
"id": "K_B",
"text": "B"
},
{
"id": "K_N",
"text": "N"
},
{
"id": "K_M",
"text": "M"
},
{
"layer": "default",
"id": "K_PERIOD",
"text": ".",
"sk": [
{
"layer": "default",
"id": "K_COMMA",
"text": ","
},
{
"layer": "shift",
"id": "K_1",
"text": "!"
},
{
"layer": "shift",
"id": "K_SLASH",
"text": "?"
},
{
"layer": "default",
"id": "K_QUOTE",
"text": "'"
},
{
"layer": "shift",
"id": "K_QUOTE",
"text": "\""
},
{
"layer": "default",
"id": "K_BKSLASH",
"text": "\\"
},
{
"layer": "shift",
"id": "K_COLON",
"text": ":"
},
{
"layer": "default",
"id": "K_COLON",
"text": ";"
}
]
},
{
"id": "K_BKSP",
"sp": "1",
"text": "*BkSp*"
}
]
},
{
"id": "4",
"key": [
{
"nextlayer": "numeric",
"width": "150",
"id": "K_NUMLOCK",
"sp": "1",
"text": "*123*"
},
{
"width": "120",
"id": "K_LOPT",
"sp": "1",
"text": "*Menu*"
},
{
"width": "610",
"id": "K_SPACE"
},
{
"width": "150",
"id": "K_ENTER",
"sp": "1",
"text": "*Enter*"
}
]
}
]
},
{
"id": "numeric",
"row": [
{
"id": "1",
"key": [
{
"id": "K_1",
"text": "1"
},
{
"id": "K_2",
"text": "2"
},
{
"id": "K_3",
"text": "3"
},
{
"id": "K_4",
"text": "4"
},
{
"id": "K_5",
"text": "5"
},
{
"id": "K_6",
"text": "6"
},
{
"id": "K_7",
"text": "7"
},
{
"id": "K_8",
"text": "8"
},
{
"id": "K_9",
"text": "9"
},
{
"id": "K_0",
"text": "0"
}
]
},
{
"id": "2",
"key": [
{
"layer": "shift",
"id": "K_4",
"pad": "50",
"text": "$"
},
{
"layer": "shift",
"id": "K_2",
"text": "@"
},
{
"layer": "shift",
"id": "K_3",
"text": "#"
},
{
"layer": "shift",
"id": "K_5",
"text": "%"
},
{
"layer": "shift",
"id": "K_7",
"text": "&"
},
{
"layer": "shift",
"id": "K_HYPHEN",
"text": "_"
},
{
"layer": "default",
"id": "K_EQUAL",
"text": "="
},
{
"layer": "shift",
"id": "K_BKSLASH",
"text": "|"
},
{
"layer": "default",
"id": "K_BKSLASH",
"text": "\\"
},
{
"width": "10",
"sp": "10"
}
]
},
{
"id": "3",
"key": [
{
"id": "K_LBRKT",
"pad": "110",
"text": "[",
"sk": [
{
"id": "U_00AB",
"text": "\u00AB"
},
{
"layer": "shift",
"id": "K_COMMA",
"text": "<"
},
{
"layer": "shift",
"id": "K_LBRKT",
"text": "{"
}
]
},
{
"layer": "shift",
"id": "K_9",
"text": "("
},
{
"layer": "shift",
"id": "K_0",
"text": ")"
},
{
"id": "K_RBRKT",
"text": "]",
"sk": [
{
"id": "U_00BB",
"text": "\u00BB"
},
{
"layer": "shift",
"id": "K_PERIOD",
"text": ">"
},
{
"layer": "shift",
"id": "K_RBRKT",
"text": "}"
}
]
},
{
"layer": "shift",
"id": "K_EQUAL",
"text": "+"
},
{
"id": "K_HYPHEN",
"text": "-"
},
{
"layer": "shift",
"id": "K_8",
"text": "*"
},
{
"id": "K_SLASH",
"text": "/"
},
{
"width": "100",
"id": "K_BKSP",
"sp": "1",
"text": "*BkSp*"
}
]
},
{
"id": "4",
"key": [
{
"nextlayer": "default",
"width": "150",
"id": "K_LOWER",
"sp": "1",
"text": "*abc*"
},
{
"width": "120",
"id": "K_LOPT",
"sp": "1",
"text": "*Menu*"
},
{
"width": "610",
"id": "K_SPACE"
},
{
"width": "150",
"id": "K_ENTER",
"sp": "1",
"text": "*Enter*"
}
]
}
]
}
]
},
"tablet": {
"font": "Tahoma",
"displayUnderlying": false,
"layer": [
{
"id": "default",
"row": [
{
"id": "1",
"key": [
{
"id": "K_Q",
"text": "q"
},
{
"id": "K_W",
"text": "w"
},
{
"id": "K_E",
"text": "e"
},
{
"id": "K_R",
"text": "r"
},
{
"id": "K_T",
"text": "t"
},
{
"id": "K_Y",
"text": "y"
},
{
"id": "K_U",
"text": "u"
},
{
"id": "K_I",
"text": "i"
},
{
"id": "K_O",
"text": "o"
},
{
"id": "K_P",
"text": "p"
}
]
},
{
"id": "2",
"key": [
{
"id": "K_A",
"pad": "70",
"text": "a"
},
{
"id": "K_S",
"text": "s"
},
{
"id": "K_D",
"text": "d"
},
{
"id": "K_F",
"text": "f"
},
{
"id": "K_G",
"text": "g"
},
{
"id": "K_H",
"text": "h"
},
{
"id": "K_J",
"text": "j"
},
{
"id": "K_K",
"text": "k"
},
{
"id": "K_L",
"text": "l"
},
{
"width": "10",
"sp": "10"
}
]
},
{
"id": "3",
"key": [
{
"nextlayer": "shift",
"width": "110",
"id": "K_SHIFT",
"sp": "1",
"text": "*Shift*"
},
{
"id": "K_Z",
"text": "z"
},
{
"id": "K_X",
"text": "x"
},
{
"id": "K_C",
"text": "c"
},
{
"id": "K_V",
"text": "v"
},
{
"id": "K_B",
"text": "b"
},
{
"id": "K_N",
"text": "n"
},
{
"id": "K_M",
"text": "m"
},
{
"id": "K_PERIOD",
"text": ".",
"sk": [
{
"id": "K_COMMA",
"text": ","
},
{
"layer": "shift",
"id": "K_1",
"text": "!"
},
{
"layer": "shift",
"id": "K_SLASH",
"text": "?"
},
{
"id": "K_QUOTE",
"text": "'"
},
{
"layer": "shift",
"id": "K_QUOTE",
"text": "\""
},
{
"id": "K_BKSLASH",
"text": "\\"
},
{
"layer": "shift",
"id": "K_COLON",
"text": ":"
},
{
"id": "K_COLON",
"text": ";"
}
]
},
{
"width": "90",
"id": "K_BKSP",
"sp": "1",
"text": "*BkSp*"
}
]
},
{
"id": "4",
"key": [
{
"nextlayer": "numeric",
"width": "140",
"id": "K_NUMLOCK",
"sp": "1",
"text": "*123*"
},
{
"width": "120",
"id": "K_LOPT",
"sp": "1",
"text": "*Menu*"
},
{
"width": "630",
"id": "K_SPACE"
},
{
"width": "140",
"id": "K_ENTER",
"sp": "1",
"text": "*Enter*"
}
]
}
]
},
{
"id": "shift",
"row": [
{
"id": "1",
"key": [
{
"id": "K_Q",
"text": "Q"
},
{
"id": "K_W",
"text": "W"
},
{
"id": "K_E",
"text": "E"
},
{
"id": "K_R",
"text": "R"
},
{
"id": "K_T",
"text": "T"
},
{
"id": "K_Y",
"text": "Y"
},
{
"id": "K_U",
"text": "U"
},
{
"id": "K_I",
"text": "I"
},
{
"id": "K_O",
"text": "O"
},
{
"id": "K_P",
"text": "P"
}
]
},
{
"id": "2",
"key": [
{
"id": "K_A",
"pad": "70",
"text": "A"
},
{
"id": "K_S",
"text": "S"
},
{
"id": "K_D",
"text": "D"
},
{
"id": "K_F",
"text": "F"
},
{
"id": "K_G",
"text": "G"
},
{
"id": "K_H",
"text": "H"
},
{
"id": "K_J",
"text": "J"
},
{
"id": "K_K",
"text": "K"
},
{
"id": "K_L",
"text": "L"
},
{
"width": "10",
"sp": "10"
}
]
},
{
"id": "3",
"key": [
{
"nextlayer": "default",
"width": "110",
"id": "K_SHIFT",
"sp": "2",
"text": "*Shift*"
},
{
"id": "K_Z",
"text": "Z"
},
{
"id": "K_X",
"text": "X"
},
{
"id": "K_C",
"text": "C"
},
{
"id": "K_V",
"text": "V"
},
{
"id": "K_B",
"text": "B"
},
{
"id": "K_N",
"text": "N"
},
{
"id": "K_M",
"text": "M"
},
{
"layer": "default",
"id": "K_PERIOD",
"text": ".",
"sk": [
{
"layer": "default",
"id": "K_COMMA",
"text": ","
},
{
"layer": "shift",
"id": "K_1",
"text": "!"
},
{
"layer": "shift",
"id": "K_SLASH",
"text": "?"
},
{
"layer": "default",
"id": "K_QUOTE",
"text": "'"
},
{
"layer": "shift",
"id": "K_QUOTE",
"text": "\""
},
{
"layer": "default",
"id": "K_BKSLASH",
"text": "\\"
},
{
"layer": "shift",
"id": "K_COLON",
"text": ":"
},
{
"layer": "default",
"id": "K_COLON",
"text": ";"
}
]
},
{
"width": "90",
"id": "K_BKSP",
"sp": "1",
"text": "*BkSp*"
}
]
},
{
"id": "4",
"key": [
{
"nextlayer": "numeric",
"width": "140",
"id": "K_NUMLOCK",
"sp": "1",
"text": "*123*"
},
{
"width": "120",
"id": "K_LOPT",
"sp": "1",
"text": "*Menu*"
},
{
"width": "630",
"id": "K_SPACE"
},
{
"width": "140",
"id": "K_ENTER",
"sp": "1",
"text": "*Enter*"
}
]
}
]
},
{
"id": "numeric",
"row": [
{
"id": "1",
"key": [
{
"id": "K_1",
"text": "1"
},
{
"id": "K_2",
"text": "2"
},
{
"id": "K_3",
"text": "3"
},
{
"id": "K_4",
"text": "4"
},
{
"id": "K_5",
"text": "5"
},
{
"id": "K_6",
"text": "6"
},
{
"id": "K_7",
"text": "7"
},
{
"id": "K_8",
"text": "8"
},
{
"id": "K_9",
"text": "9"
},
{
"id": "K_0",
"text": "0"
}
]
},
{
"id": "2",
"key": [
{
"layer": "shift",
"id": "K_4",
"pad": "70",
"text": "$"
},
{
"layer": "shift",
"id": "K_2",
"text": "@"
},
{
"layer": "shift",
"id": "K_3",
"text": "#"
},
{
"layer": "shift",
"id": "K_5",
"text": "%"
},
{
"layer": "shift",
"id": "K_7",
"text": "&"
},
{
"layer": "shift",
"id": "K_HYPHEN",
"text": "_"
},
{
"layer": "default",
"id": "K_EQUAL",
"text": "="
},
{
"layer": "shift",
"id": "K_BKSLASH",
"text": "|"
},
{
"layer": "default",
"id": "K_BKSLASH",
"text": "\\"
},
{
"width": "10",
"sp": "10"
}
]
},
{
"id": "3",
"key": [
{
"width": "110",
"id": "K_SHIFT",
"sp": "1",
"text": "*Shift*"
},
{
"id": "K_LBRKT",
"text": "[",
"sk": [
{
"id": "U_00AB",
"text": "\u00AB"
},
{
"layer": "shift",
"id": "K_COMMA",
"text": "<"
},
{
"layer": "shift",
"id": "K_LBRKT",
"text": "{"
}
]
},
{
"layer": "shift",
"id": "K_9",
"text": "("
},
{
"layer": "shift",
"id": "K_0",
"text": ")"
},
{
"id": "K_RBRKT",
"text": "]",
"sk": [
{
"id": "U_00BB",
"text": "\u00BB"
},
{
"layer": "shift",
"id": "K_PERIOD",
"text": ">"
},
{
"layer": "shift",
"id": "K_RBRKT",
"text": "}"
}
]
},
{
"layer": "shift",
"id": "K_EQUAL",
"text": "+"
},
{
"layer": "default",
"id": "K_HYPHEN",
"text": "-"
},
{
"layer": "shift",
"id": "K_8",
"text": "*"
},
{
"layer": "default",
"id": "K_SLASH",
"text": "/"
},
{
"width": "90",
"id": "K_BKSP",
"sp": "1",
"text": "*BkSp*"
}
]
},
{
"id": "4",
"key": [
{
"nextlayer": "default",
"width": "140",
"id": "K_LOWER",
"sp": "1",
"text": "*abc*"
},
{
"width": "120",
"id": "K_LOPT",
"sp": "1",
"text": "*Menu*"
},
{
"width": "630",
"id": "K_SPACE"
},
{
"width": "140",
"id": "K_ENTER",
"sp": "1",
"text": "*Enter*"
}
]
}
]
}
]
}
}
;
this.KVER="15.0.195.0";
this.KVS=[];
this.gs=function(t,e) {
return this.g_main_0(t,e);
};
this.gs=function(t,e) {
return this.g_main_0(t,e);
};
this.g_main_0=function(t,e) {
var k=KeymanWeb,r=0,m=0;
if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_D /* 0x44 */)) {
if(k.KFCM(3,t,['a','b','c'])){
r=m=1; // Line 15
k.KDC(3,t);
k.KO(-1,t,"!");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_F /* 0x46 */)) {
if(1){
r=m=1; // Line 21
k.KDC(0,t);
k.KO(-1,t,"𐌀");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_G /* 0x47 */)) {
if(1){
r=m=1; // Line 22
k.KDC(0,t);
k.KO(-1,t,"𐌁");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_H /* 0x48 */)) {
if(1){
r=m=1; // Line 23
k.KDC(0,t);
k.KO(-1,t,"𐌂");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_I /* 0x49 */)) {
if(k.KFCM(3,t,['𐌀','𐌁','𐌂'])){
r=m=1; // Line 24
k.KDC(3,t);
k.KO(-1,t,"𐌙");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_J /* 0x4A */)) {
if(1){
r=m=1; // Line 25
k.KDC(0,t);
k.KO(-1,t,"𐌈");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_K /* 0x4B */)) {
if(1){
r=m=1; // Line 29
k.KDC(0,t);
k.KO(-1,t,"𐌰");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_L /* 0x4C */)) {
if(1){
r=m=1; // Line 30
k.KDC(0,t);
k.KO(-1,t,"B");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_M /* 0x4D */)) {
if(1){
r=m=1; // Line 31
k.KDC(0,t);
k.KO(-1,t,"𐌲");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_N /* 0x4E */)) {
if(k.KFCM(3,t,['𐌰','B','𐌲'])){
r=m=1; // Line 32
k.KDC(3,t);
k.KO(-1,t,"𐌽");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_O /* 0x4F */)) {
if(1){
r=m=1; // Line 33
k.KDC(0,t);
k.KO(-1,t,"𐍈");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_P /* 0x50 */)) {
if(1){
r=m=1; // Line 37
k.KDC(0,t);
k.KO(-1,t,"q");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_R /* 0x52 */)) {
if(1){
r=m=1; // Line 43
k.KDC(0,t);
k.KO(-1,t,"tuv");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_S /* 0x53 */)) {
if(1){
r=m=1; // Line 44
k.KDC(0,t);
k.KO(-1,t,"𐍈x");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_T /* 0x54 */)) {
if(1){
r=m=1; // Line 45
k.KDC(0,t);
k.KO(-1,t,"𐍈x𐌈");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_U /* 0x55 */)) {
if(1){
r=m=1; // Line 46
k.KDC(0,t);
k.KO(-1,t,"𐍈𐌈𐌰");
}
}
else if(k.KKM(e, modCodes.VIRTUAL_KEY /* 0x4000 */, keyCodes.K_V /* 0x56 */)) {
if(1){
r=m=1; // Line 47
k.KDC(0,t);
k.KO(-1,t,"𐍈𐌈x𐌰");
}
}
return r;
};
}