This commit is contained in:
minjaesong
2023-07-06 22:07:21 +09:00
parent 1e6f51e16c
commit 02cf5fdce5
2 changed files with 62 additions and 55 deletions

View File

@@ -4,16 +4,16 @@ let states = {"keylayouts":[[""],[undefined],
[undefined],
[undefined],
[undefined],
["0",")","\u0966",")"],
["1","\u090D","\u0967","!"],
["2","\u0945","\u0968","@"],
["3","\u094D\u0930","\u0969","#"],
["4","\u0930\u094D","\u096A","$"],
["5","\u091C\u094D\u091E","\u096B","%"],
["6","\u0924\u094D\u0930","\u096C","^"],
["7","\u0915\u094D\u0937","\u096D","&"],
["8","\u0936\u094D\u0930","\u096E","*"],
["9","(","\u096F","("],
["0",")"],
["1","!"],
["2","@"],
["3","#"],
["4","$"],
["5","%"],
["6","^"],
["7","&"],
["8","*"],
["9","("],
["*"],
["#"],
[undefined],
@@ -26,34 +26,34 @@ let states = {"keylayouts":[[""],[undefined],
[undefined],
[undefined],
[undefined],
["\u094B","\u0913"],
["\u0935","\u0934"],
["\u092E","\u0923","\u0954","\u0923"],
["\u094D","\u0905"],
["\u093E","\u0906"],
["\u093F","\u0907","\u0962","\u090C"],
["\u0941","\u0909"],
["\u092A","\u092B","\u092A","\u095E"],
["\u0917","\u0918","\u095A","\u0918"],
["\u0930","\u0931"],
["\u0915","\u0916","\u0958","\u0959"],
["\u0924","\u0925"],
["\u0938","\u0936"],
["\u0932","\u0933"],
["\u0926","\u0927"],
["\u091C","\u091D","\u095B","\u091D"],
["\u094C","\u0914"],
["\u0940","\u0908","\u0963","\u0961"],
["\u094B","\u090F"],
["\u0942","\u090A"],
["\u0939","\u0919"],
["\u0928","\u0929"],
["\u0948","\u0910"],
["\u0902","\u0901","\u0902","\u0950"],
["\u092C","\u092D"],
["\u0946","\u090E","\u0953","\u090E"],
[",","\u0937","\u0970","\u0970"],
[".","\u0964","\u0965","\u093D"],
["\u0B85","\u0BF9"],
["\u0B99","\u0BF7"],
["\u0B92","\u0BF5","\u0BCA"],
["\u0B89","\u0BF8","\u0BC1"],
["\u0B8A","\u0B9C","\u0BC2"],
["\u0BCD","\u0B83"],
["\u0B8E","\u0B8E","\u0BC6"],
["\u0B95","\u0B95"],
["\u0BA9","\u0BA9"],
["\u0BAA","\u0BAA"],
["\u0BAE",'"'],
["\u0BA4",":"],
["\u0BB0","/"],
["\u0BB2","\u0BB2"],
["\u0B9F","["],
["\u0BA3","]"],
["\u0B86","\u0BB8","\u0BBE"],
["\u0B90","\u0BB9","\u0BC8"],
["\u0B87","\u0BFA","\u0BBF"],
["\u0B8F","\u0B95\u0BCD\u0BB7","\u0BC7"],
["\u0BB1","\u0BB1"],
["\u0BB5","\u0BF6"],
["\u0B88","\u0BB7","\u0BC0"],
["\u0B93","\u0BF4","\u0BCB"],
["\u0BB3","\u0BB8\u0BCD\u0BB0\u0BC0"],
["\u0B94","\u0BF3","\u0BCC"],
[",","<"],
[".",">"],
[undefined],
[undefined],
[undefined],
@@ -65,15 +65,15 @@ let states = {"keylayouts":[[""],[undefined],
[undefined],
["\n"],
["\x08"],
["\u094A","\u0912"],
["-","\u0903"],
["\u0943","\u090B","\u0944","\u0960"],
["\u0921","\u0922","\u095C","\u095D"],
["\u093C","\u091E"],
["\u0949","\u0911"],
["\u091A","\u091B","\u0952","\u091B"],
["\u091F","\u0920","\u0951","\u0920"],
["\u092F","\u095F"],
["`","~"],
["-","_"],
["=","+"],
["\u0B9A","{"],
["\u0B9E","}"],
["\\","|"],
["\u0BA8",";"],
["\u0BAF","'"],
["\u0BB4","?"],
[undefined],
[undefined],
[undefined],
@@ -254,19 +254,26 @@ let states = {"keylayouts":[[""],[undefined],
[undefined],
[undefined]
],
"code":""} // practically unused as long as there are no diacritics on the keyboard
"code":""} // the last character typed
let reset = () => {
states.code = 0
states.code = ""
}
let inRange = (s,a,b) => (a <= s && s <= b)
return Object.freeze({"n":"इनस्क्रिप्ट","v":"none","c":"CuriousTo\uA75Bvald","m":"rewrite",
"t":states.keylayouts.slice(0,10).concat([["3","\uDBBF\uDE01\u094D\u0930","\u0969","#"], ["4","\u0930\u094D\uDBBF\uDE01","\u096A","$"]], states.keylayouts.slice(12)),
"l":"hiIN",
let isConsonant = (s) => s !== undefined && (inRange(s, 0x0B95, 0x0BB9) || s == 0x0BD0 || inRange(s, 0x0BE6, 0x0BFA)) // determines the behaviour of the vowel key
return Object.freeze({"n":"தமிழ் 99","v":"none","c":"CuriousTo\uA75Bvald","m":"rewrite",
"t":states.keylayouts,
"l":"taIN",
// return: [delete count, composed output]
"accept":(headkey,shiftin,altgrin)=>{
let layer = 1*shiftin + 2*altgrin
let layer = 1*shiftin
let s = (states.keylayouts[headkey][layer] || states.keylayouts[headkey][1*shiftin]) || states.keylayouts[headkey][0]
let s = states.keylayouts[headkey][layer] || states.keylayouts[headkey][0]
if (layer == 0 && states.code != "" && isConsonant(states.code.charCodeAt(states.code.length - 1))) {
s = states.keylayouts[headkey][2] || states.keylayouts[headkey][0]
}
states.code = s
return ['0', s]
},