tr8n 3.2.2 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/Gemfile.lock +1 -1
  2. data/lib/tr8n/version.rb +1 -1
  3. data/tr8n.gemspec +2 -2
  4. metadata +41 -117
  5. data/app/javascript/compile.rb +0 -37
  6. data/app/javascript/compile.sh +0 -1
  7. data/app/javascript/compressors/google/COPYING +0 -202
  8. data/app/javascript/compressors/google/README +0 -292
  9. data/app/javascript/compressors/google/compiler.jar +0 -0
  10. data/app/javascript/config.yml +0 -66
  11. data/app/javascript/src/base.js +0 -35
  12. data/app/javascript/src/effects.js +0 -67
  13. data/app/javascript/src/ext/inflector.js +0 -309
  14. data/app/javascript/src/ext/jsDraw2D.js +0 -24
  15. data/app/javascript/src/ext/keyboard_1_36.js +0 -1214
  16. data/app/javascript/src/ext/keyboard_1_44.js +0 -1735
  17. data/app/javascript/src/ext/keyboard_1_49.js +0 -1796
  18. data/app/javascript/src/ext/md5.js +0 -209
  19. data/app/javascript/src/ext/shortcut.js +0 -223
  20. data/app/javascript/src/init.js +0 -47
  21. data/app/javascript/src/language.js +0 -38
  22. data/app/javascript/src/logger.js +0 -203
  23. data/app/javascript/src/prototype/effects.js +0 -65
  24. data/app/javascript/src/proxy.js +0 -254
  25. data/app/javascript/src/rules/date_rule.js +0 -37
  26. data/app/javascript/src/rules/gender_list_rule.js +0 -37
  27. data/app/javascript/src/rules/gender_rule.js +0 -87
  28. data/app/javascript/src/rules/language_rule.js +0 -55
  29. data/app/javascript/src/rules/list_rule.js +0 -37
  30. data/app/javascript/src/rules/numeric_rule.js +0 -95
  31. data/app/javascript/src/tml/label.js +0 -60
  32. data/app/javascript/src/tml/token.js +0 -107
  33. data/app/javascript/src/tokens/data_token.js +0 -45
  34. data/app/javascript/src/tokens/decoration_token.js +0 -82
  35. data/app/javascript/src/tokens/token.js +0 -121
  36. data/app/javascript/src/tokens/transform_token.js +0 -106
  37. data/app/javascript/src/translation_key.js +0 -183
  38. data/app/javascript/src/ui/language_case_manager.js +0 -155
  39. data/app/javascript/src/ui/language_selector.js +0 -126
  40. data/app/javascript/src/ui/lightbox.js +0 -72
  41. data/app/javascript/src/ui/translator.js +0 -257
  42. data/app/javascript/src/utils.js +0 -286
