Commits

Pavlo Shchelokovskyy  committed d318b37

removed not used styles
removed saving functionality
removed focusing text window after each text event

  • Participants
  • Parent commits 50ec69e

Comments (0)

Files changed (1)

File Russian Keyboard.htm

 .b80 { color=black; width: 80px; background-color: #CCCCCC; font-family: Tahoma, Arial; font-size: 12px;}
 .b100 { color=black; width: 100px; background-color: #CCCCCC; font-family: Tahoma, Arial; font-size: 12px;}
 .b300 { color=black; width: 300px; background-color: #CCCCCC; font-family: Tahoma, Arial; font-size: 12px;}
-.com {color: white; font-family: Tahoma, Arial; font-size: 12px;}
-.mes {color: black; font-family: Tahoma, Arial; font-size: 11px;}
 </style>
 
 <script>
-var l_letter = new Array('`','1','2','3','4','5','6','7','8','9','0','-','=','q','w','e','r','t','y','u','i','o','p','[',']','BackSpace','Shift','a','s','d','f','g','h','j','k','l',';',"'",'Enter','CapsLock','z','x','c','v','b','n','m',',','.');
-var lb_letter = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','Q','W','E','R','T','Y','U','I','O','P','{','}','BackSpace','Shift','A','S','D','F','G','H','J','K','L',':','"','Enter','CapsLock','Z','X','C','V','B','N','M','<','>');
-var r_letter = new Array('ё','1','2','3','4','5','6','7','8','9','0','-','=','й','ц','у','к','е','н','г','ш','щ','з','х','ъ','BackSpace','Shift','ф','ы','в','а','п','р','о','л','д','ж','э','Enter','CapsLock','я','ч','с','м','и','т','ь','б','ю');
-var rb_letter = new Array('Ё','!','"','№',';','%',':','?','*','(',')','_','+','Й','Ц','У','К','Е','Н','Г','Ш','Щ','З','Х','Ъ','BackSpace','Shift','Ф','Ы','В','А','П','Р','О','Л','Д','Ж','Э','Enter','CapsLock','Я','Ч','С','М','И','Т','Ь','Б','Ю');
-var ltype = new Array(2,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,3,3,3,3,2,2);
+var l_letter = new Array('`','1','2','3','4','5','6','7','8','9','0','-','=','q','w','e','r','t','y','u','i','o','p','[',']','BackSpace','Shift','a','s','d','f','g','h','j','k','l',';',"'",'Enter','CapsLock','z','x','c','v','b','n','m',',','.','/','\\','Rus/Lat','Undo',' ','Clear');
+var lb_letter = new Array('~','!','@','#','$','%','^','&','*','(',')','_','+','Q','W','E','R','T','Y','U','I','O','P','{','}','BackSpace','Shift','A','S','D','F','G','H','J','K','L',':','"','Enter','CapsLock','Z','X','C','V','B','N','M','<','>','?','|','Rus/Lat','Undo',' ','Clear');
+var r_letter = new Array('ё','1','2','3','4','5','6','7','8','9','0','-','=','й','ц','у','к','е','н','г','ш','щ','з','х','ъ','BackSpace','Shift','ф','ы','в','а','п','р','о','л','д','ж','э','Enter','CapsLock','я','ч','с','м','и','т','ь','б','ю','.','\\','Rus/Lat','Undo',' ','Clear');
+var rb_letter = new Array('Ё','!','"','№',';','%',':','?','*','(',')','_','+','Й','Ц','У','К','Е','Н','Г','Ш','Щ','З','Х','Ъ','BackSpace','Shift','Ф','Ы','В','А','П','Р','О','Л','Д','Ж','Э','Enter','CapsLock','Я','Ч','С','М','И','Т','Ь','Б','Ю',',','\\','Rus/Lat','Undo',' ','Clear');
+var ltype = new Array(2,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,3,3,3,3,2,2,0,0,3,3,3,3);
 var letter = new Array(l_letter, lb_letter, r_letter, rb_letter);
-
+var dec1 = new Array(1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1070,1056,1057,1058,1059,1042,1065,1061,1067,1047,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1102,1088,1089,1090,1091,1074,1097,1093,1099,1079,1100,1098);
+var dec2 = new Array(1071,1041,1063,1044,1069,1060,1046,1065,1048,1049,1050,1051,1052,1053,1025,1055,1070,1056,1064,1058,1070,1042,1065,1061,1067,1046,1103,1073,1095,1076,1101,1092,1078,1097,1080,1081,1082,1083,1084,1085,1105,1087,1102,1088,1096,1090,1102,1074,1097,1093,1099,1078,1068,1066);
+var dec3 = new Array(1060,1048,1057,1042,1059,1040,1055,1056,1064,1054,1051,1044,1068,1058,1065,1047,1049,1050,1067,1045,1043,1052,1062,1063,1053,1071,1092,1080,1089,1074,1091,1072,1087,1088,1096,1086,1083,1076,1100,1090,1097,1079,1081,1082,1099,1077,1075,1084,1094,1095,1085,1103,1093,1098,1078,1101,1073,1102,46,1061,1066,1046,1069,1041,1070,44,1105,1025);
 var off = 1;
 var keymode = 2;
 var savemode = 0;
 var op;
 var par = new String(location.search);
 
+function clr()
+{
+ undotext = document.keyb.text.value;
+ document.keyb.text.value = "";
+
+<!--  document.keyb.text.focus(); -->
+ return false;
+}
+
+function undo()
+{
+ var s;
+ s = document.keyb.text.value;
+ document.keyb.text.value = undotext;
+ undotext = s;
+
+<!--  document.keyb.text.focus(); -->
+ return false;
+}
+
 function changeLetter(n)
 {
  var i;
   
  for(i=0;i<qn;i++) document.keyb.elements[i+off].value = letter[(shift)?(keymode | (((ltype[i] >> (keymode >> 1)) & 1)^1)):(keymode & ((ltype[i] >> (keymode >> 1)) | 2))][i];
 
- document.keyb.text.focus(); 
+<!--  document.keyb.text.focus();  -->
+ return false;
+}
+
+function delLetter()
+{
+ var str = new String(document.keyb.text.value); 
+ var del=1;
+ if(str.charAt(str.length-1) == '\n') del=2;
+ document.keyb.text.value = str.substr(0, str.length-del);
+
+<!--  document.keyb.text.focus();  -->
  return false;
 }
 
 function addLetter(but)
 {
  var chr = but.value;
+ if( chr == 'Enter' ) chr='\n';
  document.keyb.text.value += chr;
  if(shift)
  {
  return false;
 }
 
+function decode()
+{
+ if((document.keyb.decflag.type != "select-one") || (document.keyb.decflag.value == 0)) return true;
+
+ var code = event.keyCode, i = -1;
+ 
+ if(code >= 65 && code <=90) i = code - 65;
+ else if(code >= 97 && code <=122) i = code - 71;
+
+ if(document.keyb.decflag.value == 1)
+ {
+  if(i == -1)
+   switch (code)
+   {
+    case 91:  i = 52; break;
+    case 93:  i = 53; break;
+    case 39:  apostr = !apostr; return !apostr;
+   }	
+
+  if(i != -1) event.keyCode = (apostr)?dec2[i]:dec1[i];
+  apostr = false;
+ }
+ else
+ {
+  if(i == -1)
+   switch (code)
+   {
+    case 91:  i = (capslock)?59:52; break;
+    case 93:  i = (capslock)?60:53; break;
+    case 59:  i = (capslock)?61:54; break;
+    case 39:  i = (capslock)?62:55; break;
+    case 44:  i = (capslock)?63:56; break;
+    case 46:  i = (capslock)?64:57; break;
+    case 47:  i = 58; break;
+    case 123: i = (capslock)?52:59; break;
+    case 125: i = (capslock)?53:60; break;
+    case 58:  i = (capslock)?54:61; break;
+    case 34:  i = (capslock)?55:62; break;
+    case 60:  i = (capslock)?56:63; break;
+    case 62:  i = (capslock)?57:64; break;
+    case 63:  i = 65; break;
+    case 96:  i = (capslock)?67:66; break;
+    case 126: i = (capslock)?66:67; break;
+   }
+  else
+  {
+   if(i < 26) capslock = !event.shiftKey;
+   else capslock = event.shiftKey;
+  }  
+  if(i != -1) event.keyCode = dec3[i];
+
+ }
+ return true;
+
+}
+
 function cfocus()
 {
  document.keyb.text.focus(); 
 <table width=100% height=100% cellpadding=0 cellspacing=0 border=0>
 <form name="keyb"><tr><td align=left valign=top>
 
-<table width=100% cellspacing=0 cellpadding=1 border=0 bgcolor="#CCCCCC"><tr><td>
+<table width=590 cellspacing=0 cellpadding=1 border=0 bgcolor="#CCCCCC"><tr><td>
 <table width=100% cellspacing=0 cellpadding=10 border=0 bgcolor="#F7F7F7"><tr><td align=center>
-<textarea rows=5 cols=68 name="text" wrap="physical"></textarea>
-
-<br>
+<textarea rows=5 cols=68 name="text" wrap="physical" onKeyPress="return decode();"></textarea><br>
 
 <font size=-1>
 <input type=button value="" onClick="return addLetter(this);" width=30 class=b30>
 <input type=button value="" onClick="return addLetter(this);" width=30 class=b30>
 <input type=button value="" onClick="return changeLetter(2);" width=80 class=b80>
 <br>
-<!-- changeletter:
-1 - capslock
-2 - rus/lat 
-5 - shift
--->
+<input type=button value="" onClick="return undo();" width=80 class=b80>
+<input type=button value="" onClick="return addLetter(this);" width=300 class=b300>
+<input type=button value="" onClick="return clr();" width=80 class=b80>
+</font>
 
 </td></tr></table>
 </td></tr></table>