keyboard.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. function keys(type,lang) {
  2. var i;
  3. var j;
  4. var id;
  5. var rowslower = ["AElower","ADlower","AClower","ABlower"];
  6. var rowsupper = ["AEupper","ADupper","ACupper","ABupper"];
  7. var rowslower1 = ["AElower1","ADlower1","AClower1","ABlower1"];
  8. var rowsupper1 = ["AEupper1","ADupper1","ACupper1","ABupper1"];
  9. var idstart = ["AE0","AD0","AC0","AB0"];
  10. var idstart2 = ["AE","AD","AC","AB"];
  11. var rowend = [12,13,11,10];
  12. for ( j = 0; j<=3; j++) {
  13. if (lang==="afr") {
  14. var keyslower = afrikaanskeys(rowslower[j]);
  15. var keysupper = afrikaanskeys(rowsupper[j]);
  16. var keyslower1 = afrikaanskeys(rowslower1[j]);
  17. var keysupper1 = afrikaanskeys(rowsupper1[j]);
  18. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  19. } else if (lang==="aka") {
  20. var keyslower = akankeys(rowslower[j]);
  21. var keysupper = akankeys(rowsupper[j]);
  22. var keyslower1 = akankeys(rowslower1[j]);
  23. var keysupper1 = akankeys(rowsupper1[j]);
  24. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  25. } else if (lang==="amh") {
  26. var keyslower = amharickeys(rowslower[j]);
  27. var keysupper = amharickeys(rowsupper[j]);
  28. var keyslower1 = amharickeys(rowslower1[j]);
  29. var keysupper1 = amharickeys(rowsupper1[j]);
  30. var fontstyle = "font-family:NotoSansEthiopic-Regular,NotoSans-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  31. } else if (lang==="ara") {
  32. var keyslower = arabickeys(rowslower[j]);
  33. var keysupper = arabickeys(rowsupper[j]);
  34. var keyslower1 = arabickeys(rowslower1[j]);
  35. var keysupper1 = arabickeys(rowsupper1[j]);
  36. var fontstyle = "font-family:NotoSansArabic-Regular,NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansNKo-Regular";
  37. } else if (lang==="teo") {
  38. var keyslower = atesokeys(rowslower[j]);
  39. var keysupper = atesokeys(rowsupper[j]);
  40. var keyslower1 = atesokeys(rowslower1[j]);
  41. var keysupper1 = atesokeys(rowsupper1[j]);
  42. var fontstyle = "font-family:NotoSansArabic-Regular,NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansNKo-Regular";
  43. } else if (lang==="bem") {
  44. var keyslower = bembakeys(rowslower[j]);
  45. var keysupper = bembakeys(rowsupper[j]);
  46. var keyslower1 = bembakeys(rowslower1[j]);
  47. var keysupper1 = bembakeys(rowsupper1[j]);
  48. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  49. } else if (lang==="cam") {
  50. var keyslower = camerooniankeys(rowslower[j]);
  51. var keysupper = camerooniankeys(rowsupper[j]);
  52. var keyslower1 = camerooniankeys(rowslower1[j]);
  53. var keysupper1 = camerooniankeys(rowsupper1[j]);
  54. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  55. } else if (lang==="dag") {
  56. var keyslower = dagbanikeys(rowslower[j]);
  57. var keysupper = dagbanikeys(rowsupper[j]);
  58. var keyslower1 = dagbanikeys(rowslower1[j]);
  59. var keysupper1 = dagbanikeys(rowsupper1[j]);
  60. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  61. } else if (lang==="eng") {
  62. var keyslower = englishkeys(rowslower[j]);
  63. var keysupper = englishkeys(rowsupper[j]);
  64. var keyslower1 = englishkeys(rowslower1[j]);
  65. var keysupper1 = englishkeys(rowsupper1[j]);
  66. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  67. } else if (lang==="ewe") {
  68. var keyslower = ewekeys(rowslower[j]);
  69. var keysupper = ewekeys(rowsupper[j]);
  70. var keyslower1 = ewekeys(rowslower1[j]);
  71. var keysupper1 = ewekeys(rowsupper1[j]);
  72. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  73. } else if (lang==="ga") {
  74. var keyslower = gakeys(rowslower[j]);
  75. var keysupper = gakeys(rowsupper[j]);
  76. var keyslower1 = gakeys(rowslower1[j]);
  77. var keysupper1 = gakeys(rowsupper1[j]);
  78. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  79. } else if (lang==="hau") {
  80. var keyslower = hausakeys(rowslower[j]);
  81. var keysupper = hausakeys(rowsupper[j]);
  82. var keyslower1 = hausakeys(rowslower1[j]);
  83. var keysupper1 = hausakeys(rowsupper1[j]);
  84. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  85. } else if (lang==="igb") {
  86. var keyslower = igbokeys(rowslower[j]);
  87. var keysupper = igbokeys(rowsupper[j]);
  88. var keyslower1 = igbokeys(rowslower1[j]);
  89. var keysupper1 = igbokeys(rowsupper1[j]);
  90. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  91. } else if (lang==="kik") {
  92. var keyslower = kikuyukeys(rowslower[j]);
  93. var keysupper = kikuyukeys(rowsupper[j]);
  94. var keyslower1 = kikuyukeys(rowslower1[j]);
  95. var keysupper1 = kikuyukeys(rowsupper1[j]);
  96. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  97. } else if (lang==="lin") {
  98. var keyslower = lingalakeys(rowslower[j]);
  99. var keysupper = lingalakeys(rowsupper[j]);
  100. var keyslower1 = lingalakeys(rowslower1[j]);
  101. var keysupper1 = lingalakeys(rowsupper1[j]);
  102. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  103. } else if (lang==="lug") {
  104. var keyslower = lugandakeys(rowslower[j]);
  105. var keysupper = lugandakeys(rowsupper[j]);
  106. var keyslower1 = lugandakeys(rowslower1[j]);
  107. var keysupper1 = lugandakeys(rowsupper1[j]);
  108. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  109. } else if (lang==="mal") {
  110. var keyslower = malikeys(rowslower[j]);
  111. var keysupper = malikeys(rowsupper[j]);
  112. var keyslower1 = malikeys(rowslower1[j]);
  113. var keysupper1 = malikeys(rowsupper1[j]);
  114. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  115. } else if (lang==="ses") {
  116. var keyslower = sesothokeys(rowslower[j]);
  117. var keysupper = sesothokeys(rowsupper[j]);
  118. var keyslower1 = sesothokeys(rowslower1[j]);
  119. var keysupper1 = sesothokeys(rowsupper1[j]);
  120. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  121. } else if (lang==="tog") {
  122. var keyslower = togokeys(rowslower[j]);
  123. var keysupper = togokeys(rowsupper[j]);
  124. var keyslower1 = togokeys(rowslower1[j]);
  125. var keysupper1 = togokeys(rowsupper1[j]);
  126. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  127. } else if (lang==="wol") {
  128. var keyslower = wolofkeys(rowslower[j]);
  129. var keysupper = wolofkeys(rowsupper[j]);
  130. var keyslower1 = wolofkeys(rowslower1[j]);
  131. var keysupper1 = wolofkeys(rowsupper1[j]);
  132. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  133. } else if (lang==="yor") {
  134. var keyslower = yorubakeys(rowslower[j]);
  135. var keysupper = yorubakeys(rowsupper[j]);
  136. var keyslower1 = yorubakeys(rowslower1[j]);
  137. var keysupper1 = yorubakeys(rowsupper1[j]);
  138. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  139. }else {
  140. var keyslower = englishkeys(rowslower[j]);
  141. var keysupper = englishkeys(rowsupper[j]);
  142. var keyslower1 = englishkeys(rowslower1[j]);
  143. var keysupper1 = englishkeys(rowsupper1[j]);
  144. var fontstyle = "font-family:NotoSans-Regular,NotoSansEthiopic-Regular,NotoSansArabic-Regular,NotoSansNKo-Regular";
  145. }
  146. if (j===0) {
  147. document.getElementById("TLDE").innerHTML =
  148. "<font color='Red'>"+getst(keysupper[0])+"</font>"
  149. +"&nbsp;&nbsp;&nbsp;"
  150. +"<font color='DarkMagenta'>"+getst(keysupper1[0])+"</font>"
  151. +"<br>"
  152. +"<font color='Black'>"+getst(keyslower[0])+"</font>"
  153. +"&nbsp;&nbsp;&nbsp;"
  154. +"<font color='DeepSkyBlue'>"+getst(keyslower1[0])+"</font>";
  155. if (type==="upper") {
  156. document.getElementById("TLDE").value = keysupper[0];
  157. } else if (type==="upper1") {
  158. document.getElementById("TLDE").value = keysupper1[0];
  159. } else if (type==="lower1") {
  160. document.getElementById("TLDE").value = keyslower1[0];
  161. } else {
  162. document.getElementById("TLDE").value = keyslower[0];
  163. }
  164. document.getElementById("TLDE").style = "width:40px;"+fontstyle;
  165. console.log(fontstyle);
  166. }
  167. for (i = 1; i <= rowend[j]; i++) {
  168. id = idstart[j] + i;
  169. if (i > 9) {
  170. id = idstart2[j] + i;
  171. }
  172. document.getElementById(id).innerHTML =
  173. "<font color='Red'>"+getst(keysupper[i])+"</font>"
  174. +"&nbsp;&nbsp;&nbsp;"
  175. +"<font color='DarkMagenta'>"+getst(keysupper1[i])+"</font>"
  176. +"<br>"
  177. +"<font color='Black'>"+getst(keyslower[i])+"</font>"
  178. +"&nbsp;&nbsp;&nbsp;"
  179. +"<font color='DeepSkyBlue'>"+getst(keyslower1[i])+"</font>";
  180. if (type==="upper") {
  181. document.getElementById(id).value = keysupper[i];
  182. } else if (type==="upper1") {
  183. document.getElementById(id).value = keysupper1[i];
  184. } else if (type==="lower1") {
  185. document.getElementById(id).value = keyslower1[i];
  186. } else {
  187. document.getElementById(id).value = keyslower[i];
  188. }
  189. document.getElementById(id).style = fontstyle;
  190. }
  191. }
  192. }
  193. function keyboard(lang) {
  194. document.getElementById("ShiftR").value = "ShiftOff";
  195. document.getElementById("ShiftL").value = "ShiftOff";
  196. document.getElementById("Caps").value = "CapsOff";
  197. keys("lower",lang);
  198. }
  199. function changecase(lang) {
  200. var CapsVal = document.getElementById("Caps").value;
  201. if (CapsVal === "CapsOff") {
  202. document.getElementById("Caps").innerHTML =
  203. '&nbsp; &nbsp;<br><font color="Red"><strong>Caps</strong></font> &nbsp;';
  204. document.getElementById("Caps").value = "CapsOn";
  205. } else {
  206. document.getElementById("Caps").innerHTML =
  207. '&nbsp; &nbsp;<br><font color="Red">Caps</font> &nbsp;';
  208. document.getElementById("Caps").value = "CapsOff";
  209. }
  210. getkeys(lang);
  211. }
  212. function shift(lang) {
  213. var shift = document.getElementById("ShiftR").value;
  214. if (shift === "ShiftOff") {
  215. document.getElementById("ShiftR").value = "ShiftOn";
  216. document.getElementById("ShiftL").value = "ShiftOn";
  217. } else {
  218. document.getElementById("ShiftR").value = "ShiftOff";
  219. document.getElementById("ShiftL").value = "ShiftOff";
  220. }
  221. getkeys(lang);
  222. }
  223. function altgr(lang) {
  224. var altgr = document.getElementById("AltGr").value;
  225. if (altgr === "AltGrOff") {
  226. document.getElementById("AltGr").value = "AltGrOn";
  227. document.getElementById("AltGr").innerHTML =
  228. '&nbsp; &nbsp;<br><font color="DeepSkyBlue"><strong>Alt Gr</strong></font>';
  229. }else{
  230. document.getElementById("AltGr").value = "AltGrOff";
  231. document.getElementById("AltGr").innerHTML =
  232. '&nbsp; &nbsp;<br><font color="DeepSkyBlue">Alt Gr</font>';
  233. }
  234. getkeys(lang);
  235. }
  236. function getst(value) {
  237. if (value==="") {
  238. var st = "&nbsp;";
  239. }else{
  240. try{
  241. var st = String.fromCharCode(value);
  242. }catch(err) {
  243. console.log(err);
  244. console.log(value);
  245. }
  246. }
  247. return st;
  248. }
  249. function getkeys(lang) {
  250. var altgr = document.getElementById("AltGr").value;
  251. var shift = document.getElementById("ShiftR").value;
  252. var CapsVal = document.getElementById("Caps").value;
  253. if (altgr==="AltGrOn") {
  254. if (((shift === "ShiftOff") && (CapsVal === "CapsOff")) ||
  255. ((shift === "ShiftOn") && (CapsVal === "CapsOn"))){
  256. keys("lower1",lang);
  257. }else{
  258. keys("upper1",lang);
  259. }
  260. }else{
  261. if (((shift === "ShiftOff") && (CapsVal === "CapsOff")) ||
  262. ((shift === "ShiftOn") && (CapsVal === "CapsOn"))){
  263. keys("lower",lang);
  264. }else{
  265. keys("upper",lang);
  266. }
  267. }
  268. }