@@ -1,286 +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
- Tr8n.Utils = {
25
-
26
- hideFlash: function() {
27
- // alert("Hiding");
28
- var embeds = document.getElementsByTagName('embed');
29
- for(i = 0; i < embeds.length; i++) {
30
- embeds[i].style.visibility = 'hidden';
31
- }
32
- },
33
-
34
- showFlash: function() {
35
- // alert("Showing");
36
- var embeds = document.getElementsByTagName('embed');
37
- for(i = 0; i < embeds.length; i++) {
38
- embeds[i].style.visibility = 'visible';
39
- }
40
- },
41
-
42
- isOpera: function() {
43
-     return /Opera/.test(navigator.userAgent);
44
-   },
45
-
46
- addEvent: function(elm, evType, fn, useCapture) {
47
- useCapture = useCapture || false;
48
- if (elm.addEventListener) {
49
- elm.addEventListener(evType, fn, useCapture);
50
- return true;
51
- } else if (elm.attachEvent) {
52
- var r = elm.attachEvent('on' + evType, fn);
53
- return r;
54
- } else {
55
- elm['on' + evType] = fn;
56
- }
57
- },
58
-
59
- toQueryParams: function (obj) {
60
- if (typeof obj == 'undefined' || obj == null) return "";
61
- if (typeof obj == 'string') return obj;
62
-
63
- var qs = [];
64
- for(p in obj) {
65
- qs.push(p + "=" + encodeURIComponent(obj[p]))
66
- }
67
- return qs.join("&")
68
- },
69
-
70
- serializeForm: function(form) {
71
- var els = Tr8n.element(form).elements;
72
- var form_obj = {}
73
- for(i=0; i < els.length; i++) {
74
- if (els[i].type == 'checkbox' && !els[i].checked) continue;
75
- form_obj[els[i].name] = els[i].value;
76
- }
77
- return form_obj;
78
- },
79
-
80
- indexOf: function(array, item, i) {
81
- i || (i = 0);
82
- var length = array.length;
83
- if (i < 0) i = length + i;
84
- for (; i < length; i++)
85
- if (array[i] === item) return i;
86
- return -1;
87
- },
88
-
89
- replaceAll: function(label, key, value) {
90
- while (label.indexOf(key) != -1) {
91
- label = label.replace(key, value);
92
- }
93
- return label;
94
- },
95
-
96
- trim: function(string) {
97
- return string.replace(/^\s+|\s+$/g,"");
98
- },
99
-
100
- ltrim: function(string) {
101
- return string.replace(/^\s+/,"");
102
- },
103
-
104
- rtrim: function(string) {
105
- return string.replace(/\s+$/,"");
106
- },
107
-
108
- getRequest: function() {
109
- var factories = [
110
- function() { return new ActiveXObject("Msxml2.XMLHTTP"); },
111
- function() { return new XMLHttpRequest(); },
112
- function() { return new ActiveXObject("Microsoft.XMLHTTP"); }
113
- ];
114
- for(var i = 0; i < factories.length; i++) {
115
- try {
116
- var request = factories[i]();
117
- if (request != null) return request;
118
- } catch(e) {continue;}
119
- }
120
- },
121
-
122
- ajax: function(url, options) {
123
- options = options || {};
124
- options.parameters = Tr8n.Utils.toQueryParams(options.parameters);
125
- options.method = options.method || 'get';
126
-
127
- var self=this;
128
- if (options.method == 'get' && options.parameters != '') {
129
- url = url + (url.indexOf('?') == -1 ? '?' : '&') + options.parameters;
130
- }
131
-
132
- var request = this.getRequest();
133
-
134
- request.onreadystatechange = function() {
135
- if(request.readyState == 4) {
136
- if (request.status == 200) {
137
- if(options.onSuccess) options.onSuccess(request);
138
- if(options.onComplete) options.onComplete(request);
139
- if(options.evalScripts) self.evalScripts(request.responseText);
140
- } else {
141
- if(options.onFailure) options.onFailure(request)
142
- if(options.onComplete) options.onComplete(request)
143
- }
144
- }
145
- }
146
-
147
- request.open(options.method, url, true);
148
- request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
149
- request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
150
- request.setRequestHeader('Accept', 'text/javascript, text/html, application/xml, text/xml, */*');
151
- request.send(options.parameters);
152
- },
153
-
154
- update: function(element_id, url, options) {
155
- options.onSuccess = function(response) {
156
- Tr8n.element(element_id).innerHTML = response.responseText;
157
- };
158
- Tr8n.Utils.ajax(url, options);
159
- },
160
-
161
- evalScripts: function(html){
162
- var script_re = '<script[^>]*>([\\S\\s]*?)<\/script>';
163
- var matchAll = new RegExp(script_re, 'img');
164
- var matchOne = new RegExp(script_re, 'im');
165
- var matches = html.match(matchAll) || [];
166
- for(var i=0,l=matches.length;i<l;i++){
167
- var script = (matches[i].match(matchOne) || ['', ''])[1];
168
- // console.info(script)
169
- // alert(script);
170
- eval(script);
171
- }
172
- },
173
-
174
- hasClassName:function(el, cls){
175
- var exp = new RegExp("(^|\\s)"+cls+"($|\\s)");
176
- return (el.className && exp.test(el.className))?true:false;
177
- },
178
-
179
- findElement: function (e,selector,el) {
180
- var event = e || window.event;
181
- var target = el || event.target || event.srcElement;
182
- if(target == document.body) return null;
183
- var condition = (selector.match(/^\./)) ? this.hasClassName(target,selector.replace(/^\./,'')) : (target.tagName.toLowerCase() == selector.toLowerCase());
184
- if(condition) {
185
- return target;
186
- } else {
187
- return this.findElement(e,selector,target.parentNode);
188
- }
189
- },
190
-
191
- cumulativeOffset: function(element) {
192
- var valueT = 0, valueL = 0;
193
- do {
194
- valueT += element.offsetTop || 0;
195
- valueL += element.offsetLeft || 0;
196
- element = element.offsetParent;
197
- } while (element);
198
- return [valueL, valueT];
199
- },
200
-
201
- wrapText: function (obj_id, beginTag, endTag) {
202
- var obj = document.getElementById(obj_id);
203
-
204
- if (typeof obj.selectionStart == 'number') {
205
- // Mozilla, Opera, and other browsers
206
- var start = obj.selectionStart;
207
- var end = obj.selectionEnd;
208
- obj.value = obj.value.substring(0, start) + beginTag + obj.value.substring(start, end) + endTag + obj.value.substring(end, obj.value.length);
209
-
210
- } else if(document.selection) {
211
- // Internet Explorer
212
- obj.focus();
213
- var range = document.selection.createRange();
214
- if(range.parentElement() != obj)
215
- return false;
216
-
217
- if(typeof range.text == 'string')
218
- document.selection.createRange().text = beginTag + range.text + endTag;
219
- } else
220
- obj.value += beginTag + " " + endTag;
221
-
222
- return true;
223
- },
224
-
225
- insertAtCaret: function (areaId, text) {
226
- var txtarea = document.getElementById(areaId);
227
- var scrollPos = txtarea.scrollTop;
228
- var strPos = 0;
229
- var br = ((txtarea.selectionStart || txtarea.selectionStart == '0') ? "ff" : (document.selection ? "ie" : false ) );
230
-
231
- if (br == "ie") {
232
- txtarea.focus();
233
- var range = document.selection.createRange();
234
- range.moveStart ('character', -txtarea.value.length);
235
- strPos = range.text.length;
236
- } else if (br == "ff")
237
- strPos = txtarea.selectionStart;
238
-
239
- var front = (txtarea.value).substring(0, strPos);
240
- var back = (txtarea.value).substring(strPos, txtarea.value.length);
241
- txtarea.value=front+text+back;
242
-
243
- strPos = strPos + text.length;
244
- if (br == "ie") {
245
- txtarea.focus();
246
- var range = document.selection.createRange();
247
- range.moveStart ('character', -txtarea.value.length);
248
- range.moveStart ('character', strPos);
249
- range.moveEnd ('character', 0); range.select();
250
- } else if (br == "ff") {
251
- txtarea.selectionStart = strPos;
252
- txtarea.selectionEnd = strPos;
253
- txtarea.focus();
254
- }
255
- txtarea.scrollTop = scrollPos;
256
- },
257
-
258
- toggleKeyboards: function() {
259
- if(!VKI_attach) return;
260
- if (!this.keyboardMode) {
261
- this.keyboardMode = true;
262
-
263
- var elements = document.getElementsByTagName("input");
264
- for(i=0; i<elements.length; i++) {
265
- if (elements[i].type == "text") VKI_attach(elements[i]);
266
- }
267
- elements = document.getElementsByTagName("textarea");
268
- for(i=0; i<elements.length; i++) {
269
- VKI_attach(elements[i]);
270
- }
271
- } else {
272
- window.location.reload();
273
- }
274
- },
275
-
276
- displayShortcuts: function() {
277
- if (tr8nLightbox)
278
- tr8nLightbox.show('/tr8n/help/lb_shortcuts', {width:400, height:480});
279
- },
280
-
281
- displayStatistics: function() {
282
- if (tr8nLightbox)
283
- tr8nLightbox.show('/tr8n/help/lb_stats', {width:420, height:400});
284
- }
285
-
286
- }