tr8n 3.2.2 → 3.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/tr8n/version.rb +1 -1
- data/tr8n.gemspec +2 -2
- metadata +41 -117
- data/app/javascript/compile.rb +0 -37
- data/app/javascript/compile.sh +0 -1
- data/app/javascript/compressors/google/COPYING +0 -202
- data/app/javascript/compressors/google/README +0 -292
- data/app/javascript/compressors/google/compiler.jar +0 -0
- data/app/javascript/config.yml +0 -66
- data/app/javascript/src/base.js +0 -35
- data/app/javascript/src/effects.js +0 -67
- data/app/javascript/src/ext/inflector.js +0 -309
- data/app/javascript/src/ext/jsDraw2D.js +0 -24
- data/app/javascript/src/ext/keyboard_1_36.js +0 -1214
- data/app/javascript/src/ext/keyboard_1_44.js +0 -1735
- data/app/javascript/src/ext/keyboard_1_49.js +0 -1796
- data/app/javascript/src/ext/md5.js +0 -209
- data/app/javascript/src/ext/shortcut.js +0 -223
- data/app/javascript/src/init.js +0 -47
- data/app/javascript/src/language.js +0 -38
- data/app/javascript/src/logger.js +0 -203
- data/app/javascript/src/prototype/effects.js +0 -65
- data/app/javascript/src/proxy.js +0 -254
- data/app/javascript/src/rules/date_rule.js +0 -37
- data/app/javascript/src/rules/gender_list_rule.js +0 -37
- data/app/javascript/src/rules/gender_rule.js +0 -87
- data/app/javascript/src/rules/language_rule.js +0 -55
- data/app/javascript/src/rules/list_rule.js +0 -37
- data/app/javascript/src/rules/numeric_rule.js +0 -95
- data/app/javascript/src/tml/label.js +0 -60
- data/app/javascript/src/tml/token.js +0 -107
- data/app/javascript/src/tokens/data_token.js +0 -45
- data/app/javascript/src/tokens/decoration_token.js +0 -82
- data/app/javascript/src/tokens/token.js +0 -121
- data/app/javascript/src/tokens/transform_token.js +0 -106
- data/app/javascript/src/translation_key.js +0 -183
- data/app/javascript/src/ui/language_case_manager.js +0 -155
- data/app/javascript/src/ui/language_selector.js +0 -126
- data/app/javascript/src/ui/lightbox.js +0 -72
- data/app/javascript/src/ui/translator.js +0 -257
- data/app/javascript/src/utils.js +0 -286
@@ -1,209 +0,0 @@
|
|
1
|
-
/****************************************************************************
|
2
|
-
***
|
3
|
-
*** MD5 (Message-Digest Algorithm)
|
4
|
-
*** http://www.webtoolkit.info/javascript-md5.html
|
5
|
-
***
|
6
|
-
*** MD5 was developed by Professor Ronald L. Rivest in 1994.
|
7
|
-
*** Its 128 bit (16 byte) message digest makes it a faster implementation than SHA-1.
|
8
|
-
****************************************************************************/
|
9
|
-
|
10
|
-
var MD5 = function (string) {
|
11
|
-
|
12
|
-
function RotateLeft(lValue, iShiftBits) {
|
13
|
-
return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
|
14
|
-
}
|
15
|
-
|
16
|
-
function AddUnsigned(lX,lY) {
|
17
|
-
var lX4,lY4,lX8,lY8,lResult;
|
18
|
-
lX8 = (lX & 0x80000000);
|
19
|
-
lY8 = (lY & 0x80000000);
|
20
|
-
lX4 = (lX & 0x40000000);
|
21
|
-
lY4 = (lY & 0x40000000);
|
22
|
-
lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF);
|
23
|
-
if (lX4 & lY4) {
|
24
|
-
return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
|
25
|
-
}
|
26
|
-
if (lX4 | lY4) {
|
27
|
-
if (lResult & 0x40000000) {
|
28
|
-
return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
|
29
|
-
} else {
|
30
|
-
return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
|
31
|
-
}
|
32
|
-
} else {
|
33
|
-
return (lResult ^ lX8 ^ lY8);
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
function F(x,y,z) { return (x & y) | ((~x) & z); }
|
38
|
-
function G(x,y,z) { return (x & z) | (y & (~z)); }
|
39
|
-
function H(x,y,z) { return (x ^ y ^ z); }
|
40
|
-
function I(x,y,z) { return (y ^ (x | (~z))); }
|
41
|
-
|
42
|
-
function FF(a,b,c,d,x,s,ac) {
|
43
|
-
a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
|
44
|
-
return AddUnsigned(RotateLeft(a, s), b);
|
45
|
-
};
|
46
|
-
|
47
|
-
function GG(a,b,c,d,x,s,ac) {
|
48
|
-
a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
|
49
|
-
return AddUnsigned(RotateLeft(a, s), b);
|
50
|
-
};
|
51
|
-
|
52
|
-
function HH(a,b,c,d,x,s,ac) {
|
53
|
-
a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
|
54
|
-
return AddUnsigned(RotateLeft(a, s), b);
|
55
|
-
};
|
56
|
-
|
57
|
-
function II(a,b,c,d,x,s,ac) {
|
58
|
-
a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
|
59
|
-
return AddUnsigned(RotateLeft(a, s), b);
|
60
|
-
};
|
61
|
-
|
62
|
-
function ConvertToWordArray(string) {
|
63
|
-
var lWordCount;
|
64
|
-
var lMessageLength = string.length;
|
65
|
-
var lNumberOfWords_temp1=lMessageLength + 8;
|
66
|
-
var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64;
|
67
|
-
var lNumberOfWords = (lNumberOfWords_temp2+1)*16;
|
68
|
-
var lWordArray=Array(lNumberOfWords-1);
|
69
|
-
var lBytePosition = 0;
|
70
|
-
var lByteCount = 0;
|
71
|
-
while ( lByteCount < lMessageLength ) {
|
72
|
-
lWordCount = (lByteCount-(lByteCount % 4))/4;
|
73
|
-
lBytePosition = (lByteCount % 4)*8;
|
74
|
-
lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<<lBytePosition));
|
75
|
-
lByteCount++;
|
76
|
-
}
|
77
|
-
lWordCount = (lByteCount-(lByteCount % 4))/4;
|
78
|
-
lBytePosition = (lByteCount % 4)*8;
|
79
|
-
lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition);
|
80
|
-
lWordArray[lNumberOfWords-2] = lMessageLength<<3;
|
81
|
-
lWordArray[lNumberOfWords-1] = lMessageLength>>>29;
|
82
|
-
return lWordArray;
|
83
|
-
};
|
84
|
-
|
85
|
-
function WordToHex(lValue) {
|
86
|
-
var WordToHexValue="",WordToHexValue_temp="",lByte,lCount;
|
87
|
-
for (lCount = 0;lCount<=3;lCount++) {
|
88
|
-
lByte = (lValue>>>(lCount*8)) & 255;
|
89
|
-
WordToHexValue_temp = "0" + lByte.toString(16);
|
90
|
-
WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2);
|
91
|
-
}
|
92
|
-
return WordToHexValue;
|
93
|
-
};
|
94
|
-
|
95
|
-
function Utf8Encode(string) {
|
96
|
-
string = string.replace(/\r\n/g,"\n");
|
97
|
-
var utftext = "";
|
98
|
-
|
99
|
-
for (var n = 0; n < string.length; n++) {
|
100
|
-
|
101
|
-
var c = string.charCodeAt(n);
|
102
|
-
|
103
|
-
if (c < 128) {
|
104
|
-
utftext += String.fromCharCode(c);
|
105
|
-
}
|
106
|
-
else if((c > 127) && (c < 2048)) {
|
107
|
-
utftext += String.fromCharCode((c >> 6) | 192);
|
108
|
-
utftext += String.fromCharCode((c & 63) | 128);
|
109
|
-
}
|
110
|
-
else {
|
111
|
-
utftext += String.fromCharCode((c >> 12) | 224);
|
112
|
-
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
113
|
-
utftext += String.fromCharCode((c & 63) | 128);
|
114
|
-
}
|
115
|
-
|
116
|
-
}
|
117
|
-
|
118
|
-
return utftext;
|
119
|
-
};
|
120
|
-
|
121
|
-
var x=Array();
|
122
|
-
var k,AA,BB,CC,DD,a,b,c,d;
|
123
|
-
var S11=7, S12=12, S13=17, S14=22;
|
124
|
-
var S21=5, S22=9 , S23=14, S24=20;
|
125
|
-
var S31=4, S32=11, S33=16, S34=23;
|
126
|
-
var S41=6, S42=10, S43=15, S44=21;
|
127
|
-
|
128
|
-
string = Utf8Encode(string);
|
129
|
-
|
130
|
-
x = ConvertToWordArray(string);
|
131
|
-
|
132
|
-
a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;
|
133
|
-
|
134
|
-
for (k=0;k<x.length;k+=16) {
|
135
|
-
AA=a; BB=b; CC=c; DD=d;
|
136
|
-
a=FF(a,b,c,d,x[k+0], S11,0xD76AA478);
|
137
|
-
d=FF(d,a,b,c,x[k+1], S12,0xE8C7B756);
|
138
|
-
c=FF(c,d,a,b,x[k+2], S13,0x242070DB);
|
139
|
-
b=FF(b,c,d,a,x[k+3], S14,0xC1BDCEEE);
|
140
|
-
a=FF(a,b,c,d,x[k+4], S11,0xF57C0FAF);
|
141
|
-
d=FF(d,a,b,c,x[k+5], S12,0x4787C62A);
|
142
|
-
c=FF(c,d,a,b,x[k+6], S13,0xA8304613);
|
143
|
-
b=FF(b,c,d,a,x[k+7], S14,0xFD469501);
|
144
|
-
a=FF(a,b,c,d,x[k+8], S11,0x698098D8);
|
145
|
-
d=FF(d,a,b,c,x[k+9], S12,0x8B44F7AF);
|
146
|
-
c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1);
|
147
|
-
b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE);
|
148
|
-
a=FF(a,b,c,d,x[k+12],S11,0x6B901122);
|
149
|
-
d=FF(d,a,b,c,x[k+13],S12,0xFD987193);
|
150
|
-
c=FF(c,d,a,b,x[k+14],S13,0xA679438E);
|
151
|
-
b=FF(b,c,d,a,x[k+15],S14,0x49B40821);
|
152
|
-
a=GG(a,b,c,d,x[k+1], S21,0xF61E2562);
|
153
|
-
d=GG(d,a,b,c,x[k+6], S22,0xC040B340);
|
154
|
-
c=GG(c,d,a,b,x[k+11],S23,0x265E5A51);
|
155
|
-
b=GG(b,c,d,a,x[k+0], S24,0xE9B6C7AA);
|
156
|
-
a=GG(a,b,c,d,x[k+5], S21,0xD62F105D);
|
157
|
-
d=GG(d,a,b,c,x[k+10],S22,0x2441453);
|
158
|
-
c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681);
|
159
|
-
b=GG(b,c,d,a,x[k+4], S24,0xE7D3FBC8);
|
160
|
-
a=GG(a,b,c,d,x[k+9], S21,0x21E1CDE6);
|
161
|
-
d=GG(d,a,b,c,x[k+14],S22,0xC33707D6);
|
162
|
-
c=GG(c,d,a,b,x[k+3], S23,0xF4D50D87);
|
163
|
-
b=GG(b,c,d,a,x[k+8], S24,0x455A14ED);
|
164
|
-
a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905);
|
165
|
-
d=GG(d,a,b,c,x[k+2], S22,0xFCEFA3F8);
|
166
|
-
c=GG(c,d,a,b,x[k+7], S23,0x676F02D9);
|
167
|
-
b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A);
|
168
|
-
a=HH(a,b,c,d,x[k+5], S31,0xFFFA3942);
|
169
|
-
d=HH(d,a,b,c,x[k+8], S32,0x8771F681);
|
170
|
-
c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122);
|
171
|
-
b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C);
|
172
|
-
a=HH(a,b,c,d,x[k+1], S31,0xA4BEEA44);
|
173
|
-
d=HH(d,a,b,c,x[k+4], S32,0x4BDECFA9);
|
174
|
-
c=HH(c,d,a,b,x[k+7], S33,0xF6BB4B60);
|
175
|
-
b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70);
|
176
|
-
a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6);
|
177
|
-
d=HH(d,a,b,c,x[k+0], S32,0xEAA127FA);
|
178
|
-
c=HH(c,d,a,b,x[k+3], S33,0xD4EF3085);
|
179
|
-
b=HH(b,c,d,a,x[k+6], S34,0x4881D05);
|
180
|
-
a=HH(a,b,c,d,x[k+9], S31,0xD9D4D039);
|
181
|
-
d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5);
|
182
|
-
c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8);
|
183
|
-
b=HH(b,c,d,a,x[k+2], S34,0xC4AC5665);
|
184
|
-
a=II(a,b,c,d,x[k+0], S41,0xF4292244);
|
185
|
-
d=II(d,a,b,c,x[k+7], S42,0x432AFF97);
|
186
|
-
c=II(c,d,a,b,x[k+14],S43,0xAB9423A7);
|
187
|
-
b=II(b,c,d,a,x[k+5], S44,0xFC93A039);
|
188
|
-
a=II(a,b,c,d,x[k+12],S41,0x655B59C3);
|
189
|
-
d=II(d,a,b,c,x[k+3], S42,0x8F0CCC92);
|
190
|
-
c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D);
|
191
|
-
b=II(b,c,d,a,x[k+1], S44,0x85845DD1);
|
192
|
-
a=II(a,b,c,d,x[k+8], S41,0x6FA87E4F);
|
193
|
-
d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0);
|
194
|
-
c=II(c,d,a,b,x[k+6], S43,0xA3014314);
|
195
|
-
b=II(b,c,d,a,x[k+13],S44,0x4E0811A1);
|
196
|
-
a=II(a,b,c,d,x[k+4], S41,0xF7537E82);
|
197
|
-
d=II(d,a,b,c,x[k+11],S42,0xBD3AF235);
|
198
|
-
c=II(c,d,a,b,x[k+2], S43,0x2AD7D2BB);
|
199
|
-
b=II(b,c,d,a,x[k+9], S44,0xEB86D391);
|
200
|
-
a=AddUnsigned(a,AA);
|
201
|
-
b=AddUnsigned(b,BB);
|
202
|
-
c=AddUnsigned(c,CC);
|
203
|
-
d=AddUnsigned(d,DD);
|
204
|
-
}
|
205
|
-
|
206
|
-
var temp = WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d);
|
207
|
-
|
208
|
-
return temp.toLowerCase();
|
209
|
-
}
|
@@ -1,223 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* http://www.openjs.com/scripts/events/keyboard_shortcuts/
|
3
|
-
* Version : 2.01.B
|
4
|
-
* By Binny V A
|
5
|
-
* License : BSD
|
6
|
-
*/
|
7
|
-
shortcut = {
|
8
|
-
'all_shortcuts':{},//All the shortcuts are stored in this array
|
9
|
-
'add': function(shortcut_combination,callback,opt) {
|
10
|
-
//Provide a set of default options
|
11
|
-
var default_options = {
|
12
|
-
'type':'keydown',
|
13
|
-
'propagate':false,
|
14
|
-
'disable_in_input':false,
|
15
|
-
'target':document,
|
16
|
-
'keycode':false
|
17
|
-
}
|
18
|
-
if(!opt) opt = default_options;
|
19
|
-
else {
|
20
|
-
for(var dfo in default_options) {
|
21
|
-
if(typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo];
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
var ele = opt.target;
|
26
|
-
if(typeof opt.target == 'string') ele = document.getElementById(opt.target);
|
27
|
-
var ths = this;
|
28
|
-
shortcut_combination = shortcut_combination.toLowerCase();
|
29
|
-
|
30
|
-
//The function to be called at keypress
|
31
|
-
var func = function(e) {
|
32
|
-
e = e || window.event;
|
33
|
-
|
34
|
-
if(opt['disable_in_input']) { //Don't enable shortcut keys in Input, Textarea fields
|
35
|
-
var element;
|
36
|
-
if(e.target) element=e.target;
|
37
|
-
else if(e.srcElement) element=e.srcElement;
|
38
|
-
if(element.nodeType==3) element=element.parentNode;
|
39
|
-
|
40
|
-
if(element.tagName == 'INPUT' || element.tagName == 'TEXTAREA') return;
|
41
|
-
}
|
42
|
-
|
43
|
-
//Find Which key is pressed
|
44
|
-
if (e.keyCode) code = e.keyCode;
|
45
|
-
else if (e.which) code = e.which;
|
46
|
-
var character = String.fromCharCode(code).toLowerCase();
|
47
|
-
|
48
|
-
if(code == 188) character=","; //If the user presses , when the type is onkeydown
|
49
|
-
if(code == 190) character="."; //If the user presses , when the type is onkeydown
|
50
|
-
|
51
|
-
var keys = shortcut_combination.split("+");
|
52
|
-
//Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked
|
53
|
-
var kp = 0;
|
54
|
-
|
55
|
-
//Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken
|
56
|
-
var shift_nums = {
|
57
|
-
"`":"~",
|
58
|
-
"1":"!",
|
59
|
-
"2":"@",
|
60
|
-
"3":"#",
|
61
|
-
"4":"$",
|
62
|
-
"5":"%",
|
63
|
-
"6":"^",
|
64
|
-
"7":"&",
|
65
|
-
"8":"*",
|
66
|
-
"9":"(",
|
67
|
-
"0":")",
|
68
|
-
"-":"_",
|
69
|
-
"=":"+",
|
70
|
-
";":":",
|
71
|
-
"'":"\"",
|
72
|
-
",":"<",
|
73
|
-
".":">",
|
74
|
-
"/":"?",
|
75
|
-
"\\":"|"
|
76
|
-
}
|
77
|
-
//Special Keys - and their codes
|
78
|
-
var special_keys = {
|
79
|
-
'esc':27,
|
80
|
-
'escape':27,
|
81
|
-
'tab':9,
|
82
|
-
'space':32,
|
83
|
-
'return':13,
|
84
|
-
'enter':13,
|
85
|
-
'backspace':8,
|
86
|
-
|
87
|
-
'scrolllock':145,
|
88
|
-
'scroll_lock':145,
|
89
|
-
'scroll':145,
|
90
|
-
'capslock':20,
|
91
|
-
'caps_lock':20,
|
92
|
-
'caps':20,
|
93
|
-
'numlock':144,
|
94
|
-
'num_lock':144,
|
95
|
-
'num':144,
|
96
|
-
|
97
|
-
'pause':19,
|
98
|
-
'break':19,
|
99
|
-
|
100
|
-
'insert':45,
|
101
|
-
'home':36,
|
102
|
-
'delete':46,
|
103
|
-
'end':35,
|
104
|
-
|
105
|
-
'pageup':33,
|
106
|
-
'page_up':33,
|
107
|
-
'pu':33,
|
108
|
-
|
109
|
-
'pagedown':34,
|
110
|
-
'page_down':34,
|
111
|
-
'pd':34,
|
112
|
-
|
113
|
-
'left':37,
|
114
|
-
'up':38,
|
115
|
-
'right':39,
|
116
|
-
'down':40,
|
117
|
-
|
118
|
-
'f1':112,
|
119
|
-
'f2':113,
|
120
|
-
'f3':114,
|
121
|
-
'f4':115,
|
122
|
-
'f5':116,
|
123
|
-
'f6':117,
|
124
|
-
'f7':118,
|
125
|
-
'f8':119,
|
126
|
-
'f9':120,
|
127
|
-
'f10':121,
|
128
|
-
'f11':122,
|
129
|
-
'f12':123
|
130
|
-
}
|
131
|
-
|
132
|
-
var modifiers = {
|
133
|
-
shift: { wanted:false, pressed:false},
|
134
|
-
ctrl : { wanted:false, pressed:false},
|
135
|
-
alt : { wanted:false, pressed:false},
|
136
|
-
meta : { wanted:false, pressed:false} //Meta is Mac specific
|
137
|
-
};
|
138
|
-
|
139
|
-
if(e.ctrlKey) modifiers.ctrl.pressed = true;
|
140
|
-
if(e.shiftKey) modifiers.shift.pressed = true;
|
141
|
-
if(e.altKey) modifiers.alt.pressed = true;
|
142
|
-
if(e.metaKey) modifiers.meta.pressed = true;
|
143
|
-
|
144
|
-
for(var i=0; k=keys[i],i<keys.length; i++) {
|
145
|
-
//Modifiers
|
146
|
-
if(k == 'ctrl' || k == 'control') {
|
147
|
-
kp++;
|
148
|
-
modifiers.ctrl.wanted = true;
|
149
|
-
|
150
|
-
} else if(k == 'shift') {
|
151
|
-
kp++;
|
152
|
-
modifiers.shift.wanted = true;
|
153
|
-
|
154
|
-
} else if(k == 'alt') {
|
155
|
-
kp++;
|
156
|
-
modifiers.alt.wanted = true;
|
157
|
-
} else if(k == 'meta') {
|
158
|
-
kp++;
|
159
|
-
modifiers.meta.wanted = true;
|
160
|
-
} else if(k.length > 1) { //If it is a special key
|
161
|
-
if(special_keys[k] == code) kp++;
|
162
|
-
|
163
|
-
} else if(opt['keycode']) {
|
164
|
-
if(opt['keycode'] == code) kp++;
|
165
|
-
|
166
|
-
} else { //The special keys did not match
|
167
|
-
if(character == k) kp++;
|
168
|
-
else {
|
169
|
-
if(shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase
|
170
|
-
character = shift_nums[character];
|
171
|
-
if(character == k) kp++;
|
172
|
-
}
|
173
|
-
}
|
174
|
-
}
|
175
|
-
}
|
176
|
-
|
177
|
-
if(kp == keys.length &&
|
178
|
-
modifiers.ctrl.pressed == modifiers.ctrl.wanted &&
|
179
|
-
modifiers.shift.pressed == modifiers.shift.wanted &&
|
180
|
-
modifiers.alt.pressed == modifiers.alt.wanted &&
|
181
|
-
modifiers.meta.pressed == modifiers.meta.wanted) {
|
182
|
-
callback(e);
|
183
|
-
|
184
|
-
if(!opt['propagate']) { //Stop the event
|
185
|
-
//e.cancelBubble is supported by IE - this will kill the bubbling process.
|
186
|
-
e.cancelBubble = true;
|
187
|
-
e.returnValue = false;
|
188
|
-
|
189
|
-
//e.stopPropagation works in Firefox.
|
190
|
-
if (e.stopPropagation) {
|
191
|
-
e.stopPropagation();
|
192
|
-
e.preventDefault();
|
193
|
-
}
|
194
|
-
return false;
|
195
|
-
}
|
196
|
-
}
|
197
|
-
}
|
198
|
-
this.all_shortcuts[shortcut_combination] = {
|
199
|
-
'callback':func,
|
200
|
-
'target':ele,
|
201
|
-
'event': opt['type']
|
202
|
-
};
|
203
|
-
//Attach the function with the event
|
204
|
-
if(ele.addEventListener) ele.addEventListener(opt['type'], func, false);
|
205
|
-
else if(ele.attachEvent) ele.attachEvent('on'+opt['type'], func);
|
206
|
-
else ele['on'+opt['type']] = func;
|
207
|
-
},
|
208
|
-
|
209
|
-
//Remove the shortcut - just specify the shortcut and I will remove the binding
|
210
|
-
'remove':function(shortcut_combination) {
|
211
|
-
shortcut_combination = shortcut_combination.toLowerCase();
|
212
|
-
var binding = this.all_shortcuts[shortcut_combination];
|
213
|
-
delete(this.all_shortcuts[shortcut_combination])
|
214
|
-
if(!binding) return;
|
215
|
-
var type = binding['event'];
|
216
|
-
var ele = binding['target'];
|
217
|
-
var callback = binding['callback'];
|
218
|
-
|
219
|
-
if(ele.detachEvent) ele.detachEvent('on'+type, callback);
|
220
|
-
else if(ele.removeEventListener) ele.removeEventListener(type, callback, false);
|
221
|
-
else ele['on'+type] = false;
|
222
|
-
}
|
223
|
-
}
|
data/app/javascript/src/init.js
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
/****************************************************************************
|
2
|
-
Copyright (c) 2010-2012 Michael Berkovich, Ian McDaniel, tr8n.net
|
3
|
-
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
a copy of this software and associated documentation files (the
|
6
|
-
"Software"), to deal in the Software without restriction, including
|
7
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be
|
13
|
-
included in all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
****************************************************************************/
|
23
|
-
|
24
|
-
var tr8nTranslator = null;
|
25
|
-
var tr8nLanguageSelector = null;
|
26
|
-
var tr8nLightbox = null;
|
27
|
-
var tr8nLanguageCaseManager = null;
|
28
|
-
|
29
|
-
function initializeTr8n() {
|
30
|
-
var setup = function() {
|
31
|
-
tr8nTranslator = new Tr8n.Translator();
|
32
|
-
tr8nLanguageSelector = new Tr8n.LanguageSelector();
|
33
|
-
tr8nLightbox = new Tr8n.Lightbox();
|
34
|
-
tr8nLanguageCaseManager = new Tr8n.LanguageCaseManager();
|
35
|
-
|
36
|
-
Tr8n.Utils.addEvent(document, "keyup", function(event) {
|
37
|
-
if (event.keyCode == 27) { // Capture Esc key
|
38
|
-
tr8nTranslator.hide();
|
39
|
-
tr8nLanguageSelector.hide();
|
40
|
-
tr8nLightbox.hide();
|
41
|
-
tr8nLanguageCaseManager.hide();
|
42
|
-
}
|
43
|
-
});
|
44
|
-
}
|
45
|
-
|
46
|
-
Tr8n.Utils.addEvent(window, 'load', setup);
|
47
|
-
}
|