Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function detectRus(e, c){
  2.     var c = (e.charCode == undefined ? e.keyCode : e.charCode);
  3.     var layout =  '';
  4.     if (c >= 97/*a*/  && c <= 122/*z*/ && !e.shiftKey ||
  5.         c >= 65/*A*/  && c <= 90/*Z*/  &&  e.shiftKey ||
  6.         (c == 91/*[*/  && !e.shiftKey ||
  7.         c == 93/*]*/  && !e.shiftKey ||
  8.         c == 123/*{*/ &&  e.shiftKey ||
  9.         c == 125/*}*/ &&  e.shiftKey ||
  10.         c == 96/*`*/  && !e.shiftKey ||
  11.         c == 126/*~*/ &&  e.shiftKey ||
  12.         c == 64/*@*/  &&  e.shiftKey ||
  13.         c == 35/*#*/  &&  e.shiftKey ||
  14.         c == 36/*$*/  &&  e.shiftKey ||
  15.         c == 94/*^*/  &&  e.shiftKey ||
  16.         c == 38/*&*/  &&  e.shiftKey ||
  17.         c == 59/*;*/  && !e.shiftKey ||
  18.         c == 39/*'*/  && !e.shiftKey ||
  19.         c == 44/*,*/  && !e.shiftKey ||
  20.         c == 60/*<*/  &&  e.shiftKey ||
  21.         c == 62/*>*/  &&  e.shiftKey) && layout != 'EN'
  22.     ) {
  23.         layout = 'en';
  24.     }
  25.     else if (c >= 65/*A*/ && c <= 90/*Z*/  && !e.shiftKey || c >= 97/*a*/ && c <= 122/*z*/ &&  e.shiftKey) {
  26.         layout = 'EN';
  27.     }
  28.     else if (c >= 1072/*а*/ && c <= 1103/*я*/ && !e.shiftKey ||
  29.         c >= 1040/*А*/ && c <= 1071/*Я*/ &&  e.shiftKey ||
  30.         (c == 1105/*ё*/ && !e.shiftKey ||
  31.         c == 1025/*Ё*/ &&  e.shiftKey ||
  32.         c == 8470/*№*/ &&  e.shiftKey ||
  33.         c == 59/*;*/   &&  e.shiftKey ||
  34.         c == 59/*;*/   && !e.shiftKey ||
  35.         c == 44/*,*/   &&  e.shiftKey) && layout != 'RU'
  36.     ) {
  37.         layout = 'ru';
  38.     } else if (c >= 1040/*А*/ && c <= 1071/*Я*/ && !e.shiftKey || c >= 1072/*а*/ && c <= 1103/*я*/ &&  e.shiftKey || (c == 63 && e.shiftKey)  || (c == 44 && e.shiftKey)) {
  39.         layout = 'RU';
  40.     }  
  41.     else if(c == 46 || (c == 58 && e.shiftKey)|| (c == 47 && e.shiftKey)) {
  42.         layout = 'ru';
  43.     }
  44.    
  45.     return !layout?'EN':layout;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement