wirispluginengine 7.14.0.1422 → 7.15.0.1425
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/wirispluginengine/WIRISplugins.js +2 -2
- data/lib/wirispluginengine/version.rb +1 -1
- data/resources/VERSION +1 -1
- data/resources/tech.txt +1 -1
- metadata +2 -3
- data/resources/WIRISplugins.js +0 -3809
data/resources/WIRISplugins.js
DELETED
@@ -1,3809 +0,0 @@
|
|
1
|
-
(function(){
|
2
|
-
var $hxClasses = $hxClasses || {},$estr = function() { return js.Boot.__string_rec(this,''); };
|
3
|
-
var EReg = $hxClasses["EReg"] = function(r,opt) {
|
4
|
-
opt = opt.split("u").join("");
|
5
|
-
this.r = new RegExp(r,opt);
|
6
|
-
};
|
7
|
-
EReg.__name__ = ["EReg"];
|
8
|
-
EReg.prototype = {
|
9
|
-
customReplace: function(s,f) {
|
10
|
-
var buf = new StringBuf();
|
11
|
-
while(true) {
|
12
|
-
if(!this.match(s)) break;
|
13
|
-
buf.b += Std.string(this.matchedLeft());
|
14
|
-
buf.b += Std.string(f(this));
|
15
|
-
s = this.matchedRight();
|
16
|
-
}
|
17
|
-
buf.b += Std.string(s);
|
18
|
-
return buf.b;
|
19
|
-
}
|
20
|
-
,replace: function(s,by) {
|
21
|
-
return s.replace(this.r,by);
|
22
|
-
}
|
23
|
-
,split: function(s) {
|
24
|
-
var d = "#__delim__#";
|
25
|
-
return s.replace(this.r,d).split(d);
|
26
|
-
}
|
27
|
-
,matchedPos: function() {
|
28
|
-
if(this.r.m == null) throw "No string matched";
|
29
|
-
return { pos : this.r.m.index, len : this.r.m[0].length};
|
30
|
-
}
|
31
|
-
,matchedRight: function() {
|
32
|
-
if(this.r.m == null) throw "No string matched";
|
33
|
-
var sz = this.r.m.index + this.r.m[0].length;
|
34
|
-
return this.r.s.substr(sz,this.r.s.length - sz);
|
35
|
-
}
|
36
|
-
,matchedLeft: function() {
|
37
|
-
if(this.r.m == null) throw "No string matched";
|
38
|
-
return this.r.s.substr(0,this.r.m.index);
|
39
|
-
}
|
40
|
-
,matched: function(n) {
|
41
|
-
return this.r.m != null && n >= 0 && n < this.r.m.length?this.r.m[n]:(function($this) {
|
42
|
-
var $r;
|
43
|
-
throw "EReg::matched";
|
44
|
-
return $r;
|
45
|
-
}(this));
|
46
|
-
}
|
47
|
-
,match: function(s) {
|
48
|
-
if(this.r.global) this.r.lastIndex = 0;
|
49
|
-
this.r.m = this.r.exec(s);
|
50
|
-
this.r.s = s;
|
51
|
-
return this.r.m != null;
|
52
|
-
}
|
53
|
-
,r: null
|
54
|
-
,__class__: EReg
|
55
|
-
}
|
56
|
-
var Hash = $hxClasses["Hash"] = function() {
|
57
|
-
this.h = { };
|
58
|
-
};
|
59
|
-
Hash.__name__ = ["Hash"];
|
60
|
-
Hash.prototype = {
|
61
|
-
toString: function() {
|
62
|
-
var s = new StringBuf();
|
63
|
-
s.b += Std.string("{");
|
64
|
-
var it = this.keys();
|
65
|
-
while( it.hasNext() ) {
|
66
|
-
var i = it.next();
|
67
|
-
s.b += Std.string(i);
|
68
|
-
s.b += Std.string(" => ");
|
69
|
-
s.b += Std.string(Std.string(this.get(i)));
|
70
|
-
if(it.hasNext()) s.b += Std.string(", ");
|
71
|
-
}
|
72
|
-
s.b += Std.string("}");
|
73
|
-
return s.b;
|
74
|
-
}
|
75
|
-
,iterator: function() {
|
76
|
-
return { ref : this.h, it : this.keys(), hasNext : function() {
|
77
|
-
return this.it.hasNext();
|
78
|
-
}, next : function() {
|
79
|
-
var i = this.it.next();
|
80
|
-
return this.ref["$" + i];
|
81
|
-
}};
|
82
|
-
}
|
83
|
-
,keys: function() {
|
84
|
-
var a = [];
|
85
|
-
for( var key in this.h ) {
|
86
|
-
if(this.h.hasOwnProperty(key)) a.push(key.substr(1));
|
87
|
-
}
|
88
|
-
return HxOverrides.iter(a);
|
89
|
-
}
|
90
|
-
,remove: function(key) {
|
91
|
-
key = "$" + key;
|
92
|
-
if(!this.h.hasOwnProperty(key)) return false;
|
93
|
-
delete(this.h[key]);
|
94
|
-
return true;
|
95
|
-
}
|
96
|
-
,exists: function(key) {
|
97
|
-
return this.h.hasOwnProperty("$" + key);
|
98
|
-
}
|
99
|
-
,get: function(key) {
|
100
|
-
return this.h["$" + key];
|
101
|
-
}
|
102
|
-
,set: function(key,value) {
|
103
|
-
this.h["$" + key] = value;
|
104
|
-
}
|
105
|
-
,h: null
|
106
|
-
,__class__: Hash
|
107
|
-
}
|
108
|
-
var HxOverrides = $hxClasses["HxOverrides"] = function() { }
|
109
|
-
HxOverrides.__name__ = ["HxOverrides"];
|
110
|
-
HxOverrides.dateStr = function(date) {
|
111
|
-
var m = date.getMonth() + 1;
|
112
|
-
var d = date.getDate();
|
113
|
-
var h = date.getHours();
|
114
|
-
var mi = date.getMinutes();
|
115
|
-
var s = date.getSeconds();
|
116
|
-
return date.getFullYear() + "-" + (m < 10?"0" + m:"" + m) + "-" + (d < 10?"0" + d:"" + d) + " " + (h < 10?"0" + h:"" + h) + ":" + (mi < 10?"0" + mi:"" + mi) + ":" + (s < 10?"0" + s:"" + s);
|
117
|
-
}
|
118
|
-
HxOverrides.strDate = function(s) {
|
119
|
-
switch(s.length) {
|
120
|
-
case 8:
|
121
|
-
var k = s.split(":");
|
122
|
-
var d = new Date();
|
123
|
-
d.setTime(0);
|
124
|
-
d.setUTCHours(k[0]);
|
125
|
-
d.setUTCMinutes(k[1]);
|
126
|
-
d.setUTCSeconds(k[2]);
|
127
|
-
return d;
|
128
|
-
case 10:
|
129
|
-
var k = s.split("-");
|
130
|
-
return new Date(k[0],k[1] - 1,k[2],0,0,0);
|
131
|
-
case 19:
|
132
|
-
var k = s.split(" ");
|
133
|
-
var y = k[0].split("-");
|
134
|
-
var t = k[1].split(":");
|
135
|
-
return new Date(y[0],y[1] - 1,y[2],t[0],t[1],t[2]);
|
136
|
-
default:
|
137
|
-
throw "Invalid date format : " + s;
|
138
|
-
}
|
139
|
-
}
|
140
|
-
HxOverrides.cca = function(s,index) {
|
141
|
-
var x = s.charCodeAt(index);
|
142
|
-
if(x != x) return undefined;
|
143
|
-
return x;
|
144
|
-
}
|
145
|
-
HxOverrides.substr = function(s,pos,len) {
|
146
|
-
if(pos != null && pos != 0 && len != null && len < 0) return "";
|
147
|
-
if(len == null) len = s.length;
|
148
|
-
if(pos < 0) {
|
149
|
-
pos = s.length + pos;
|
150
|
-
if(pos < 0) pos = 0;
|
151
|
-
} else if(len < 0) len = s.length + len - pos;
|
152
|
-
return s.substr(pos,len);
|
153
|
-
}
|
154
|
-
HxOverrides.remove = function(a,obj) {
|
155
|
-
var i = 0;
|
156
|
-
var l = a.length;
|
157
|
-
while(i < l) {
|
158
|
-
if(a[i] == obj) {
|
159
|
-
a.splice(i,1);
|
160
|
-
return true;
|
161
|
-
}
|
162
|
-
i++;
|
163
|
-
}
|
164
|
-
return false;
|
165
|
-
}
|
166
|
-
HxOverrides.iter = function(a) {
|
167
|
-
return { cur : 0, arr : a, hasNext : function() {
|
168
|
-
return this.cur < this.arr.length;
|
169
|
-
}, next : function() {
|
170
|
-
return this.arr[this.cur++];
|
171
|
-
}};
|
172
|
-
}
|
173
|
-
var IntHash = $hxClasses["IntHash"] = function() {
|
174
|
-
this.h = { };
|
175
|
-
};
|
176
|
-
IntHash.__name__ = ["IntHash"];
|
177
|
-
IntHash.prototype = {
|
178
|
-
toString: function() {
|
179
|
-
var s = new StringBuf();
|
180
|
-
s.b += Std.string("{");
|
181
|
-
var it = this.keys();
|
182
|
-
while( it.hasNext() ) {
|
183
|
-
var i = it.next();
|
184
|
-
s.b += Std.string(i);
|
185
|
-
s.b += Std.string(" => ");
|
186
|
-
s.b += Std.string(Std.string(this.get(i)));
|
187
|
-
if(it.hasNext()) s.b += Std.string(", ");
|
188
|
-
}
|
189
|
-
s.b += Std.string("}");
|
190
|
-
return s.b;
|
191
|
-
}
|
192
|
-
,iterator: function() {
|
193
|
-
return { ref : this.h, it : this.keys(), hasNext : function() {
|
194
|
-
return this.it.hasNext();
|
195
|
-
}, next : function() {
|
196
|
-
var i = this.it.next();
|
197
|
-
return this.ref[i];
|
198
|
-
}};
|
199
|
-
}
|
200
|
-
,keys: function() {
|
201
|
-
var a = [];
|
202
|
-
for( var key in this.h ) {
|
203
|
-
if(this.h.hasOwnProperty(key)) a.push(key | 0);
|
204
|
-
}
|
205
|
-
return HxOverrides.iter(a);
|
206
|
-
}
|
207
|
-
,remove: function(key) {
|
208
|
-
if(!this.h.hasOwnProperty(key)) return false;
|
209
|
-
delete(this.h[key]);
|
210
|
-
return true;
|
211
|
-
}
|
212
|
-
,exists: function(key) {
|
213
|
-
return this.h.hasOwnProperty(key);
|
214
|
-
}
|
215
|
-
,get: function(key) {
|
216
|
-
return this.h[key];
|
217
|
-
}
|
218
|
-
,set: function(key,value) {
|
219
|
-
this.h[key] = value;
|
220
|
-
}
|
221
|
-
,h: null
|
222
|
-
,__class__: IntHash
|
223
|
-
}
|
224
|
-
var IntIter = $hxClasses["IntIter"] = function(min,max) {
|
225
|
-
this.min = min;
|
226
|
-
this.max = max;
|
227
|
-
};
|
228
|
-
IntIter.__name__ = ["IntIter"];
|
229
|
-
IntIter.prototype = {
|
230
|
-
next: function() {
|
231
|
-
return this.min++;
|
232
|
-
}
|
233
|
-
,hasNext: function() {
|
234
|
-
return this.min < this.max;
|
235
|
-
}
|
236
|
-
,max: null
|
237
|
-
,min: null
|
238
|
-
,__class__: IntIter
|
239
|
-
}
|
240
|
-
var List = $hxClasses["List"] = function() {
|
241
|
-
this.length = 0;
|
242
|
-
};
|
243
|
-
List.__name__ = ["List"];
|
244
|
-
List.prototype = {
|
245
|
-
map: function(f) {
|
246
|
-
var b = new List();
|
247
|
-
var l = this.h;
|
248
|
-
while(l != null) {
|
249
|
-
var v = l[0];
|
250
|
-
l = l[1];
|
251
|
-
b.add(f(v));
|
252
|
-
}
|
253
|
-
return b;
|
254
|
-
}
|
255
|
-
,filter: function(f) {
|
256
|
-
var l2 = new List();
|
257
|
-
var l = this.h;
|
258
|
-
while(l != null) {
|
259
|
-
var v = l[0];
|
260
|
-
l = l[1];
|
261
|
-
if(f(v)) l2.add(v);
|
262
|
-
}
|
263
|
-
return l2;
|
264
|
-
}
|
265
|
-
,join: function(sep) {
|
266
|
-
var s = new StringBuf();
|
267
|
-
var first = true;
|
268
|
-
var l = this.h;
|
269
|
-
while(l != null) {
|
270
|
-
if(first) first = false; else s.b += Std.string(sep);
|
271
|
-
s.b += Std.string(l[0]);
|
272
|
-
l = l[1];
|
273
|
-
}
|
274
|
-
return s.b;
|
275
|
-
}
|
276
|
-
,toString: function() {
|
277
|
-
var s = new StringBuf();
|
278
|
-
var first = true;
|
279
|
-
var l = this.h;
|
280
|
-
s.b += Std.string("{");
|
281
|
-
while(l != null) {
|
282
|
-
if(first) first = false; else s.b += Std.string(", ");
|
283
|
-
s.b += Std.string(Std.string(l[0]));
|
284
|
-
l = l[1];
|
285
|
-
}
|
286
|
-
s.b += Std.string("}");
|
287
|
-
return s.b;
|
288
|
-
}
|
289
|
-
,iterator: function() {
|
290
|
-
return { h : this.h, hasNext : function() {
|
291
|
-
return this.h != null;
|
292
|
-
}, next : function() {
|
293
|
-
if(this.h == null) return null;
|
294
|
-
var x = this.h[0];
|
295
|
-
this.h = this.h[1];
|
296
|
-
return x;
|
297
|
-
}};
|
298
|
-
}
|
299
|
-
,remove: function(v) {
|
300
|
-
var prev = null;
|
301
|
-
var l = this.h;
|
302
|
-
while(l != null) {
|
303
|
-
if(l[0] == v) {
|
304
|
-
if(prev == null) this.h = l[1]; else prev[1] = l[1];
|
305
|
-
if(this.q == l) this.q = prev;
|
306
|
-
this.length--;
|
307
|
-
return true;
|
308
|
-
}
|
309
|
-
prev = l;
|
310
|
-
l = l[1];
|
311
|
-
}
|
312
|
-
return false;
|
313
|
-
}
|
314
|
-
,clear: function() {
|
315
|
-
this.h = null;
|
316
|
-
this.q = null;
|
317
|
-
this.length = 0;
|
318
|
-
}
|
319
|
-
,isEmpty: function() {
|
320
|
-
return this.h == null;
|
321
|
-
}
|
322
|
-
,pop: function() {
|
323
|
-
if(this.h == null) return null;
|
324
|
-
var x = this.h[0];
|
325
|
-
this.h = this.h[1];
|
326
|
-
if(this.h == null) this.q = null;
|
327
|
-
this.length--;
|
328
|
-
return x;
|
329
|
-
}
|
330
|
-
,last: function() {
|
331
|
-
return this.q == null?null:this.q[0];
|
332
|
-
}
|
333
|
-
,first: function() {
|
334
|
-
return this.h == null?null:this.h[0];
|
335
|
-
}
|
336
|
-
,push: function(item) {
|
337
|
-
var x = [item,this.h];
|
338
|
-
this.h = x;
|
339
|
-
if(this.q == null) this.q = x;
|
340
|
-
this.length++;
|
341
|
-
}
|
342
|
-
,add: function(item) {
|
343
|
-
var x = [item];
|
344
|
-
if(this.h == null) this.h = x; else this.q[1] = x;
|
345
|
-
this.q = x;
|
346
|
-
this.length++;
|
347
|
-
}
|
348
|
-
,length: null
|
349
|
-
,q: null
|
350
|
-
,h: null
|
351
|
-
,__class__: List
|
352
|
-
}
|
353
|
-
var Reflect = $hxClasses["Reflect"] = function() { }
|
354
|
-
Reflect.__name__ = ["Reflect"];
|
355
|
-
Reflect.hasField = function(o,field) {
|
356
|
-
return Object.prototype.hasOwnProperty.call(o,field);
|
357
|
-
}
|
358
|
-
Reflect.field = function(o,field) {
|
359
|
-
var v = null;
|
360
|
-
try {
|
361
|
-
v = o[field];
|
362
|
-
} catch( e ) {
|
363
|
-
}
|
364
|
-
return v;
|
365
|
-
}
|
366
|
-
Reflect.setField = function(o,field,value) {
|
367
|
-
o[field] = value;
|
368
|
-
}
|
369
|
-
Reflect.getProperty = function(o,field) {
|
370
|
-
var tmp;
|
371
|
-
return o == null?null:o.__properties__ && (tmp = o.__properties__["get_" + field])?o[tmp]():o[field];
|
372
|
-
}
|
373
|
-
Reflect.setProperty = function(o,field,value) {
|
374
|
-
var tmp;
|
375
|
-
if(o.__properties__ && (tmp = o.__properties__["set_" + field])) o[tmp](value); else o[field] = value;
|
376
|
-
}
|
377
|
-
Reflect.callMethod = function(o,func,args) {
|
378
|
-
return func.apply(o,args);
|
379
|
-
}
|
380
|
-
Reflect.fields = function(o) {
|
381
|
-
var a = [];
|
382
|
-
if(o != null) {
|
383
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
384
|
-
for( var f in o ) {
|
385
|
-
if(hasOwnProperty.call(o,f)) a.push(f);
|
386
|
-
}
|
387
|
-
}
|
388
|
-
return a;
|
389
|
-
}
|
390
|
-
Reflect.isFunction = function(f) {
|
391
|
-
return typeof(f) == "function" && !(f.__name__ || f.__ename__);
|
392
|
-
}
|
393
|
-
Reflect.compare = function(a,b) {
|
394
|
-
return a == b?0:a > b?1:-1;
|
395
|
-
}
|
396
|
-
Reflect.compareMethods = function(f1,f2) {
|
397
|
-
if(f1 == f2) return true;
|
398
|
-
if(!Reflect.isFunction(f1) || !Reflect.isFunction(f2)) return false;
|
399
|
-
return f1.scope == f2.scope && f1.method == f2.method && f1.method != null;
|
400
|
-
}
|
401
|
-
Reflect.isObject = function(v) {
|
402
|
-
if(v == null) return false;
|
403
|
-
var t = typeof(v);
|
404
|
-
return t == "string" || t == "object" && !v.__enum__ || t == "function" && (v.__name__ || v.__ename__);
|
405
|
-
}
|
406
|
-
Reflect.deleteField = function(o,f) {
|
407
|
-
if(!Reflect.hasField(o,f)) return false;
|
408
|
-
delete(o[f]);
|
409
|
-
return true;
|
410
|
-
}
|
411
|
-
Reflect.copy = function(o) {
|
412
|
-
var o2 = { };
|
413
|
-
var _g = 0, _g1 = Reflect.fields(o);
|
414
|
-
while(_g < _g1.length) {
|
415
|
-
var f = _g1[_g];
|
416
|
-
++_g;
|
417
|
-
o2[f] = Reflect.field(o,f);
|
418
|
-
}
|
419
|
-
return o2;
|
420
|
-
}
|
421
|
-
Reflect.makeVarArgs = function(f) {
|
422
|
-
return function() {
|
423
|
-
var a = Array.prototype.slice.call(arguments);
|
424
|
-
return f(a);
|
425
|
-
};
|
426
|
-
}
|
427
|
-
var Std = $hxClasses["Std"] = function() { }
|
428
|
-
Std.__name__ = ["Std"];
|
429
|
-
Std["is"] = function(v,t) {
|
430
|
-
return js.Boot.__instanceof(v,t);
|
431
|
-
}
|
432
|
-
Std.string = function(s) {
|
433
|
-
return js.Boot.__string_rec(s,"");
|
434
|
-
}
|
435
|
-
Std["int"] = function(x) {
|
436
|
-
return x | 0;
|
437
|
-
}
|
438
|
-
Std.parseInt = function(x) {
|
439
|
-
var v = parseInt(x,10);
|
440
|
-
if(v == 0 && (HxOverrides.cca(x,1) == 120 || HxOverrides.cca(x,1) == 88)) v = parseInt(x);
|
441
|
-
if(isNaN(v)) return null;
|
442
|
-
return v;
|
443
|
-
}
|
444
|
-
Std.parseFloat = function(x) {
|
445
|
-
return parseFloat(x);
|
446
|
-
}
|
447
|
-
Std.random = function(x) {
|
448
|
-
return Math.floor(Math.random() * x);
|
449
|
-
}
|
450
|
-
var StringBuf = $hxClasses["StringBuf"] = function() {
|
451
|
-
this.b = "";
|
452
|
-
};
|
453
|
-
StringBuf.__name__ = ["StringBuf"];
|
454
|
-
StringBuf.prototype = {
|
455
|
-
toString: function() {
|
456
|
-
return this.b;
|
457
|
-
}
|
458
|
-
,addSub: function(s,pos,len) {
|
459
|
-
this.b += HxOverrides.substr(s,pos,len);
|
460
|
-
}
|
461
|
-
,addChar: function(c) {
|
462
|
-
this.b += String.fromCharCode(c);
|
463
|
-
}
|
464
|
-
,add: function(x) {
|
465
|
-
this.b += Std.string(x);
|
466
|
-
}
|
467
|
-
,b: null
|
468
|
-
,__class__: StringBuf
|
469
|
-
}
|
470
|
-
var StringTools = $hxClasses["StringTools"] = function() { }
|
471
|
-
StringTools.__name__ = ["StringTools"];
|
472
|
-
StringTools.urlEncode = function(s) {
|
473
|
-
return encodeURIComponent(s);
|
474
|
-
}
|
475
|
-
StringTools.urlDecode = function(s) {
|
476
|
-
return decodeURIComponent(s.split("+").join(" "));
|
477
|
-
}
|
478
|
-
StringTools.htmlEscape = function(s) {
|
479
|
-
return s.split("&").join("&").split("<").join("<").split(">").join(">");
|
480
|
-
}
|
481
|
-
StringTools.htmlUnescape = function(s) {
|
482
|
-
return s.split(">").join(">").split("<").join("<").split("&").join("&");
|
483
|
-
}
|
484
|
-
StringTools.startsWith = function(s,start) {
|
485
|
-
return s.length >= start.length && HxOverrides.substr(s,0,start.length) == start;
|
486
|
-
}
|
487
|
-
StringTools.endsWith = function(s,end) {
|
488
|
-
var elen = end.length;
|
489
|
-
var slen = s.length;
|
490
|
-
return slen >= elen && HxOverrides.substr(s,slen - elen,elen) == end;
|
491
|
-
}
|
492
|
-
StringTools.isSpace = function(s,pos) {
|
493
|
-
var c = HxOverrides.cca(s,pos);
|
494
|
-
return c >= 9 && c <= 13 || c == 32;
|
495
|
-
}
|
496
|
-
StringTools.ltrim = function(s) {
|
497
|
-
var l = s.length;
|
498
|
-
var r = 0;
|
499
|
-
while(r < l && StringTools.isSpace(s,r)) r++;
|
500
|
-
if(r > 0) return HxOverrides.substr(s,r,l - r); else return s;
|
501
|
-
}
|
502
|
-
StringTools.rtrim = function(s) {
|
503
|
-
var l = s.length;
|
504
|
-
var r = 0;
|
505
|
-
while(r < l && StringTools.isSpace(s,l - r - 1)) r++;
|
506
|
-
if(r > 0) return HxOverrides.substr(s,0,l - r); else return s;
|
507
|
-
}
|
508
|
-
StringTools.trim = function(s) {
|
509
|
-
return StringTools.ltrim(StringTools.rtrim(s));
|
510
|
-
}
|
511
|
-
StringTools.rpad = function(s,c,l) {
|
512
|
-
var sl = s.length;
|
513
|
-
var cl = c.length;
|
514
|
-
while(sl < l) if(l - sl < cl) {
|
515
|
-
s += HxOverrides.substr(c,0,l - sl);
|
516
|
-
sl = l;
|
517
|
-
} else {
|
518
|
-
s += c;
|
519
|
-
sl += cl;
|
520
|
-
}
|
521
|
-
return s;
|
522
|
-
}
|
523
|
-
StringTools.lpad = function(s,c,l) {
|
524
|
-
var ns = "";
|
525
|
-
var sl = s.length;
|
526
|
-
if(sl >= l) return s;
|
527
|
-
var cl = c.length;
|
528
|
-
while(sl < l) if(l - sl < cl) {
|
529
|
-
ns += HxOverrides.substr(c,0,l - sl);
|
530
|
-
sl = l;
|
531
|
-
} else {
|
532
|
-
ns += c;
|
533
|
-
sl += cl;
|
534
|
-
}
|
535
|
-
return ns + s;
|
536
|
-
}
|
537
|
-
StringTools.replace = function(s,sub,by) {
|
538
|
-
return s.split(sub).join(by);
|
539
|
-
}
|
540
|
-
StringTools.hex = function(n,digits) {
|
541
|
-
var s = "";
|
542
|
-
var hexChars = "0123456789ABCDEF";
|
543
|
-
do {
|
544
|
-
s = hexChars.charAt(n & 15) + s;
|
545
|
-
n >>>= 4;
|
546
|
-
} while(n > 0);
|
547
|
-
if(digits != null) while(s.length < digits) s = "0" + s;
|
548
|
-
return s;
|
549
|
-
}
|
550
|
-
StringTools.fastCodeAt = function(s,index) {
|
551
|
-
return s.charCodeAt(index);
|
552
|
-
}
|
553
|
-
StringTools.isEOF = function(c) {
|
554
|
-
return c != c;
|
555
|
-
}
|
556
|
-
var ValueType = $hxClasses["ValueType"] = { __ename__ : ["ValueType"], __constructs__ : ["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"] }
|
557
|
-
ValueType.TNull = ["TNull",0];
|
558
|
-
ValueType.TNull.toString = $estr;
|
559
|
-
ValueType.TNull.__enum__ = ValueType;
|
560
|
-
ValueType.TInt = ["TInt",1];
|
561
|
-
ValueType.TInt.toString = $estr;
|
562
|
-
ValueType.TInt.__enum__ = ValueType;
|
563
|
-
ValueType.TFloat = ["TFloat",2];
|
564
|
-
ValueType.TFloat.toString = $estr;
|
565
|
-
ValueType.TFloat.__enum__ = ValueType;
|
566
|
-
ValueType.TBool = ["TBool",3];
|
567
|
-
ValueType.TBool.toString = $estr;
|
568
|
-
ValueType.TBool.__enum__ = ValueType;
|
569
|
-
ValueType.TObject = ["TObject",4];
|
570
|
-
ValueType.TObject.toString = $estr;
|
571
|
-
ValueType.TObject.__enum__ = ValueType;
|
572
|
-
ValueType.TFunction = ["TFunction",5];
|
573
|
-
ValueType.TFunction.toString = $estr;
|
574
|
-
ValueType.TFunction.__enum__ = ValueType;
|
575
|
-
ValueType.TClass = function(c) { var $x = ["TClass",6,c]; $x.__enum__ = ValueType; $x.toString = $estr; return $x; }
|
576
|
-
ValueType.TEnum = function(e) { var $x = ["TEnum",7,e]; $x.__enum__ = ValueType; $x.toString = $estr; return $x; }
|
577
|
-
ValueType.TUnknown = ["TUnknown",8];
|
578
|
-
ValueType.TUnknown.toString = $estr;
|
579
|
-
ValueType.TUnknown.__enum__ = ValueType;
|
580
|
-
var Type = $hxClasses["Type"] = function() { }
|
581
|
-
Type.__name__ = ["Type"];
|
582
|
-
Type.getClass = function(o) {
|
583
|
-
if(o == null) return null;
|
584
|
-
return o.__class__;
|
585
|
-
}
|
586
|
-
Type.getEnum = function(o) {
|
587
|
-
if(o == null) return null;
|
588
|
-
return o.__enum__;
|
589
|
-
}
|
590
|
-
Type.getSuperClass = function(c) {
|
591
|
-
return c.__super__;
|
592
|
-
}
|
593
|
-
Type.getClassName = function(c) {
|
594
|
-
var a = c.__name__;
|
595
|
-
return a.join(".");
|
596
|
-
}
|
597
|
-
Type.getEnumName = function(e) {
|
598
|
-
var a = e.__ename__;
|
599
|
-
return a.join(".");
|
600
|
-
}
|
601
|
-
Type.resolveClass = function(name) {
|
602
|
-
var cl = $hxClasses[name];
|
603
|
-
if(cl == null || !cl.__name__) return null;
|
604
|
-
return cl;
|
605
|
-
}
|
606
|
-
Type.resolveEnum = function(name) {
|
607
|
-
var e = $hxClasses[name];
|
608
|
-
if(e == null || !e.__ename__) return null;
|
609
|
-
return e;
|
610
|
-
}
|
611
|
-
Type.createInstance = function(cl,args) {
|
612
|
-
switch(args.length) {
|
613
|
-
case 0:
|
614
|
-
return new cl();
|
615
|
-
case 1:
|
616
|
-
return new cl(args[0]);
|
617
|
-
case 2:
|
618
|
-
return new cl(args[0],args[1]);
|
619
|
-
case 3:
|
620
|
-
return new cl(args[0],args[1],args[2]);
|
621
|
-
case 4:
|
622
|
-
return new cl(args[0],args[1],args[2],args[3]);
|
623
|
-
case 5:
|
624
|
-
return new cl(args[0],args[1],args[2],args[3],args[4]);
|
625
|
-
case 6:
|
626
|
-
return new cl(args[0],args[1],args[2],args[3],args[4],args[5]);
|
627
|
-
case 7:
|
628
|
-
return new cl(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);
|
629
|
-
case 8:
|
630
|
-
return new cl(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);
|
631
|
-
default:
|
632
|
-
throw "Too many arguments";
|
633
|
-
}
|
634
|
-
return null;
|
635
|
-
}
|
636
|
-
Type.createEmptyInstance = function(cl) {
|
637
|
-
function empty() {}; empty.prototype = cl.prototype;
|
638
|
-
return new empty();
|
639
|
-
}
|
640
|
-
Type.createEnum = function(e,constr,params) {
|
641
|
-
var f = Reflect.field(e,constr);
|
642
|
-
if(f == null) throw "No such constructor " + constr;
|
643
|
-
if(Reflect.isFunction(f)) {
|
644
|
-
if(params == null) throw "Constructor " + constr + " need parameters";
|
645
|
-
return f.apply(e,params);
|
646
|
-
}
|
647
|
-
if(params != null && params.length != 0) throw "Constructor " + constr + " does not need parameters";
|
648
|
-
return f;
|
649
|
-
}
|
650
|
-
Type.createEnumIndex = function(e,index,params) {
|
651
|
-
var c = e.__constructs__[index];
|
652
|
-
if(c == null) throw index + " is not a valid enum constructor index";
|
653
|
-
return Type.createEnum(e,c,params);
|
654
|
-
}
|
655
|
-
Type.getInstanceFields = function(c) {
|
656
|
-
var a = [];
|
657
|
-
for(var i in c.prototype) a.push(i);
|
658
|
-
HxOverrides.remove(a,"__class__");
|
659
|
-
HxOverrides.remove(a,"__properties__");
|
660
|
-
return a;
|
661
|
-
}
|
662
|
-
Type.getClassFields = function(c) {
|
663
|
-
var a = Reflect.fields(c);
|
664
|
-
HxOverrides.remove(a,"__name__");
|
665
|
-
HxOverrides.remove(a,"__interfaces__");
|
666
|
-
HxOverrides.remove(a,"__properties__");
|
667
|
-
HxOverrides.remove(a,"__super__");
|
668
|
-
HxOverrides.remove(a,"prototype");
|
669
|
-
return a;
|
670
|
-
}
|
671
|
-
Type.getEnumConstructs = function(e) {
|
672
|
-
var a = e.__constructs__;
|
673
|
-
return a.slice();
|
674
|
-
}
|
675
|
-
Type["typeof"] = function(v) {
|
676
|
-
switch(typeof(v)) {
|
677
|
-
case "boolean":
|
678
|
-
return ValueType.TBool;
|
679
|
-
case "string":
|
680
|
-
return ValueType.TClass(String);
|
681
|
-
case "number":
|
682
|
-
if(Math.ceil(v) == v % 2147483648.0) return ValueType.TInt;
|
683
|
-
return ValueType.TFloat;
|
684
|
-
case "object":
|
685
|
-
if(v == null) return ValueType.TNull;
|
686
|
-
var e = v.__enum__;
|
687
|
-
if(e != null) return ValueType.TEnum(e);
|
688
|
-
var c = v.__class__;
|
689
|
-
if(c != null) return ValueType.TClass(c);
|
690
|
-
return ValueType.TObject;
|
691
|
-
case "function":
|
692
|
-
if(v.__name__ || v.__ename__) return ValueType.TObject;
|
693
|
-
return ValueType.TFunction;
|
694
|
-
case "undefined":
|
695
|
-
return ValueType.TNull;
|
696
|
-
default:
|
697
|
-
return ValueType.TUnknown;
|
698
|
-
}
|
699
|
-
}
|
700
|
-
Type.enumEq = function(a,b) {
|
701
|
-
if(a == b) return true;
|
702
|
-
try {
|
703
|
-
if(a[0] != b[0]) return false;
|
704
|
-
var _g1 = 2, _g = a.length;
|
705
|
-
while(_g1 < _g) {
|
706
|
-
var i = _g1++;
|
707
|
-
if(!Type.enumEq(a[i],b[i])) return false;
|
708
|
-
}
|
709
|
-
var e = a.__enum__;
|
710
|
-
if(e != b.__enum__ || e == null) return false;
|
711
|
-
} catch( e ) {
|
712
|
-
return false;
|
713
|
-
}
|
714
|
-
return true;
|
715
|
-
}
|
716
|
-
Type.enumConstructor = function(e) {
|
717
|
-
return e[0];
|
718
|
-
}
|
719
|
-
Type.enumParameters = function(e) {
|
720
|
-
return e.slice(2);
|
721
|
-
}
|
722
|
-
Type.enumIndex = function(e) {
|
723
|
-
return e[1];
|
724
|
-
}
|
725
|
-
Type.allEnums = function(e) {
|
726
|
-
var all = [];
|
727
|
-
var cst = e.__constructs__;
|
728
|
-
var _g = 0;
|
729
|
-
while(_g < cst.length) {
|
730
|
-
var c = cst[_g];
|
731
|
-
++_g;
|
732
|
-
var v = Reflect.field(e,c);
|
733
|
-
if(!Reflect.isFunction(v)) all.push(v);
|
734
|
-
}
|
735
|
-
return all;
|
736
|
-
}
|
737
|
-
var com = com || {}
|
738
|
-
if(!com.wiris) com.wiris = {}
|
739
|
-
if(!com.wiris.js) com.wiris.js = {}
|
740
|
-
com.wiris.js.JsBrowserData = $hxClasses["com.wiris.js.JsBrowserData"] = function() {
|
741
|
-
};
|
742
|
-
com.wiris.js.JsBrowserData.__name__ = ["com","wiris","js","JsBrowserData"];
|
743
|
-
com.wiris.js.JsBrowserData.prototype = {
|
744
|
-
identity: null
|
745
|
-
,versionSearch: null
|
746
|
-
,subString: null
|
747
|
-
,prop: null
|
748
|
-
,string: null
|
749
|
-
,__class__: com.wiris.js.JsBrowserData
|
750
|
-
}
|
751
|
-
com.wiris.js.JsOSData = $hxClasses["com.wiris.js.JsOSData"] = function() {
|
752
|
-
};
|
753
|
-
com.wiris.js.JsOSData.__name__ = ["com","wiris","js","JsOSData"];
|
754
|
-
com.wiris.js.JsOSData.prototype = {
|
755
|
-
identity: null
|
756
|
-
,subString: null
|
757
|
-
,string: null
|
758
|
-
,__class__: com.wiris.js.JsOSData
|
759
|
-
}
|
760
|
-
com.wiris.js.JsBrowser = $hxClasses["com.wiris.js.JsBrowser"] = function() {
|
761
|
-
this.dataBrowser = new Array();
|
762
|
-
this.addBrowser("navigator.userAgent",null,"Edge",null,"Edge");
|
763
|
-
this.addBrowser("navigator.userAgent",null,"Chrome",null,"Chrome");
|
764
|
-
this.addBrowser("navigator.userAgent",null,"OmniWeb",null,"OmniWeb");
|
765
|
-
this.addBrowser("navigator.vendor",null,"Apple","Version","Safari");
|
766
|
-
this.addBrowser(null,"window.opera",null,"Version","Opera");
|
767
|
-
this.addBrowser("navigator.vendor",null,"iCab",null,"iCab");
|
768
|
-
this.addBrowser("navigator.vendor",null,"KDE",null,"Konkeror");
|
769
|
-
this.addBrowser("navigator.userAgent",null,"Firefox",null,"Firefox");
|
770
|
-
this.addBrowser("navigator.vendor",null,"Camino",null,"Camino");
|
771
|
-
this.addBrowser("navigator.userAgent",null,"Netscape",null,"Netscape");
|
772
|
-
this.addBrowser("navigator.userAgent",null,"MSIE","MSIE","Explorer");
|
773
|
-
this.addBrowser("navigator.userAgent",null,"Trident","rv","Explorer");
|
774
|
-
this.addBrowser("navigator.userAgent",null,"Gecko","rv","Mozilla");
|
775
|
-
this.addBrowser("navigator.userAgent",null,"Mozilla","Mozilla","Netscape");
|
776
|
-
this.dataOS = new Array();
|
777
|
-
this.addOS("navigator.platform","Win","Windows");
|
778
|
-
this.addOS("navigator.platform","Mac","Mac");
|
779
|
-
this.addOS("navigator.userAgent","iPhone","iOS");
|
780
|
-
this.addOS("navigator.userAgent","iPad","iOS");
|
781
|
-
this.addOS("navigator.userAgent","Android","Android");
|
782
|
-
this.addOS("navigator.platform","Linux","Linux");
|
783
|
-
this.setBrowser();
|
784
|
-
this.setOS();
|
785
|
-
this.setTouchable();
|
786
|
-
};
|
787
|
-
com.wiris.js.JsBrowser.__name__ = ["com","wiris","js","JsBrowser"];
|
788
|
-
com.wiris.js.JsBrowser.prototype = {
|
789
|
-
isTouchable: function() {
|
790
|
-
return this.touchable;
|
791
|
-
}
|
792
|
-
,isAndroid: function() {
|
793
|
-
return this.os == "Android";
|
794
|
-
}
|
795
|
-
,isMac: function() {
|
796
|
-
return this.os == "Mac";
|
797
|
-
}
|
798
|
-
,isIOS: function() {
|
799
|
-
return this.os == "iOS";
|
800
|
-
}
|
801
|
-
,isFF: function() {
|
802
|
-
return this.browser == "Firefox";
|
803
|
-
}
|
804
|
-
,isSafari: function() {
|
805
|
-
return this.browser == "Safari";
|
806
|
-
}
|
807
|
-
,isChrome: function() {
|
808
|
-
return this.browser == "Chrome";
|
809
|
-
}
|
810
|
-
,isEdge: function() {
|
811
|
-
return this.browser == "Edge";
|
812
|
-
}
|
813
|
-
,isIE: function() {
|
814
|
-
return this.browser == "Explorer";
|
815
|
-
}
|
816
|
-
,getVersion: function() {
|
817
|
-
return this.ver;
|
818
|
-
}
|
819
|
-
,getOS: function() {
|
820
|
-
return this.os;
|
821
|
-
}
|
822
|
-
,getBrowser: function() {
|
823
|
-
return this.browser;
|
824
|
-
}
|
825
|
-
,searchVersion: function(prop,search) {
|
826
|
-
var str = js.Boot.__cast(eval(prop) , String);
|
827
|
-
var index = str.indexOf(search);
|
828
|
-
if(index == -1) return null;
|
829
|
-
return "" + Std.parseFloat(HxOverrides.substr(str,index + search.length + 1,null));
|
830
|
-
}
|
831
|
-
,setTouchable: function() {
|
832
|
-
if(this.isIOS() || this.isAndroid()) {
|
833
|
-
this.touchable = true;
|
834
|
-
return;
|
835
|
-
}
|
836
|
-
this.touchable = false;
|
837
|
-
}
|
838
|
-
,setOS: function() {
|
839
|
-
var i = HxOverrides.iter(this.dataOS);
|
840
|
-
while(i.hasNext()) {
|
841
|
-
var s = i.next();
|
842
|
-
var str = js.Boot.__cast(eval(s.string) , String);
|
843
|
-
if(str.indexOf(s.subString) != -1) {
|
844
|
-
this.os = s.identity;
|
845
|
-
return;
|
846
|
-
}
|
847
|
-
}
|
848
|
-
}
|
849
|
-
,setBrowser: function() {
|
850
|
-
var i = HxOverrides.iter(this.dataBrowser);
|
851
|
-
while(i.hasNext()) {
|
852
|
-
var b = i.next();
|
853
|
-
if(b.string != null) {
|
854
|
-
var obj = eval(b.string);
|
855
|
-
if(obj != null) {
|
856
|
-
var str = js.Boot.__cast(obj , String);
|
857
|
-
if(str.indexOf(b.subString) != -1) {
|
858
|
-
this.browser = b.identity;
|
859
|
-
this.ver = this.searchVersion("navigator.userAgent",b.versionSearch);
|
860
|
-
if(this.ver == null) this.ver = this.searchVersion("navigator.appVersion",b.versionSearch);
|
861
|
-
return;
|
862
|
-
}
|
863
|
-
}
|
864
|
-
}
|
865
|
-
}
|
866
|
-
}
|
867
|
-
,addOS: function(string,subString,identity) {
|
868
|
-
var s = new com.wiris.js.JsOSData();
|
869
|
-
s.string = string;
|
870
|
-
s.subString = subString;
|
871
|
-
s.identity = identity;
|
872
|
-
this.dataOS.push(s);
|
873
|
-
}
|
874
|
-
,addBrowser: function(string,prop,subString,versionSearch,identity) {
|
875
|
-
var b = new com.wiris.js.JsBrowserData();
|
876
|
-
b.string = string;
|
877
|
-
b.prop = prop;
|
878
|
-
b.subString = subString;
|
879
|
-
b.versionSearch = versionSearch != null?versionSearch:identity;
|
880
|
-
b.identity = identity;
|
881
|
-
this.dataBrowser.push(b);
|
882
|
-
}
|
883
|
-
,touchable: null
|
884
|
-
,os: null
|
885
|
-
,ver: null
|
886
|
-
,browser: null
|
887
|
-
,dataOS: null
|
888
|
-
,dataBrowser: null
|
889
|
-
,__class__: com.wiris.js.JsBrowser
|
890
|
-
}
|
891
|
-
com.wiris.js.JsPluginListener = $hxClasses["com.wiris.js.JsPluginListener"] = function() { }
|
892
|
-
com.wiris.js.JsPluginListener.__name__ = ["com","wiris","js","JsPluginListener"];
|
893
|
-
com.wiris.js.JsPluginListener.prototype = {
|
894
|
-
afterParseLatex: null
|
895
|
-
,afterParse: null
|
896
|
-
,__class__: com.wiris.js.JsPluginListener
|
897
|
-
}
|
898
|
-
com.wiris.js.JsPluginTools = $hxClasses["com.wiris.js.JsPluginTools"] = function() {
|
899
|
-
this.tryReady();
|
900
|
-
};
|
901
|
-
com.wiris.js.JsPluginTools.__name__ = ["com","wiris","js","JsPluginTools"];
|
902
|
-
com.wiris.js.JsPluginTools.instance = null;
|
903
|
-
com.wiris.js.JsPluginTools.main = function() {
|
904
|
-
var ev;
|
905
|
-
ev = com.wiris.js.JsPluginTools.getInstance();
|
906
|
-
haxe.Timer.delay($bind(ev,ev.tryReady),100);
|
907
|
-
}
|
908
|
-
com.wiris.js.JsPluginTools.getInstance = function() {
|
909
|
-
if(com.wiris.js.JsPluginTools.instance == null) com.wiris.js.JsPluginTools.instance = new com.wiris.js.JsPluginTools();
|
910
|
-
return com.wiris.js.JsPluginTools.instance;
|
911
|
-
}
|
912
|
-
com.wiris.js.JsPluginTools.bypassEncapsulation = function() {
|
913
|
-
if(window.com == null) window.com = { };
|
914
|
-
if(window.com.wiris == null) window.com.wiris = { };
|
915
|
-
if(window.com.wiris.js == null) window.com.wiris.js = { };
|
916
|
-
if(window.com.wiris.js.JsPluginTools == null) window.com.wiris.js.JsPluginTools = com.wiris.js.JsPluginTools.getInstance();
|
917
|
-
}
|
918
|
-
com.wiris.js.JsPluginTools.prototype = {
|
919
|
-
md5encode: function(content) {
|
920
|
-
return haxe.Md5.encode(content);
|
921
|
-
}
|
922
|
-
,doLoad: function() {
|
923
|
-
this.ready = true;
|
924
|
-
com.wiris.js.JsPluginTools.instance = this;
|
925
|
-
com.wiris.js.JsPluginTools.bypassEncapsulation();
|
926
|
-
}
|
927
|
-
,tryReady: function() {
|
928
|
-
this.ready = false;
|
929
|
-
if(js.Lib.document.readyState) {
|
930
|
-
this.doLoad();
|
931
|
-
this.ready = true;
|
932
|
-
}
|
933
|
-
if(!this.ready) haxe.Timer.delay($bind(this,this.tryReady),100);
|
934
|
-
}
|
935
|
-
,ready: null
|
936
|
-
,__class__: com.wiris.js.JsPluginTools
|
937
|
-
}
|
938
|
-
com.wiris.js.JsPluginViewer = $hxClasses["com.wiris.js.JsPluginViewer"] = function() {
|
939
|
-
this._wrs_conf_imageFormat = null;
|
940
|
-
this.javaServicePath = "/pluginwiris_engine/app";
|
941
|
-
this.wiriseditormathmlattribute = null;
|
942
|
-
this.performanceenabled = null;
|
943
|
-
this.eventListenersArray = [];
|
944
|
-
this.callsShowImageNumber = 0;
|
945
|
-
this.callsLatexToMathml = 0;
|
946
|
-
this.params = new Hash();
|
947
|
-
this.mode = com.wiris.js.JsPluginViewer.USE_CREATE_IMAGE;
|
948
|
-
this.zoom = 1;
|
949
|
-
this.viewer = "";
|
950
|
-
this.lang = "inherit";
|
951
|
-
this.ready = false;
|
952
|
-
this.extension = "@param.configuration.script.extension@";
|
953
|
-
this.localpath = "@param.configuration.script.local.path@";
|
954
|
-
this.absoluteURL = "@param.configuration.script.base.path@";
|
955
|
-
if(this.extension.indexOf("@") >= 0) this.extension = "";
|
956
|
-
if(this.localpath.indexOf("@") >= 0) this.localpath = "/app";
|
957
|
-
if(this.absoluteURL.indexOf("@") >= 0) this.absoluteURL = "/java-java-context-root";
|
958
|
-
};
|
959
|
-
com.wiris.js.JsPluginViewer.__name__ = ["com","wiris","js","JsPluginViewer"];
|
960
|
-
com.wiris.js.JsPluginViewer.instance = null;
|
961
|
-
com.wiris.js.JsPluginViewer.main = function() {
|
962
|
-
var ev;
|
963
|
-
ev = com.wiris.js.JsPluginViewer.getInstance();
|
964
|
-
haxe.Timer.delay($bind(ev,ev.tryReady),100);
|
965
|
-
}
|
966
|
-
com.wiris.js.JsPluginViewer.getInstance = function() {
|
967
|
-
if(com.wiris.js.JsPluginViewer.instance == null) com.wiris.js.JsPluginViewer.instance = new com.wiris.js.JsPluginViewer();
|
968
|
-
return com.wiris.js.JsPluginViewer.instance;
|
969
|
-
}
|
970
|
-
com.wiris.js.JsPluginViewer.bypassEncapsulation = function() {
|
971
|
-
if(window.com == null) window.com = { };
|
972
|
-
if(window.com.wiris == null) window.com.wiris = { };
|
973
|
-
if(window.com.wiris.js == null) window.com.wiris.js = { };
|
974
|
-
if(window.com.wiris.js.JsPluginViewer == null) window.com.wiris.js.JsPluginViewer = com.wiris.js.JsPluginViewer.getInstance();
|
975
|
-
}
|
976
|
-
com.wiris.js.JsPluginViewer.prototype = {
|
977
|
-
removeViewerListener: function(listener) {
|
978
|
-
while(HxOverrides.remove(this.eventListenersArray,listener)) {
|
979
|
-
}
|
980
|
-
}
|
981
|
-
,addViewerListener: function(listener) {
|
982
|
-
this.eventListenersArray.push(listener);
|
983
|
-
}
|
984
|
-
,getBaseURL: function() {
|
985
|
-
return this.baseURL;
|
986
|
-
}
|
987
|
-
,queryToParams: function(query) {
|
988
|
-
var ss = query.split("&");
|
989
|
-
var h = new Hash();
|
990
|
-
var _g = 0;
|
991
|
-
while(_g < ss.length) {
|
992
|
-
var s = ss[_g];
|
993
|
-
++_g;
|
994
|
-
var kv = s.split("=");
|
995
|
-
if(kv.length > 1) h.set(kv[0],StringTools.urlDecode(kv[1]));
|
996
|
-
}
|
997
|
-
return h;
|
998
|
-
}
|
999
|
-
,isPerformanceEnabled: function() {
|
1000
|
-
var data;
|
1001
|
-
data = this.callGetVariableKeys("wirispluginperformance");
|
1002
|
-
if(haxe.Json.parse(data).status != "ok") return false; else return haxe.Json.parse(data).result.wirispluginperformance == "true"?true:false;
|
1003
|
-
}
|
1004
|
-
,callGetVariableKeys: function(variableKeys) {
|
1005
|
-
var con;
|
1006
|
-
var data;
|
1007
|
-
var url;
|
1008
|
-
url = (this.absoluteURL.length > 0?this.absoluteURL:this.baseURL + this.localpath) + "/configurationjson" + this.extension;
|
1009
|
-
con = new js.XMLHttpRequest();
|
1010
|
-
data = "?variablekeys=" + variableKeys;
|
1011
|
-
con.open("GET",url + data,false);
|
1012
|
-
con.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8");
|
1013
|
-
con.send(null);
|
1014
|
-
return con.responseText;
|
1015
|
-
}
|
1016
|
-
,callService: function(mml,servicename) {
|
1017
|
-
var con;
|
1018
|
-
var height = 0;
|
1019
|
-
var width = 0;
|
1020
|
-
var baseline = 0;
|
1021
|
-
var text = null;
|
1022
|
-
var data;
|
1023
|
-
var url;
|
1024
|
-
con = new js.XMLHttpRequest();
|
1025
|
-
url = (this.absoluteURL.length > 0?this.absoluteURL:this.baseURL + this.localpath) + "/service" + this.extension;
|
1026
|
-
data = "service=" + servicename;
|
1027
|
-
data += "&metrics=true¢erbaseline=false&mml=" + StringTools.urlEncode(mml);
|
1028
|
-
data += "&lang=" + this.lang;
|
1029
|
-
if(this.zoom != 1) data += "&zoom=" + this.zoom;
|
1030
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Calling: " + url,{ fileName : "JsPluginViewer.hx", lineNumber : 842, className : "com.wiris.js.JsPluginViewer", methodName : "callService"});
|
1031
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("POST:" + data,{ fileName : "JsPluginViewer.hx", lineNumber : 844, className : "com.wiris.js.JsPluginViewer", methodName : "callService"});
|
1032
|
-
con.open("POST",url,false);
|
1033
|
-
con.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8");
|
1034
|
-
con.send(data);
|
1035
|
-
return con.responseText;
|
1036
|
-
}
|
1037
|
-
,latexToMathml: function(latex,nodeAfter,asynchronously,callbackFunc) {
|
1038
|
-
var _g = this;
|
1039
|
-
var con = new js.XMLHttpRequest();
|
1040
|
-
var url = (this.absoluteURL.length > 0?this.absoluteURL:this.baseURL + this.localpath) + "/service" + this.extension;
|
1041
|
-
var data = "service=latex2mathml";
|
1042
|
-
data += "&latex=" + StringTools.urlEncode(latex);
|
1043
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Calling: " + url,{ fileName : "JsPluginViewer.hx", lineNumber : 776, className : "com.wiris.js.JsPluginViewer", methodName : "latexToMathml"});
|
1044
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("POST:" + data,{ fileName : "JsPluginViewer.hx", lineNumber : 778, className : "com.wiris.js.JsPluginViewer", methodName : "latexToMathml"});
|
1045
|
-
var onloadFunc = function(e) {
|
1046
|
-
try {
|
1047
|
-
var mathml = haxe.Json.parse(con.responseText).result.text;
|
1048
|
-
var newMathml = js.Lib.document.createElement("math");
|
1049
|
-
var mathmlSpan = js.Lib.document.createElement("span");
|
1050
|
-
mathmlSpan.appendChild(newMathml);
|
1051
|
-
e.target.wiris.nodeAfter.parentElement.insertBefore(mathmlSpan,e.target.wiris.nodeAfter.nextSibling);
|
1052
|
-
newMathml.outerHTML = mathml;
|
1053
|
-
if(--_g.callsLatexToMathml == 0) {
|
1054
|
-
var _g2 = 0, _g1 = _g.eventListenersArray.length;
|
1055
|
-
while(_g2 < _g1) {
|
1056
|
-
var i = _g2++;
|
1057
|
-
try {
|
1058
|
-
_g.eventListenersArray[i].afterParseLatex();
|
1059
|
-
} catch( e1 ) {
|
1060
|
-
}
|
1061
|
-
}
|
1062
|
-
}
|
1063
|
-
e.target.wiris.callbackFunc(mathmlSpan);
|
1064
|
-
_g.parseElement(mathmlSpan,asynchronously);
|
1065
|
-
} catch( e1 ) {
|
1066
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("LatexToMathml call failed!",{ fileName : "JsPluginViewer.hx", lineNumber : 804, className : "com.wiris.js.JsPluginViewer", methodName : "latexToMathml"});
|
1067
|
-
}
|
1068
|
-
};
|
1069
|
-
con.open("POST",url,asynchronously);
|
1070
|
-
var newDynamic = { };
|
1071
|
-
con.wiris = newDynamic;
|
1072
|
-
con.wiris.nodeAfter = nodeAfter;
|
1073
|
-
con.wiris.callbackFunc = callbackFunc;
|
1074
|
-
con.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8");
|
1075
|
-
con.onload = onloadFunc;
|
1076
|
-
con.onerror = function(e) {
|
1077
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("LatexToMathml call failed!",{ fileName : "JsPluginViewer.hx", lineNumber : 817, className : "com.wiris.js.JsPluginViewer", methodName : "latexToMathml"});
|
1078
|
-
};
|
1079
|
-
con.send(data);
|
1080
|
-
}
|
1081
|
-
,callShowimage: function(container,mml,img,asynchronously,callbackFunc) {
|
1082
|
-
var _g = this;
|
1083
|
-
var con;
|
1084
|
-
var height = 0;
|
1085
|
-
var width = 0;
|
1086
|
-
var baseline = 0;
|
1087
|
-
var text = null;
|
1088
|
-
var data;
|
1089
|
-
var url;
|
1090
|
-
con = new js.XMLHttpRequest();
|
1091
|
-
var mmlEntities;
|
1092
|
-
mmlEntities = "";
|
1093
|
-
var _g1 = 0, _g2 = mml.length;
|
1094
|
-
while(_g1 < _g2) {
|
1095
|
-
var i = _g1++;
|
1096
|
-
var character;
|
1097
|
-
character = mml.charAt(i);
|
1098
|
-
if(HxOverrides.cca(mml,i) > 128) mmlEntities += "&#" + HxOverrides.cca(mml,i) + ";"; else mmlEntities += character;
|
1099
|
-
}
|
1100
|
-
var md5 = haxe.Md5.encode("centerbaseline=false\nmml=" + mmlEntities + "\n");
|
1101
|
-
url = (this.absoluteURL.length > 0?this.absoluteURL:this.baseURL + this.localpath) + "/showimage" + this.extension;
|
1102
|
-
if(new com.wiris.js.JsBrowser().isIE()) data = "?formula=" + md5 + "&lang=" + this.lang + "&useragent=IE"; else data = "?formula=" + md5 + "&lang=" + this.lang;
|
1103
|
-
data += "&version=" + com.wiris.js.JsPluginViewer.VERSION;
|
1104
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Calling: " + url,{ fileName : "JsPluginViewer.hx", lineNumber : 654, className : "com.wiris.js.JsPluginViewer", methodName : "callShowimage"});
|
1105
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("GET:" + data,{ fileName : "JsPluginViewer.hx", lineNumber : 656, className : "com.wiris.js.JsPluginViewer", methodName : "callShowimage"});
|
1106
|
-
con.open("GET",url + data,asynchronously);
|
1107
|
-
con.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8");
|
1108
|
-
var onloadFunc = function(e) {
|
1109
|
-
var getResultFunc = function(e1) {
|
1110
|
-
var result = { };
|
1111
|
-
try {
|
1112
|
-
result = haxe.Json.parse(con.responseText).result;
|
1113
|
-
} catch( e2 ) {
|
1114
|
-
console.warn("Formula is malformed and it can't be rendered");
|
1115
|
-
return;
|
1116
|
-
}
|
1117
|
-
e1.target.wiris.img.src = result.format == "svg"?"data:image/svg+xml;charset=utf8,":"data:image/png;base64,";
|
1118
|
-
e1.target.wiris.img.src = e1.target.wiris.img.src + StringTools.urlEncode(result.content);
|
1119
|
-
var dpi = result.dpi == null?96:result.dpi;
|
1120
|
-
var scaleDpi = _g.zoom * (96 / dpi);
|
1121
|
-
var scaledHeight = result.height * scaleDpi | 0;
|
1122
|
-
var scaledWitdh = result.width * scaleDpi | 0;
|
1123
|
-
var scaledBaseLine = result.baseline * scaleDpi | 0;
|
1124
|
-
if(result.height > 0) {
|
1125
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace(_g.calculateAlignment(height,baseline),{ fileName : "JsPluginViewer.hx", lineNumber : 680, className : "com.wiris.js.JsPluginViewer", methodName : "callShowimage"});
|
1126
|
-
e1.target.wiris.img.style.verticalAlign = "-" + _g.calculateAlignment(scaledHeight,scaledBaseLine) + "px";
|
1127
|
-
e1.target.wiris.img.style.height = "" + scaledHeight + "px";
|
1128
|
-
e1.target.wiris.img.style.width = "" + scaledWitdh + "px";
|
1129
|
-
}
|
1130
|
-
if(_g.wiriseditormathmlattribute == null) {
|
1131
|
-
var wirisEditorMathmlAttributeCall = haxe.Json.parse(_g.callGetVariableKeys("wiriseditormathmlattribute"));
|
1132
|
-
if(wirisEditorMathmlAttributeCall.status != "ok") _g.wiriseditormathmlattribute = "data-mathml"; else _g.wiriseditormathmlattribute = wirisEditorMathmlAttributeCall.result.wiriseditormathmlattribute;
|
1133
|
-
}
|
1134
|
-
e1.target.wiris.img.setAttribute(_g.wiriseditormathmlattribute,e1.target.wiris.mml);
|
1135
|
-
e1.target.wiris.img.setAttribute("class","Wirisformula");
|
1136
|
-
e1.target.wiris.img.setAttribute("role","math");
|
1137
|
-
if(result.alt != null) e1.target.wiris.img.alt = result.alt; else {
|
1138
|
-
var accessibilityResponse = _g.callService(e1.target.wiris.mml,"mathml2accessible");
|
1139
|
-
if(haxe.Json.parse(accessibilityResponse).status != "error") e1.target.wiris.img.alt = haxe.Json.parse(accessibilityResponse).result.text;
|
1140
|
-
}
|
1141
|
-
if(--_g.callsShowImageNumber == 0) {
|
1142
|
-
var _g2 = 0, _g1 = _g.eventListenersArray.length;
|
1143
|
-
while(_g2 < _g1) {
|
1144
|
-
var i = _g2++;
|
1145
|
-
try {
|
1146
|
-
_g.eventListenersArray[i].afterParse();
|
1147
|
-
} catch( e2 ) {
|
1148
|
-
}
|
1149
|
-
}
|
1150
|
-
}
|
1151
|
-
callbackFunc();
|
1152
|
-
};
|
1153
|
-
if(haxe.Json.parse(con.responseText).status == "warning") {
|
1154
|
-
con.open("POST",url,e.target.wiris.asynchronously);
|
1155
|
-
con.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8");
|
1156
|
-
var onloadFunc1 = function(e1) {
|
1157
|
-
getResultFunc(e1);
|
1158
|
-
};
|
1159
|
-
if(new com.wiris.js.JsBrowser().isIE()) data = "centerbaseline=false&mml=" + StringTools.urlEncode(e.target.wiris.mml) + "&useragent=IE"; else data = "centerbaseline=false&mml=" + StringTools.urlEncode(e.target.wiris.mml);
|
1160
|
-
var newDynamic = { };
|
1161
|
-
con.wiris = newDynamic;
|
1162
|
-
con.wiris.callbackFunc = callbackFunc;
|
1163
|
-
con.wiris.getResultFunc = getResultFunc;
|
1164
|
-
con.wiris.mml = mml;
|
1165
|
-
con.wiris.img = img;
|
1166
|
-
con.wiris.container = container;
|
1167
|
-
con.onload = onloadFunc1;
|
1168
|
-
con.onerror = function(e1) {
|
1169
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("ShowImage call failed!",{ fileName : "JsPluginViewer.hx", lineNumber : 744, className : "com.wiris.js.JsPluginViewer", methodName : "callShowimage"});
|
1170
|
-
};
|
1171
|
-
con.send(data);
|
1172
|
-
} else getResultFunc(e);
|
1173
|
-
};
|
1174
|
-
var newDynamic = { };
|
1175
|
-
con.wiris = newDynamic;
|
1176
|
-
con.wiris.callbackFunc = callbackFunc;
|
1177
|
-
con.wiris.mml = mml;
|
1178
|
-
con.wiris.img = img;
|
1179
|
-
con.wiris.container = container;
|
1180
|
-
con.wiris.asynchronously = asynchronously;
|
1181
|
-
con.onload = onloadFunc;
|
1182
|
-
con.onerror = function(e) {
|
1183
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("ShowImage call failed!",{ fileName : "JsPluginViewer.hx", lineNumber : 764, className : "com.wiris.js.JsPluginViewer", methodName : "callShowimage"});
|
1184
|
-
};
|
1185
|
-
con.send(null);
|
1186
|
-
}
|
1187
|
-
,callCreateImage: function(mml,img) {
|
1188
|
-
var con;
|
1189
|
-
var height = 0;
|
1190
|
-
var width = 0;
|
1191
|
-
var baseline = 0;
|
1192
|
-
var text = null;
|
1193
|
-
var data;
|
1194
|
-
var url;
|
1195
|
-
con = new js.XMLHttpRequest();
|
1196
|
-
url = (this.absoluteURL.length > 0?this.absoluteURL:this.baseURL + this.localpath) + "/createimage" + this.extension;
|
1197
|
-
data = "metrics=true¢erbaseline=false&mml=" + StringTools.urlEncode(mml);
|
1198
|
-
data += "&lang=" + this.lang;
|
1199
|
-
if(this.zoom != 1) data += "&zoom=" + this.zoom;
|
1200
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Calling: " + url,{ fileName : "JsPluginViewer.hx", lineNumber : 583, className : "com.wiris.js.JsPluginViewer", methodName : "callCreateImage"});
|
1201
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("POST:" + data,{ fileName : "JsPluginViewer.hx", lineNumber : 585, className : "com.wiris.js.JsPluginViewer", methodName : "callCreateImage"});
|
1202
|
-
con.open("POST",url,false);
|
1203
|
-
con.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8");
|
1204
|
-
con.send(data);
|
1205
|
-
var s = con.responseText;
|
1206
|
-
var i = s.indexOf("?");
|
1207
|
-
if(i >= 0) {
|
1208
|
-
var scaleDpi = 1;
|
1209
|
-
var h = this.queryToParams(HxOverrides.substr(s,i + 1,null));
|
1210
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace(h.get("formula"),{ fileName : "JsPluginViewer.hx", lineNumber : 595, className : "com.wiris.js.JsPluginViewer", methodName : "callCreateImage"});
|
1211
|
-
if(h.exists("dpi")) scaleDpi = this.zoom * (Std.parseInt(h.get("dpi")) / 96);
|
1212
|
-
baseline = Std.parseInt(h.get("cb")) / scaleDpi | 0;
|
1213
|
-
height = Std.parseInt(h.get("ch")) / scaleDpi | 0;
|
1214
|
-
width = Std.parseInt(h.get("cw")) / scaleDpi | 0;
|
1215
|
-
text = h.get("text");
|
1216
|
-
}
|
1217
|
-
img.src = con.responseText;
|
1218
|
-
if(height > 0) {
|
1219
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace(this.calculateAlignment(height,baseline),{ fileName : "JsPluginViewer.hx", lineNumber : 606, className : "com.wiris.js.JsPluginViewer", methodName : "callCreateImage"});
|
1220
|
-
img.style.verticalAlign = "-" + this.calculateAlignment(height,baseline) + "px";
|
1221
|
-
img.style.height = "" + height + "px";
|
1222
|
-
img.style.width = "" + width + "px";
|
1223
|
-
}
|
1224
|
-
img.setAttribute("data-mathml",mml);
|
1225
|
-
img.setAttribute("class","Wirisformula");
|
1226
|
-
img.setAttribute("role","math");
|
1227
|
-
var accessibility = this.callService(mml,"mathml2accessible");
|
1228
|
-
if(accessibility != null) img.alt = haxe.Json.parse(accessibility).result.text;
|
1229
|
-
}
|
1230
|
-
,calculateAlignment: function(height,baseline) {
|
1231
|
-
var result;
|
1232
|
-
result = 0;
|
1233
|
-
result = height - baseline;
|
1234
|
-
return result;
|
1235
|
-
}
|
1236
|
-
,getTechnology: function() {
|
1237
|
-
if(HxOverrides.substr(com.wiris.js.JsPluginViewer.TECH,1,null) == "param.js.tech.discover@") {
|
1238
|
-
var con;
|
1239
|
-
con = new js.XMLHttpRequest();
|
1240
|
-
con.open("GET",this.baseURL + "/../tech.txt",false);
|
1241
|
-
con.send(null);
|
1242
|
-
var s = con.responseText;
|
1243
|
-
return StringTools.trim(s.split("#")[0]);
|
1244
|
-
} else return com.wiris.js.JsPluginViewer.TECH;
|
1245
|
-
}
|
1246
|
-
,processMathML: function(mml,container,asynchronously,callbackFunc) {
|
1247
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace(mml,{ fileName : "JsPluginViewer.hx", lineNumber : 528, className : "com.wiris.js.JsPluginViewer", methodName : "processMathML"});
|
1248
|
-
var img = js.Lib.document.createElement("img");
|
1249
|
-
if(this.performanceenabled == null) this.performanceenabled = this.isPerformanceEnabled();
|
1250
|
-
if(this.mode == com.wiris.js.JsPluginViewer.USE_CREATE_IMAGE && this.performanceenabled) this.callShowimage(container,mml,img,asynchronously,callbackFunc); else if(this.mode == com.wiris.js.JsPluginViewer.USE_CREATE_IMAGE && !this.performanceenabled) this.callCreateImage(mml,img); else img.src = this.baseURL + this.localpath + "/showimage" + this.extension + "?mml=" + StringTools.urlEncode(mml);
|
1251
|
-
container.appendChild(img);
|
1252
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace(img.src,{ fileName : "JsPluginViewer.hx", lineNumber : 542, className : "com.wiris.js.JsPluginViewer", methodName : "processMathML"});
|
1253
|
-
}
|
1254
|
-
,getMathML_IE7: function(mathNode0) {
|
1255
|
-
var mathml = "";
|
1256
|
-
var mathNode = mathNode0;
|
1257
|
-
while(mathNode != null && mathNode.nodeName != "/MATH") {
|
1258
|
-
if(mathNode.nodeType == 3) mathml += mathNode.nodeValue; else {
|
1259
|
-
var nodeName = mathNode.nodeName.toLowerCase();
|
1260
|
-
if(nodeName.charAt(0) == "/") mathml += "</" + HxOverrides.substr(nodeName,1,null) + ">"; else {
|
1261
|
-
mathml += "<" + nodeName;
|
1262
|
-
var attributes = mathNode.attributes;
|
1263
|
-
var i = 0;
|
1264
|
-
while(i < attributes.length) {
|
1265
|
-
var attribute = attributes[i];
|
1266
|
-
if(attribute.nodeValue != "" && attribute.nodeValue != null && attribute.nodeValue != "inherit") mathml += " " + attribute.nodeName + "=\"" + attribute.nodeValue + "\"";
|
1267
|
-
++i;
|
1268
|
-
}
|
1269
|
-
var counter = 1;
|
1270
|
-
var nextMathNode = mathNode.nextSibling;
|
1271
|
-
while(nextMathNode != null && counter > 0) {
|
1272
|
-
var nextNodeName = nextMathNode.nodeName.toLowerCase();
|
1273
|
-
if(nextNodeName == nodeName) ++counter; else if(nextNodeName == "/" + nodeName) --counter;
|
1274
|
-
nextMathNode = nextMathNode.nextSibling;
|
1275
|
-
}
|
1276
|
-
if(counter > 0) mathml += "/";
|
1277
|
-
mathml += ">";
|
1278
|
-
}
|
1279
|
-
}
|
1280
|
-
var nextMathNode = mathNode.nextSibling;
|
1281
|
-
if(mathNode != mathNode0) mathNode.parentNode.removeChild(mathNode);
|
1282
|
-
mathNode = nextMathNode;
|
1283
|
-
}
|
1284
|
-
if(mathNode.nodeName == "/MATH") mathNode.parentNode.removeChild(mathNode);
|
1285
|
-
mathml += "</math>";
|
1286
|
-
return mathml;
|
1287
|
-
}
|
1288
|
-
,removeSemanticsMathml: function(mathml) {
|
1289
|
-
var mathTagEnd = "</math>";
|
1290
|
-
var openSemantics = "<semantics>";
|
1291
|
-
var openAnnotation = "<annotation";
|
1292
|
-
var mathmlWithoutSemantics = mathml;
|
1293
|
-
var startSemantics = mathml.indexOf(openSemantics);
|
1294
|
-
if(startSemantics != -1) {
|
1295
|
-
var startAnnotation = mathml.indexOf(openAnnotation,startSemantics + openSemantics.length);
|
1296
|
-
if(startAnnotation != -1) mathmlWithoutSemantics = mathml.substring(0,startSemantics) + mathml.substring(startSemantics + openSemantics.length,startAnnotation) + mathTagEnd;
|
1297
|
-
}
|
1298
|
-
return mathmlWithoutSemantics;
|
1299
|
-
}
|
1300
|
-
,replaceNodes: function(mathNodes,n,asynchronously,callbackFunc) {
|
1301
|
-
if(n >= mathNodes.length) return;
|
1302
|
-
var mathNode = mathNodes[n];
|
1303
|
-
var mathml = null;
|
1304
|
-
var browser = new com.wiris.js.JsBrowser();
|
1305
|
-
if(browser.getBrowser() == "Explorer" && (browser.getVersion() == "6" || browser.getVersion() == "7") && navigator.appVersion.indexOf("Trident") == -1) {
|
1306
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Is ie7",{ fileName : "JsPluginViewer.hx", lineNumber : 397, className : "com.wiris.js.JsPluginViewer", methodName : "replaceNodes"});
|
1307
|
-
mathml = this.getMathML_IE7(mathNode);
|
1308
|
-
}
|
1309
|
-
var container = js.Lib.document.createElement("span");
|
1310
|
-
if(mathNode.parentNode != null) mathNode.parentNode.replaceChild(container,mathNode);
|
1311
|
-
if(mathml == null) {
|
1312
|
-
container.appendChild(mathNode);
|
1313
|
-
mathml = container.innerHTML;
|
1314
|
-
container.removeChild(mathNode);
|
1315
|
-
}
|
1316
|
-
var index = mathml.indexOf("<math");
|
1317
|
-
mathml = HxOverrides.substr(mathml,index,mathml.length - index);
|
1318
|
-
var containerMath = js.Lib.document.createElement("span");
|
1319
|
-
var containerMathElement = js.Lib.document.createElement("math");
|
1320
|
-
containerMath.appendChild(containerMathElement);
|
1321
|
-
containerMathElement.outerHTML = mathml;
|
1322
|
-
mathml = new XMLSerializer().serializeToString(containerMath.children[0]);
|
1323
|
-
this.processMathML(mathml,container,asynchronously,callbackFunc);
|
1324
|
-
var self = this;
|
1325
|
-
self.replaceNodes(mathNodes,n + 1,asynchronously,callbackFunc);
|
1326
|
-
}
|
1327
|
-
,replaceLatexInTextNode: function(pos,node,asynchronously,callbackFunc) {
|
1328
|
-
var textContent;
|
1329
|
-
textContent = node.textContent;
|
1330
|
-
if(pos < textContent.length) {
|
1331
|
-
var nextLatexPosistion = this.getNextLatexPos(pos,textContent);
|
1332
|
-
if(nextLatexPosistion != null) {
|
1333
|
-
var leftText = textContent.substring(pos,nextLatexPosistion.start);
|
1334
|
-
var leftTextNode = js.Lib.document.createTextNode(leftText);
|
1335
|
-
node.parentNode.insertBefore(leftTextNode,node);
|
1336
|
-
var latex = textContent.substring(nextLatexPosistion.start + "$$".length,nextLatexPosistion.end);
|
1337
|
-
this.latexToMathml(latex,leftTextNode,asynchronously,callbackFunc);
|
1338
|
-
this.replaceLatexInTextNode(nextLatexPosistion.end + "$$".length,node,asynchronously,callbackFunc);
|
1339
|
-
} else {
|
1340
|
-
var text = textContent.substring(pos);
|
1341
|
-
var textNode = js.Lib.document.createTextNode(text);
|
1342
|
-
node.parentNode.insertBefore(textNode,node);
|
1343
|
-
node.parentNode.removeChild(node);
|
1344
|
-
}
|
1345
|
-
} else node.parentNode.removeChild(node);
|
1346
|
-
}
|
1347
|
-
,getNextLatexPos: function(pos,text) {
|
1348
|
-
var firstLatexTags = text.indexOf("$$",pos);
|
1349
|
-
var secondLatexTags = firstLatexTags == -1?-1:text.indexOf("$$",firstLatexTags + "$$".length);
|
1350
|
-
return firstLatexTags != -1 && secondLatexTags != -1?{ start : firstLatexTags, end : secondLatexTags}:null;
|
1351
|
-
}
|
1352
|
-
,findLatex: function(node) {
|
1353
|
-
var foundLatex = false;
|
1354
|
-
var dollarIndex = node.nodeValue.indexOf("$$");
|
1355
|
-
if(dollarIndex != -1) {
|
1356
|
-
dollarIndex = node.nodeValue.indexOf("$$",dollarIndex + 2);
|
1357
|
-
if(dollarIndex != -1) foundLatex = true;
|
1358
|
-
}
|
1359
|
-
return foundLatex;
|
1360
|
-
}
|
1361
|
-
,parseLatexDocument: function(asynchronously,callbackFunc) {
|
1362
|
-
this.parseLatexElement(js.Lib.document,asynchronously,callbackFunc);
|
1363
|
-
}
|
1364
|
-
,parseLatexElement: function(element,asynchronously,callbackFunc) {
|
1365
|
-
if(callbackFunc == null) callbackFunc = function() {
|
1366
|
-
};
|
1367
|
-
if(asynchronously == null) {
|
1368
|
-
if(this.asyncParam) asynchronously = this.asyncParam;
|
1369
|
-
}
|
1370
|
-
var domTextNodes = this.findTextNodes(element);
|
1371
|
-
var latexToProcess = [];
|
1372
|
-
var i = 0;
|
1373
|
-
while(i < domTextNodes.length) {
|
1374
|
-
var node = domTextNodes[i];
|
1375
|
-
if(this.findLatex(node)) latexToProcess.push(node);
|
1376
|
-
i++;
|
1377
|
-
}
|
1378
|
-
if(latexToProcess.length == 0) {
|
1379
|
-
var _g1 = 0, _g = this.eventListenersArray.length;
|
1380
|
-
while(_g1 < _g) {
|
1381
|
-
var i1 = _g1++;
|
1382
|
-
try {
|
1383
|
-
this.eventListenersArray[i1].afterParseLatex();
|
1384
|
-
} catch( e ) {
|
1385
|
-
}
|
1386
|
-
}
|
1387
|
-
} else {
|
1388
|
-
this.callsLatexToMathml = latexToProcess.length;
|
1389
|
-
var _g1 = 0, _g = latexToProcess.length;
|
1390
|
-
while(_g1 < _g) {
|
1391
|
-
var i1 = _g1++;
|
1392
|
-
var node = latexToProcess[i1];
|
1393
|
-
this.replaceLatexInTextNode(0,node,asynchronously,callbackFunc);
|
1394
|
-
}
|
1395
|
-
}
|
1396
|
-
}
|
1397
|
-
,findTextNodes: function(el) {
|
1398
|
-
var textNodes = [];
|
1399
|
-
var walk = document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false);
|
1400
|
-
var node;
|
1401
|
-
while(node = walk.nextNode()) if(!this.thereIsParentTextArea(node)) textNodes.push(node);
|
1402
|
-
return textNodes;
|
1403
|
-
}
|
1404
|
-
,thereIsParentTextArea: function(el) {
|
1405
|
-
var thereIs = false;
|
1406
|
-
var parentNode = el.parentNode;
|
1407
|
-
while(!thereIs && parentNode != null) {
|
1408
|
-
if(parentNode.nodeName == "TEXTAREA") thereIs = true;
|
1409
|
-
parentNode = parentNode.parentNode;
|
1410
|
-
}
|
1411
|
-
return thereIs;
|
1412
|
-
}
|
1413
|
-
,isEditable: function(element) {
|
1414
|
-
while(element != null) {
|
1415
|
-
if(element.contentEditable == "true") return true;
|
1416
|
-
element = element.parentNode;
|
1417
|
-
}
|
1418
|
-
return false;
|
1419
|
-
}
|
1420
|
-
,parseElement: function(element,asynchronously,callbackFunc) {
|
1421
|
-
if(!this.ready) throw "Document is not loaded.";
|
1422
|
-
if(callbackFunc == null) callbackFunc = function() {
|
1423
|
-
};
|
1424
|
-
if(asynchronously == null) {
|
1425
|
-
if(this.asyncParam) asynchronously = this.asyncParam;
|
1426
|
-
}
|
1427
|
-
var mathNodes = element.getElementsByTagName("math");
|
1428
|
-
var arr = new Array();
|
1429
|
-
var _g1 = 0, _g = mathNodes.length;
|
1430
|
-
while(_g1 < _g) {
|
1431
|
-
var x = _g1++;
|
1432
|
-
if(!this.isEditable(mathNodes[x])) arr.push(mathNodes[x]);
|
1433
|
-
}
|
1434
|
-
this.callsShowImageNumber = arr.length;
|
1435
|
-
if(this.callsShowImageNumber == 0) {
|
1436
|
-
var _g1 = 0, _g = this.eventListenersArray.length;
|
1437
|
-
while(_g1 < _g) {
|
1438
|
-
var i = _g1++;
|
1439
|
-
try {
|
1440
|
-
this.eventListenersArray[i].afterParse();
|
1441
|
-
} catch( e ) {
|
1442
|
-
}
|
1443
|
-
}
|
1444
|
-
}
|
1445
|
-
this.replaceNodes(arr,0,asynchronously,callbackFunc);
|
1446
|
-
}
|
1447
|
-
,parseDocument: function(asynchronously,callbackFunc) {
|
1448
|
-
this.parseElement(js.Lib.document,asynchronously,callbackFunc);
|
1449
|
-
}
|
1450
|
-
,doLoad: function() {
|
1451
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("doLoad",{ fileName : "JsPluginViewer.hx", lineNumber : 118, className : "com.wiris.js.JsPluginViewer", methodName : "doLoad"});
|
1452
|
-
this.scriptName = "WIRISplugins.js";
|
1453
|
-
var col;
|
1454
|
-
col = js.Lib.document.getElementsByTagName("script");
|
1455
|
-
var _g1 = 0, _g = col.length;
|
1456
|
-
while(_g1 < _g) {
|
1457
|
-
var i = _g1++;
|
1458
|
-
var d;
|
1459
|
-
var src;
|
1460
|
-
d = col[i];
|
1461
|
-
src = d.src;
|
1462
|
-
var j = src.lastIndexOf(this.scriptName);
|
1463
|
-
if(j >= 0) {
|
1464
|
-
this.baseURL = HxOverrides.substr(src,0,j - 1);
|
1465
|
-
var k = src.indexOf("?",j);
|
1466
|
-
if(k >= 0) {
|
1467
|
-
var query = HxOverrides.substr(src,k + 1,null);
|
1468
|
-
this.params = this.queryToParams(query);
|
1469
|
-
}
|
1470
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace(this.baseURL,{ fileName : "JsPluginViewer.hx", lineNumber : 137, className : "com.wiris.js.JsPluginViewer", methodName : "doLoad"});
|
1471
|
-
}
|
1472
|
-
}
|
1473
|
-
this.tech = this.getTechnology();
|
1474
|
-
if(this.tech == "php") {
|
1475
|
-
this.extension = ".php";
|
1476
|
-
this.localpath = "";
|
1477
|
-
this.absoluteURL = "";
|
1478
|
-
} else if(this.tech == "aspx") {
|
1479
|
-
this.extension = ".aspx";
|
1480
|
-
this.localpath = "";
|
1481
|
-
this.absoluteURL = "";
|
1482
|
-
} else if(this.tech == "local-java") {
|
1483
|
-
this.extension = "";
|
1484
|
-
this.localpath = "/../app";
|
1485
|
-
this.absoluteURL = "";
|
1486
|
-
} else if(this.tech == "nodejs") {
|
1487
|
-
this.extension = "";
|
1488
|
-
this.localpath = "/../integration";
|
1489
|
-
this.absoluteURL = "";
|
1490
|
-
} else if(this.tech == "java") {
|
1491
|
-
this.extension = "";
|
1492
|
-
this.localpath = "";
|
1493
|
-
this.absoluteURL = "";
|
1494
|
-
} else if(this.tech == "ruby") {
|
1495
|
-
this.extension = "";
|
1496
|
-
this.absoluteURL = "/wirispluginengine/integration";
|
1497
|
-
}
|
1498
|
-
this.ready = true;
|
1499
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Tech:" + this.tech,{ fileName : "JsPluginViewer.hx", lineNumber : 168, className : "com.wiris.js.JsPluginViewer", methodName : "doLoad"});
|
1500
|
-
if(this.params.exists("viewer")) this.viewer = this.params.get("viewer");
|
1501
|
-
this.asyncParam = this.params.exists("async") && this.params.get("async") == "true"?true:false;
|
1502
|
-
if(this.params.exists("zoom")) this.zoom = Std.parseFloat(this.params.get("zoom"));
|
1503
|
-
if(this.params.exists("dpi")) this.zoom *= Std.parseFloat(this.params.get("dpi")) / 96;
|
1504
|
-
if(this.params.exists("lang")) this.lang = this.params.get("lang"); else this.lang = "en";
|
1505
|
-
if(this.lang == "inherit") this.lang = js.Lib.document.getElementsByTagName("html")[0].lang;
|
1506
|
-
if(this.viewer == "image") this.parseDocument(); else if(this.viewer == "latex") this.parseLatexDocument(this.asyncParam); else if(this.viewer == "all") {
|
1507
|
-
this.parseLatexDocument(this.asyncParam);
|
1508
|
-
this.parseDocument(this.asyncParam);
|
1509
|
-
}
|
1510
|
-
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Language:" + this.lang,{ fileName : "JsPluginViewer.hx", lineNumber : 198, className : "com.wiris.js.JsPluginViewer", methodName : "doLoad"});
|
1511
|
-
com.wiris.js.JsPluginViewer.instance = this;
|
1512
|
-
com.wiris.js.JsPluginViewer.bypassEncapsulation();
|
1513
|
-
}
|
1514
|
-
,tryReady: function() {
|
1515
|
-
this.ready = false;
|
1516
|
-
if(js.Lib.document.readyState) {
|
1517
|
-
this.doLoad();
|
1518
|
-
this.ready = true;
|
1519
|
-
}
|
1520
|
-
if(!this.ready) haxe.Timer.delay($bind(this,this.tryReady),100);
|
1521
|
-
}
|
1522
|
-
,eventListenersArray: null
|
1523
|
-
,callsLatexToMathml: null
|
1524
|
-
,callsShowImageNumber: null
|
1525
|
-
,_wrs_conf_imageFormat: null
|
1526
|
-
,ready: null
|
1527
|
-
,javaServicePath: null
|
1528
|
-
,tech: null
|
1529
|
-
,lang: null
|
1530
|
-
,wiriseditormathmlattribute: null
|
1531
|
-
,performanceenabled: null
|
1532
|
-
,asyncParam: null
|
1533
|
-
,viewer: null
|
1534
|
-
,zoom: null
|
1535
|
-
,absoluteURL: null
|
1536
|
-
,localpath: null
|
1537
|
-
,extension: null
|
1538
|
-
,mode: null
|
1539
|
-
,params: null
|
1540
|
-
,scriptName: null
|
1541
|
-
,baseURL: null
|
1542
|
-
,__class__: com.wiris.js.JsPluginViewer
|
1543
|
-
}
|
1544
|
-
if(!com.wiris.system) com.wiris.system = {}
|
1545
|
-
com.wiris.system.JsBrowserData = $hxClasses["com.wiris.system.JsBrowserData"] = function() {
|
1546
|
-
};
|
1547
|
-
com.wiris.system.JsBrowserData.__name__ = ["com","wiris","system","JsBrowserData"];
|
1548
|
-
com.wiris.system.JsBrowserData.prototype = {
|
1549
|
-
identity: null
|
1550
|
-
,versionSearch: null
|
1551
|
-
,subString: null
|
1552
|
-
,prop: null
|
1553
|
-
,string: null
|
1554
|
-
,__class__: com.wiris.system.JsBrowserData
|
1555
|
-
}
|
1556
|
-
com.wiris.system.JsOSData = $hxClasses["com.wiris.system.JsOSData"] = function() {
|
1557
|
-
};
|
1558
|
-
com.wiris.system.JsOSData.__name__ = ["com","wiris","system","JsOSData"];
|
1559
|
-
com.wiris.system.JsOSData.prototype = {
|
1560
|
-
identity: null
|
1561
|
-
,subString: null
|
1562
|
-
,string: null
|
1563
|
-
,__class__: com.wiris.system.JsOSData
|
1564
|
-
}
|
1565
|
-
com.wiris.system.JsBrowser = $hxClasses["com.wiris.system.JsBrowser"] = function() {
|
1566
|
-
this.dataBrowser = new Array();
|
1567
|
-
this.addBrowser("navigator.userAgent",null,"Edge",null,"Edge");
|
1568
|
-
this.addBrowser("navigator.userAgent",null,"Chrome",null,"Chrome");
|
1569
|
-
this.addBrowser("navigator.userAgent",null,"OmniWeb",null,"OmniWeb");
|
1570
|
-
this.addBrowser("navigator.vendor",null,"Apple","Version","Safari");
|
1571
|
-
this.addBrowser(null,"window.opera",null,"Version","Opera");
|
1572
|
-
this.addBrowser("navigator.vendor",null,"iCab",null,"iCab");
|
1573
|
-
this.addBrowser("navigator.vendor",null,"KDE",null,"Konkeror");
|
1574
|
-
this.addBrowser("navigator.userAgent",null,"Firefox",null,"Firefox");
|
1575
|
-
this.addBrowser("navigator.vendor",null,"Camino",null,"Camino");
|
1576
|
-
this.addBrowser("navigator.userAgent",null,"Netscape",null,"Netscape");
|
1577
|
-
this.addBrowser("navigator.userAgent",null,"MSIE","MSIE","Explorer");
|
1578
|
-
this.addBrowser("navigator.userAgent",null,"Trident","rv","Explorer");
|
1579
|
-
this.addBrowser("navigator.userAgent",null,"Gecko","rv","Mozilla");
|
1580
|
-
this.addBrowser("navigator.userAgent",null,"Mozilla","Mozilla","Netscape");
|
1581
|
-
this.dataOS = new Array();
|
1582
|
-
this.addOS("navigator.platform","Win","Windows");
|
1583
|
-
this.addOS("navigator.platform","Mac","Mac");
|
1584
|
-
this.addOS("navigator.userAgent","iPhone","iOS");
|
1585
|
-
this.addOS("navigator.userAgent","iPad","iOS");
|
1586
|
-
this.addOS("navigator.userAgent","Android","Android");
|
1587
|
-
this.addOS("navigator.platform","Linux","Linux");
|
1588
|
-
this.setBrowser();
|
1589
|
-
this.setOS();
|
1590
|
-
this.setTouchable();
|
1591
|
-
};
|
1592
|
-
com.wiris.system.JsBrowser.__name__ = ["com","wiris","system","JsBrowser"];
|
1593
|
-
com.wiris.system.JsBrowser.prototype = {
|
1594
|
-
isTouchable: function() {
|
1595
|
-
return this.touchable;
|
1596
|
-
}
|
1597
|
-
,isAndroid: function() {
|
1598
|
-
return this.os == "Android";
|
1599
|
-
}
|
1600
|
-
,isMac: function() {
|
1601
|
-
return this.os == "Mac";
|
1602
|
-
}
|
1603
|
-
,isIOS: function() {
|
1604
|
-
return this.os == "iOS";
|
1605
|
-
}
|
1606
|
-
,isFF: function() {
|
1607
|
-
return this.browser == "Firefox";
|
1608
|
-
}
|
1609
|
-
,isSafari: function() {
|
1610
|
-
return this.browser == "Safari";
|
1611
|
-
}
|
1612
|
-
,isChrome: function() {
|
1613
|
-
return this.browser == "Chrome";
|
1614
|
-
}
|
1615
|
-
,isEdge: function() {
|
1616
|
-
return this.browser == "Edge";
|
1617
|
-
}
|
1618
|
-
,isIE: function() {
|
1619
|
-
return this.browser == "Explorer";
|
1620
|
-
}
|
1621
|
-
,getVersion: function() {
|
1622
|
-
return this.ver;
|
1623
|
-
}
|
1624
|
-
,getOS: function() {
|
1625
|
-
return this.os;
|
1626
|
-
}
|
1627
|
-
,getBrowser: function() {
|
1628
|
-
return this.browser;
|
1629
|
-
}
|
1630
|
-
,searchVersion: function(prop,search) {
|
1631
|
-
var str = js.Boot.__cast(eval(prop) , String);
|
1632
|
-
var index = str.indexOf(search);
|
1633
|
-
if(index == -1) return null;
|
1634
|
-
return "" + Std.parseFloat(HxOverrides.substr(str,index + search.length + 1,null));
|
1635
|
-
}
|
1636
|
-
,setTouchable: function() {
|
1637
|
-
if(this.isIOS() || this.isAndroid()) {
|
1638
|
-
this.touchable = true;
|
1639
|
-
return;
|
1640
|
-
}
|
1641
|
-
this.touchable = false;
|
1642
|
-
}
|
1643
|
-
,setOS: function() {
|
1644
|
-
var i = HxOverrides.iter(this.dataOS);
|
1645
|
-
while(i.hasNext()) {
|
1646
|
-
var s = i.next();
|
1647
|
-
var str = js.Boot.__cast(eval(s.string) , String);
|
1648
|
-
if(str.indexOf(s.subString) != -1) {
|
1649
|
-
this.os = s.identity;
|
1650
|
-
return;
|
1651
|
-
}
|
1652
|
-
}
|
1653
|
-
}
|
1654
|
-
,setBrowser: function() {
|
1655
|
-
var i = HxOverrides.iter(this.dataBrowser);
|
1656
|
-
while(i.hasNext()) {
|
1657
|
-
var b = i.next();
|
1658
|
-
if(b.string != null) {
|
1659
|
-
var obj = eval(b.string);
|
1660
|
-
if(obj != null) {
|
1661
|
-
var str = js.Boot.__cast(obj , String);
|
1662
|
-
if(str.indexOf(b.subString) != -1) {
|
1663
|
-
this.browser = b.identity;
|
1664
|
-
this.ver = this.searchVersion("navigator.userAgent",b.versionSearch);
|
1665
|
-
if(this.ver == null) this.ver = this.searchVersion("navigator.appVersion",b.versionSearch);
|
1666
|
-
return;
|
1667
|
-
}
|
1668
|
-
}
|
1669
|
-
}
|
1670
|
-
}
|
1671
|
-
}
|
1672
|
-
,addOS: function(string,subString,identity) {
|
1673
|
-
var s = new com.wiris.system.JsOSData();
|
1674
|
-
s.string = string;
|
1675
|
-
s.subString = subString;
|
1676
|
-
s.identity = identity;
|
1677
|
-
this.dataOS.push(s);
|
1678
|
-
}
|
1679
|
-
,addBrowser: function(string,prop,subString,versionSearch,identity) {
|
1680
|
-
var b = new com.wiris.system.JsBrowserData();
|
1681
|
-
b.string = string;
|
1682
|
-
b.prop = prop;
|
1683
|
-
b.subString = subString;
|
1684
|
-
b.versionSearch = versionSearch != null?versionSearch:identity;
|
1685
|
-
b.identity = identity;
|
1686
|
-
this.dataBrowser.push(b);
|
1687
|
-
}
|
1688
|
-
,touchable: null
|
1689
|
-
,os: null
|
1690
|
-
,ver: null
|
1691
|
-
,browser: null
|
1692
|
-
,dataOS: null
|
1693
|
-
,dataBrowser: null
|
1694
|
-
,__class__: com.wiris.system.JsBrowser
|
1695
|
-
}
|
1696
|
-
com.wiris.system.JsDOMUtils = $hxClasses["com.wiris.system.JsDOMUtils"] = function() { }
|
1697
|
-
com.wiris.system.JsDOMUtils.__name__ = ["com","wiris","system","JsDOMUtils"];
|
1698
|
-
com.wiris.system.JsDOMUtils.ieTouchEvents = null;
|
1699
|
-
com.wiris.system.JsDOMUtils.init = function() {
|
1700
|
-
if(com.wiris.system.JsDOMUtils.initialized) return;
|
1701
|
-
com.wiris.system.JsDOMUtils.ieTouchEvents = new Hash();
|
1702
|
-
com.wiris.system.JsDOMUtils.ieTouchEvents.set("touchstart","MSPointerDown");
|
1703
|
-
com.wiris.system.JsDOMUtils.ieTouchEvents.set("touchmove","MSPointerMove");
|
1704
|
-
com.wiris.system.JsDOMUtils.ieTouchEvents.set("touchend","MSPointerUp");
|
1705
|
-
com.wiris.system.JsDOMUtils.initialized = true;
|
1706
|
-
com.wiris.system.JsDOMUtils.addEventListener(js.Lib.document,"MSPointerDown",function(e) {
|
1707
|
-
com.wiris.system.JsDOMUtils.internetExplorerPointers.set("" + e.pointerId,e);
|
1708
|
-
});
|
1709
|
-
com.wiris.system.JsDOMUtils.addEventListener(js.Lib.document,"MSPointerUp",function(e) {
|
1710
|
-
com.wiris.system.JsDOMUtils.internetExplorerPointers = new Hash();
|
1711
|
-
});
|
1712
|
-
com.wiris.system.JsDOMUtils.addEventListener(js.Lib.document,"scroll",function(e) {
|
1713
|
-
com.wiris.system.JsDOMUtils.internetExplorerPointers = new Hash();
|
1714
|
-
});
|
1715
|
-
var touched = false;
|
1716
|
-
var triggerEvents = function(listeners) {
|
1717
|
-
var i = HxOverrides.iter(listeners);
|
1718
|
-
while(i.hasNext()) {
|
1719
|
-
var callbackFunction = i.next();
|
1720
|
-
callbackFunction();
|
1721
|
-
}
|
1722
|
-
};
|
1723
|
-
com.wiris.system.JsDOMUtils.addEventListener(js.Lib.document,"touchstart",function(e) {
|
1724
|
-
if(!com.wiris.system.JsDOMUtils.browser.touchable) {
|
1725
|
-
com.wiris.system.JsDOMUtils.browser.touchable = true;
|
1726
|
-
triggerEvents(com.wiris.system.JsDOMUtils.touchDeviceListeners);
|
1727
|
-
}
|
1728
|
-
touched = true;
|
1729
|
-
});
|
1730
|
-
var onTouchEnd = function(e) {
|
1731
|
-
if(!com.wiris.system.JsDOMUtils.browser.touchable) {
|
1732
|
-
com.wiris.system.JsDOMUtils.browser.touchable = true;
|
1733
|
-
triggerEvents(com.wiris.system.JsDOMUtils.touchDeviceListeners);
|
1734
|
-
}
|
1735
|
-
touched = true;
|
1736
|
-
setTimeout(function() {
|
1737
|
-
touched = false;
|
1738
|
-
},500);
|
1739
|
-
};
|
1740
|
-
com.wiris.system.JsDOMUtils.addEventListener(js.Lib.document,"touchend",onTouchEnd);
|
1741
|
-
com.wiris.system.JsDOMUtils.addEventListener(js.Lib.document,"touchleave",onTouchEnd);
|
1742
|
-
com.wiris.system.JsDOMUtils.addEventListener(js.Lib.document,"touchcancel",onTouchEnd);
|
1743
|
-
com.wiris.system.JsDOMUtils.addEventListener(js.Lib.document,"mousemove",function(e) {
|
1744
|
-
if(!touched) {
|
1745
|
-
if(com.wiris.system.JsDOMUtils.browser.touchable) {
|
1746
|
-
com.wiris.system.JsDOMUtils.browser.touchable = false;
|
1747
|
-
triggerEvents(com.wiris.system.JsDOMUtils.mouseDeviceListeners);
|
1748
|
-
}
|
1749
|
-
}
|
1750
|
-
});
|
1751
|
-
}
|
1752
|
-
com.wiris.system.JsDOMUtils.addEventListener = function(element,eventName,handler) {
|
1753
|
-
return com.wiris.system.JsDOMUtils.addEventListenerImpl(element,eventName,handler,false);
|
1754
|
-
}
|
1755
|
-
com.wiris.system.JsDOMUtils.addEventListenerImpl = function(element,eventName,handler,useCapture) {
|
1756
|
-
if(navigator.msPointerEnabled && com.wiris.system.JsDOMUtils.ieTouchEvents.exists(eventName)) {
|
1757
|
-
eventName = com.wiris.system.JsDOMUtils.ieTouchEvents.get(eventName);
|
1758
|
-
return com.wiris.system.JsDOMUtils.addEventListenerImpl(element,eventName,function(e) {
|
1759
|
-
if(e.pointerType == "touch") {
|
1760
|
-
if(eventName == "MSPointerUp") com.wiris.system.JsDOMUtils.internetExplorerPointers.remove("" + e.pointerId); else com.wiris.system.JsDOMUtils.internetExplorerPointers.set("" + e.pointerId,e);
|
1761
|
-
e.touches = new Array();
|
1762
|
-
var i = com.wiris.system.JsDOMUtils.internetExplorerPointers.iterator();
|
1763
|
-
while(i.hasNext()) e.touches.push(i.next());
|
1764
|
-
handler(e);
|
1765
|
-
}
|
1766
|
-
},useCapture);
|
1767
|
-
}
|
1768
|
-
if(eventName == "touchhold" && com.wiris.system.JsDOMUtils.browser.isTouchable()) {
|
1769
|
-
var timeout = null;
|
1770
|
-
var startX = -1;
|
1771
|
-
var startY = -1;
|
1772
|
-
var descriptor = com.wiris.system.JsDOMUtils.addEventListenerImpl(element,"touchstart",function(e) {
|
1773
|
-
touching = true;
|
1774
|
-
startX = e.touches[0].clientX;
|
1775
|
-
startY = e.touches[0].clientY;
|
1776
|
-
timeout = setTimeout(function() {
|
1777
|
-
timeout = null;
|
1778
|
-
handler(e);
|
1779
|
-
},500);
|
1780
|
-
},useCapture);
|
1781
|
-
descriptor.subDescriptors.push(com.wiris.system.JsDOMUtils.addEventListenerImpl(element,"touchmove",function(e) {
|
1782
|
-
if(timeout != null) {
|
1783
|
-
if(Math.abs(e.touches[0].clientX - startX) > com.wiris.system.JsDOMUtils.TOUCHHOLD_MOVE_MARGIN || Math.abs(e.touches[0].clientY - startY) > com.wiris.system.JsDOMUtils.TOUCHHOLD_MOVE_MARGIN) {
|
1784
|
-
clearTimeout(timeout);
|
1785
|
-
timeout = null;
|
1786
|
-
} else com.wiris.system.JsDOMUtils.cancelEvent(e);
|
1787
|
-
}
|
1788
|
-
},useCapture));
|
1789
|
-
descriptor.subDescriptors.push(com.wiris.system.JsDOMUtils.addEventListenerImpl(element,"touchend",function(e) {
|
1790
|
-
if(timeout != null) {
|
1791
|
-
clearTimeout(timeout);
|
1792
|
-
timeout = null;
|
1793
|
-
}
|
1794
|
-
},useCapture));
|
1795
|
-
return descriptor;
|
1796
|
-
}
|
1797
|
-
var descriptor = { };
|
1798
|
-
descriptor.element = element;
|
1799
|
-
descriptor.eventName = eventName;
|
1800
|
-
descriptor.handler = handler;
|
1801
|
-
descriptor.useCapture = useCapture;
|
1802
|
-
descriptor.subDescriptors = new Array();
|
1803
|
-
if(eventName == "dblclick") {
|
1804
|
-
var event = null;
|
1805
|
-
var touching = false;
|
1806
|
-
var firstClickTimestamp = null;
|
1807
|
-
descriptor.subDescriptors.push(com.wiris.system.JsDOMUtils.addEventListenerImpl(element,"touchstart",function(e) {
|
1808
|
-
touching = true;
|
1809
|
-
event = e;
|
1810
|
-
},useCapture));
|
1811
|
-
descriptor.subDescriptors.push(com.wiris.system.JsDOMUtils.addEventListenerImpl(element,"touchmove",function(e) {
|
1812
|
-
touching = false;
|
1813
|
-
},useCapture));
|
1814
|
-
descriptor.subDescriptors.push(com.wiris.system.JsDOMUtils.addEventListenerImpl(element,"touchend",function(e) {
|
1815
|
-
if(touching) {
|
1816
|
-
touching = false;
|
1817
|
-
var currentTimestamp = new Date().getTime();
|
1818
|
-
if(firstClickTimestamp == null || currentTimestamp > firstClickTimestamp + 500) firstClickTimestamp = currentTimestamp; else {
|
1819
|
-
event._wrs_dealAsTouch = true;
|
1820
|
-
handler(e);
|
1821
|
-
}
|
1822
|
-
}
|
1823
|
-
},useCapture));
|
1824
|
-
}
|
1825
|
-
if(element.attachEvent) element.attachEvent("on" + eventName,function() {
|
1826
|
-
handler(window.event);
|
1827
|
-
}); else element.addEventListener(eventName,handler,useCapture);
|
1828
|
-
return descriptor;
|
1829
|
-
}
|
1830
|
-
com.wiris.system.JsDOMUtils.removeEventListener = function(descriptor) {
|
1831
|
-
if(com.wiris.system.JsDOMUtils.browser.isIE() && descriptor.element.detachEvent) descriptor.element.detachEvent("on" + Std.string(descriptor.eventName),descriptor.handler); else descriptor.element.removeEventListener(descriptor.eventName,descriptor.handler,descriptor.useCapture);
|
1832
|
-
var i = $iterator(descriptor.subDescriptors)();
|
1833
|
-
while(i.hasNext()) com.wiris.system.JsDOMUtils.removeEventListener(i.next());
|
1834
|
-
}
|
1835
|
-
com.wiris.system.JsDOMUtils.cancelEvent = function(e) {
|
1836
|
-
if(e.preventDefault) e.preventDefault(); else e.returnValue = false;
|
1837
|
-
}
|
1838
|
-
com.wiris.system.JsDOMUtils.fireEvent = function(element,eventName) {
|
1839
|
-
var event;
|
1840
|
-
if(document.createEvent) {
|
1841
|
-
event = document.createEvent("HTMLEvents");
|
1842
|
-
event.initEvent(eventName,true,true);
|
1843
|
-
event.eventName = eventName;
|
1844
|
-
element.dispatchEvent(event);
|
1845
|
-
} else {
|
1846
|
-
event = document.createEventObject();
|
1847
|
-
event.eventType = eventName;
|
1848
|
-
event.eventName = eventName;
|
1849
|
-
element.fireEvent("on" + eventName,event);
|
1850
|
-
}
|
1851
|
-
}
|
1852
|
-
com.wiris.system.JsDOMUtils.getComputedStyle = function(element) {
|
1853
|
-
if(element.currentStyle) return element.currentStyle;
|
1854
|
-
return document.defaultView.getComputedStyle(element,null);
|
1855
|
-
}
|
1856
|
-
com.wiris.system.JsDOMUtils.getComputedStyleProperty = function(element,name) {
|
1857
|
-
var value;
|
1858
|
-
if(document.defaultView && document.defaultView.getComputedStyle) {
|
1859
|
-
var computedStyle = document.defaultView.getComputedStyle(element,null);
|
1860
|
-
value = computedStyle == null?null:computedStyle.getPropertyValue(name);
|
1861
|
-
} else if(com.wiris.system.JsDOMUtils.browser.isIE() && element.currentStyle) {
|
1862
|
-
var camelName = com.wiris.system.JsDOMUtils.camelize(name);
|
1863
|
-
value = element.currentStyle[camelName];
|
1864
|
-
if(value != null && value.length > 0 && camelName != "zoom") {
|
1865
|
-
var firstChar = HxOverrides.cca(value,0);
|
1866
|
-
if(firstChar >= 48 && firstChar <= 57 && !StringTools.endsWith(value,"px")) {
|
1867
|
-
var originalLeft = element.style.left;
|
1868
|
-
var originalRuntimeLeft = element.runtimeStyle?element.runtimeStyle.left:null;
|
1869
|
-
if(originalRuntimeLeft != null) element.runtimeStyle.left = element.currentStyle.left;
|
1870
|
-
element.style.left = camelName == "fontSize"?"1em":value;
|
1871
|
-
value = element.style.pixelLeft + "px";
|
1872
|
-
element.style.left = originalLeft;
|
1873
|
-
if(originalRuntimeLeft != null) element.runtimeStyle.left = originalRuntimeLeft;
|
1874
|
-
}
|
1875
|
-
}
|
1876
|
-
} else value = element.style[com.wiris.system.JsDOMUtils.camelize(name)];
|
1877
|
-
return value;
|
1878
|
-
}
|
1879
|
-
com.wiris.system.JsDOMUtils.getPixelRatio = function() {
|
1880
|
-
var context = document.createElement("canvas").getContext("2d");
|
1881
|
-
var dpr = window.devicePixelRatio || 1;
|
1882
|
-
var bsr = context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1;
|
1883
|
-
return dpr / bsr;
|
1884
|
-
}
|
1885
|
-
com.wiris.system.JsDOMUtils.camelize = function(str) {
|
1886
|
-
var start = 0;
|
1887
|
-
var pos;
|
1888
|
-
var sb = new StringBuf();
|
1889
|
-
while((pos = str.indexOf("-",start)) != -1) {
|
1890
|
-
sb.b += Std.string(HxOverrides.substr(str,start,pos - start));
|
1891
|
-
sb.b += Std.string(str.charAt(pos + 1).toUpperCase());
|
1892
|
-
start = pos + 2;
|
1893
|
-
}
|
1894
|
-
sb.b += Std.string(HxOverrides.substr(str,start,null));
|
1895
|
-
return sb.b;
|
1896
|
-
}
|
1897
|
-
com.wiris.system.JsDOMUtils.getElementsByClassName = function(parent,className,recursive) {
|
1898
|
-
var returnValue = new Array();
|
1899
|
-
var _g1 = 0, _g = parent.childNodes.length;
|
1900
|
-
while(_g1 < _g) {
|
1901
|
-
var i = _g1++;
|
1902
|
-
if(com.wiris.system.JsDOMUtils.hasClass(parent.childNodes[i],className)) returnValue.push(parent.childNodes[i]);
|
1903
|
-
if(recursive) returnValue = returnValue.concat(com.wiris.system.JsDOMUtils.getElementsByClassName(parent.childNodes[i],className,true));
|
1904
|
-
}
|
1905
|
-
return returnValue;
|
1906
|
-
}
|
1907
|
-
com.wiris.system.JsDOMUtils.getEventTarget = function(event) {
|
1908
|
-
if(event.srcElement) return event.srcElement;
|
1909
|
-
return event.target;
|
1910
|
-
}
|
1911
|
-
com.wiris.system.JsDOMUtils.getLeft = function(element) {
|
1912
|
-
return element.getBoundingClientRect().left;
|
1913
|
-
}
|
1914
|
-
com.wiris.system.JsDOMUtils.getRelativeLeft = function(element,parent) {
|
1915
|
-
if(parent == null) return com.wiris.system.JsDOMUtils.getLeft(element);
|
1916
|
-
return com.wiris.system.JsDOMUtils.getLeft(element) - com.wiris.system.JsDOMUtils.getLeft(parent);
|
1917
|
-
}
|
1918
|
-
com.wiris.system.JsDOMUtils.getTop = function(element) {
|
1919
|
-
return element.getBoundingClientRect().top;
|
1920
|
-
}
|
1921
|
-
com.wiris.system.JsDOMUtils.getRelativeTop = function(element,parent) {
|
1922
|
-
if(parent == null) return com.wiris.system.JsDOMUtils.getTop(element);
|
1923
|
-
return com.wiris.system.JsDOMUtils.getTop(element) - com.wiris.system.JsDOMUtils.getTop(parent);
|
1924
|
-
}
|
1925
|
-
com.wiris.system.JsDOMUtils.getWindowScroll = function() {
|
1926
|
-
var scroll = new Array();
|
1927
|
-
if(js.Lib.window.pageYOffset == undefined) {
|
1928
|
-
scroll[0] = js.Lib.document.documentElement.scrollLeft;
|
1929
|
-
scroll[1] = js.Lib.document.documentElement.scrollTop;
|
1930
|
-
} else {
|
1931
|
-
scroll[0] = js.Lib.window.pageXOffset;
|
1932
|
-
scroll[1] = js.Lib.window.pageYOffset;
|
1933
|
-
}
|
1934
|
-
return scroll;
|
1935
|
-
}
|
1936
|
-
com.wiris.system.JsDOMUtils.setWindowScroll = function(scroll) {
|
1937
|
-
var x = scroll[0] | 0;
|
1938
|
-
var y = scroll[1] | 0;
|
1939
|
-
js.Lib.window.scrollTo(x,y);
|
1940
|
-
}
|
1941
|
-
com.wiris.system.JsDOMUtils.isLeftBidiAware = function(keyCode,rtl) {
|
1942
|
-
return keyCode == 37 && !rtl || keyCode == 39 && rtl;
|
1943
|
-
}
|
1944
|
-
com.wiris.system.JsDOMUtils.getFirstDisplayedChild = function(parent) {
|
1945
|
-
var child = parent != null?parent.firstChild:parent;
|
1946
|
-
while(child != null) {
|
1947
|
-
if(com.wiris.system.JsDOMUtils.getComputedStyleProperty(child,"display") != "none") return child;
|
1948
|
-
child = child.nextSibling;
|
1949
|
-
}
|
1950
|
-
return null;
|
1951
|
-
}
|
1952
|
-
com.wiris.system.JsDOMUtils.isDescendant = function(parent,possibleDescendant) {
|
1953
|
-
if(parent == null || possibleDescendant == null) return false;
|
1954
|
-
while(possibleDescendant.parentNode != null) {
|
1955
|
-
if(possibleDescendant.parentNode == parent) return true;
|
1956
|
-
possibleDescendant = possibleDescendant.parentNode;
|
1957
|
-
}
|
1958
|
-
return false;
|
1959
|
-
}
|
1960
|
-
com.wiris.system.JsDOMUtils.parseDimension = function(x) {
|
1961
|
-
return x < 0 || x == null?0:x;
|
1962
|
-
}
|
1963
|
-
com.wiris.system.JsDOMUtils.removeChildren = function(element) {
|
1964
|
-
while(element.firstChild != null) element.removeChild(element.firstChild);
|
1965
|
-
}
|
1966
|
-
com.wiris.system.JsDOMUtils.hasClass = function(element,className) {
|
1967
|
-
if(element == null || element.className == null || !(element.className.split)) return false;
|
1968
|
-
var classes = element.className.split(" ");
|
1969
|
-
var i = HxOverrides.iter(classes);
|
1970
|
-
while(i.hasNext()) if(i.next() == className) return true;
|
1971
|
-
return false;
|
1972
|
-
}
|
1973
|
-
com.wiris.system.JsDOMUtils.addClass = function(element,className) {
|
1974
|
-
if(element == null) return;
|
1975
|
-
if(element.className == "") element.className = className; else if(!com.wiris.system.JsDOMUtils.hasClass(element,className)) element.className += " " + className;
|
1976
|
-
}
|
1977
|
-
com.wiris.system.JsDOMUtils.removeClass = function(element,className) {
|
1978
|
-
if(element == null || element.className == null || !(element.className.split)) return;
|
1979
|
-
var classes = element.className.split(" ");
|
1980
|
-
HxOverrides.remove(classes,className);
|
1981
|
-
element.className = classes.join(" ");
|
1982
|
-
}
|
1983
|
-
com.wiris.system.JsDOMUtils.toggleClass = function(element,className) {
|
1984
|
-
if(com.wiris.system.JsDOMUtils.hasClass(element,className)) com.wiris.system.JsDOMUtils.removeClass(element,className); else com.wiris.system.JsDOMUtils.addClass(element,className);
|
1985
|
-
}
|
1986
|
-
com.wiris.system.JsDOMUtils.activateClass = function(element,className) {
|
1987
|
-
if(!com.wiris.system.JsDOMUtils.hasClass(element,className)) com.wiris.system.JsDOMUtils.addClass(element,className);
|
1988
|
-
}
|
1989
|
-
com.wiris.system.JsDOMUtils.setCaretPosition = function(element,position,end) {
|
1990
|
-
if(element.setSelectionRange) element.setSelectionRange(position,end); else if(element.createTextRange) {
|
1991
|
-
var range = element.createTextRange();
|
1992
|
-
range.collapse(true);
|
1993
|
-
range.moveStart("character",position);
|
1994
|
-
range.moveEnd("character",end);
|
1995
|
-
range.select();
|
1996
|
-
}
|
1997
|
-
}
|
1998
|
-
com.wiris.system.JsDOMUtils.getSelectionBounds = function(element) {
|
1999
|
-
var bounds = new Array();
|
2000
|
-
if(element.selectionStart != null) {
|
2001
|
-
bounds[0] = element.selectionStart;
|
2002
|
-
bounds[1] = element.selectionEnd;
|
2003
|
-
return bounds;
|
2004
|
-
}
|
2005
|
-
var range = document.selection.createRange();
|
2006
|
-
if(range && range.parentElement() == element) {
|
2007
|
-
var length = element.value.length;
|
2008
|
-
var normalizedValue = element.value.split("\r\n").join("\n");
|
2009
|
-
var textInputRange = element.createTextRange();
|
2010
|
-
textInputRange.moveToBookmark(range.getBookmark());
|
2011
|
-
var endRange = element.createTextRange();
|
2012
|
-
endRange.collapse(false);
|
2013
|
-
if(textInputRange.compareEndPoints("StartToEnd",endRange) > -1) bounds[0] = bounds[1] = length; else {
|
2014
|
-
bounds[0] = -textInputRange.moveStart("character",-length);
|
2015
|
-
bounds[0] += normalizedValue.slice(0,bounds[0]).split("\n").length - 1;
|
2016
|
-
if(textInputRange.compareEndPoints("EndToEnd",endRange) > -1) bounds[1] = length; else {
|
2017
|
-
bounds[1] = -textInputRange.moveEnd("character",-length);
|
2018
|
-
bounds[1] += normalizedValue.slice(0,bounds[1]).split("\n").length - 1;
|
2019
|
-
}
|
2020
|
-
}
|
2021
|
-
return bounds;
|
2022
|
-
}
|
2023
|
-
return null;
|
2024
|
-
}
|
2025
|
-
com.wiris.system.JsDOMUtils.getMousePosition = function(target,e) {
|
2026
|
-
if(e._wrs_dealAsTouch) return com.wiris.system.JsDOMUtils.getTouchPosition(target,e.touches[0]);
|
2027
|
-
var elementScroll = new Array();
|
2028
|
-
elementScroll[0] = target.scrollLeft;
|
2029
|
-
elementScroll[1] = target.scrollTop;
|
2030
|
-
return com.wiris.system.JsDOMUtils.getMousePositionImpl(target,e,elementScroll,0);
|
2031
|
-
}
|
2032
|
-
com.wiris.system.JsDOMUtils.getMousePositionImpl = function(target,e,elementScroll,border) {
|
2033
|
-
var position = new Array();
|
2034
|
-
position[0] = e.clientX - com.wiris.system.JsDOMUtils.getLeft(target) - border + elementScroll[0];
|
2035
|
-
position[1] = e.clientY - com.wiris.system.JsDOMUtils.getTop(target) - border + elementScroll[1];
|
2036
|
-
return position;
|
2037
|
-
}
|
2038
|
-
com.wiris.system.JsDOMUtils.inFixedParent = function(element) {
|
2039
|
-
while(element != null) {
|
2040
|
-
if(com.wiris.system.JsDOMUtils.getComputedStyleProperty(element,"position") == "fixed") return true;
|
2041
|
-
element = element.offsetParent;
|
2042
|
-
}
|
2043
|
-
return false;
|
2044
|
-
}
|
2045
|
-
com.wiris.system.JsDOMUtils.getTouchPosition = function(target,touch) {
|
2046
|
-
var elementScroll = new Array();
|
2047
|
-
elementScroll[0] = target.scrollLeft;
|
2048
|
-
elementScroll[1] = target.scrollTop;
|
2049
|
-
return com.wiris.system.JsDOMUtils.getTouchPositionImpl(target,touch,elementScroll,0);
|
2050
|
-
}
|
2051
|
-
com.wiris.system.JsDOMUtils.getTouchPositionImpl = function(target,touch,elementScroll,border) {
|
2052
|
-
var position = new Array();
|
2053
|
-
position[0] = touch.clientX - com.wiris.system.JsDOMUtils.getLeft(target) - border + elementScroll[0];
|
2054
|
-
position[1] = touch.clientY - com.wiris.system.JsDOMUtils.getTop(target) - border + elementScroll[1];
|
2055
|
-
return position;
|
2056
|
-
}
|
2057
|
-
com.wiris.system.JsDOMUtils.getStandardButton = function(e) {
|
2058
|
-
if(e.touches) return 1;
|
2059
|
-
if("button" in e) return e.button + 1;
|
2060
|
-
return 0;
|
2061
|
-
}
|
2062
|
-
com.wiris.system.JsDOMUtils.vibrate = function(milliseconds) {
|
2063
|
-
if(navigator.vibrate) navigator.vibrate(milliseconds);
|
2064
|
-
}
|
2065
|
-
com.wiris.system.JsDOMUtils.onTouchDeviceDetected = function(callbackFunction) {
|
2066
|
-
com.wiris.system.JsDOMUtils.init();
|
2067
|
-
com.wiris.system.JsDOMUtils.touchDeviceListeners.push(callbackFunction);
|
2068
|
-
}
|
2069
|
-
com.wiris.system.JsDOMUtils.onMouseDeviceDetected = function(callbackFunction) {
|
2070
|
-
com.wiris.system.JsDOMUtils.init();
|
2071
|
-
com.wiris.system.JsDOMUtils.mouseDeviceListeners.push(callbackFunction);
|
2072
|
-
}
|
2073
|
-
com.wiris.system.JsDOMUtils.findScriptElement = function(reg) {
|
2074
|
-
var scripts = js.Lib.document.getElementsByTagName("script");
|
2075
|
-
var n = scripts.length;
|
2076
|
-
var i = 0;
|
2077
|
-
while(i < n) {
|
2078
|
-
var src = scripts[i].getAttribute("src");
|
2079
|
-
if(reg.match(src)) return scripts[i];
|
2080
|
-
++i;
|
2081
|
-
}
|
2082
|
-
return null;
|
2083
|
-
}
|
2084
|
-
com.wiris.system.JsDOMUtils.rewriteDefaultPaths = function(contextPath) {
|
2085
|
-
if(window.com.wiris.js.defaultServicePath != null && StringTools.startsWith(window.com.wiris.js.defaultServicePath,"http://")) {
|
2086
|
-
var protocol = js.Lib.window.location.protocol;
|
2087
|
-
var defaultServicePathWithoutProtocol = window.com.wiris.js.defaultServicePath.substr("http:".length);
|
2088
|
-
var reg = new EReg("(http:|https:)" + defaultServicePathWithoutProtocol + "/" + contextPath,"");
|
2089
|
-
if(com.wiris.system.JsDOMUtils.findScriptElement(reg) != null) protocol = reg.matched(1);
|
2090
|
-
if(protocol == "https:") {
|
2091
|
-
window.com.wiris.js.defaultServicePath = "https:" + defaultServicePathWithoutProtocol;
|
2092
|
-
if(window.com.wiris.js.defaultBasePath != null) window.com.wiris.js.defaultBasePath = "https:" + window.com.wiris.js.defaultBasePath.substr("http:".length);
|
2093
|
-
}
|
2094
|
-
}
|
2095
|
-
}
|
2096
|
-
com.wiris.system.JsDOMUtils.createCSSRules = function(selector,rules) {
|
2097
|
-
var style = js.Lib.document.createElement("style");
|
2098
|
-
style.type = "text/css";
|
2099
|
-
js.Lib.document.getElementsByTagName("head")[0].appendChild(style);
|
2100
|
-
if(style.sheet != null && style.sheet.insertRule != null) style.sheet.insertRule(selector + "{" + rules + "}",0); else if(style.styleSheet != null) style.styleSheet.addRule(selector,rules); else if(style.sheet != null) style.sheet.addRule(selector,rules);
|
2101
|
-
}
|
2102
|
-
com.wiris.system.JsDOMUtils.execCommand = function(command) {
|
2103
|
-
return document.execCommand(command);
|
2104
|
-
}
|
2105
|
-
com.wiris.system.JsDOMUtils.findServicePath = function(scriptName) {
|
2106
|
-
var scriptTags = js.Lib.document.getElementsByTagName("script");
|
2107
|
-
var servicePath = null;
|
2108
|
-
var _g1 = 0, _g = scriptTags.length;
|
2109
|
-
while(_g1 < _g) {
|
2110
|
-
var i = _g1++;
|
2111
|
-
var src = scriptTags[i].src;
|
2112
|
-
var j = src.lastIndexOf("/" + scriptName);
|
2113
|
-
if(j >= 0) servicePath = HxOverrides.substr(src,0,j); else if(src == scriptName) servicePath = "";
|
2114
|
-
}
|
2115
|
-
if(servicePath != null && StringTools.startsWith(servicePath,"http://") && js.Lib.window.location.protocol == "https:") servicePath = "https://" + HxOverrides.substr(servicePath,"http://".length,null);
|
2116
|
-
return servicePath;
|
2117
|
-
}
|
2118
|
-
com.wiris.system.JsDOMUtils.loadTextFile = function(elem,func) {
|
2119
|
-
var w = js.Lib.window;
|
2120
|
-
if(w.File && w.FileReader && w.FileList && w.Blob) {
|
2121
|
-
var d = elem.ownerDocument;
|
2122
|
-
var fileInput = d.createElement("input");
|
2123
|
-
fileInput.setAttribute("name","data");
|
2124
|
-
fileInput.setAttribute("type","file");
|
2125
|
-
elem.appendChild(fileInput);
|
2126
|
-
com.wiris.system.JsDOMUtils.init();
|
2127
|
-
com.wiris.system.JsDOMUtils.addEventListener(fileInput,"change",function(e) {
|
2128
|
-
if(fileInput.files.length) {
|
2129
|
-
var file = fileInput.files[0];
|
2130
|
-
var reader = new FileReader();
|
2131
|
-
reader.onload = function(le) {
|
2132
|
-
func(le.target.result);
|
2133
|
-
};
|
2134
|
-
reader.readAsText(file);
|
2135
|
-
}
|
2136
|
-
elem.removeChild(fileInput);
|
2137
|
-
});
|
2138
|
-
fileInput.click();
|
2139
|
-
} else throw "Browser incompatible with JavaScript File API.";
|
2140
|
-
}
|
2141
|
-
com.wiris.system.JsDOMUtils.saveTextFile = function(elem,filename,filetype,contents) {
|
2142
|
-
var d = elem.ownerDocument;
|
2143
|
-
var w = js.Lib.window;
|
2144
|
-
if(w.Blob) {
|
2145
|
-
var blob = new Blob([contents], {'type': filetype});
|
2146
|
-
var a = d.createElement("a");
|
2147
|
-
if('download' in a && w.URL) {
|
2148
|
-
a.href = w.URL.createObjectURL(blob);
|
2149
|
-
a.download = filename;
|
2150
|
-
elem.appendChild(a);
|
2151
|
-
a.click();
|
2152
|
-
elem.removeChild(a);
|
2153
|
-
return;
|
2154
|
-
}
|
2155
|
-
}
|
2156
|
-
throw "Browser incompatible with HTML object download anchors.";
|
2157
|
-
}
|
2158
|
-
com.wiris.system.JsDOMUtils.trapFocus = function(disabledFocusContainer,focusableContainer) {
|
2159
|
-
var lastScroll = com.wiris.system.JsDOMUtils.getWindowScroll();
|
2160
|
-
var previousFocused = focusableContainer;
|
2161
|
-
var descriptor = com.wiris.system.JsDOMUtils.addEventListener(js.Lib.document,"focusin",function(e) {
|
2162
|
-
previousFocused = com.wiris.system.JsDOMUtils.getEventTarget(e);
|
2163
|
-
});
|
2164
|
-
descriptor.subDescriptors.push(com.wiris.system.JsDOMUtils.addEventListener(disabledFocusContainer,"focusin",function(e) {
|
2165
|
-
var focusedElement = com.wiris.system.JsDOMUtils.getEventTarget(e);
|
2166
|
-
if(!com.wiris.system.JsDOMUtils.isDescendant(focusableContainer,focusedElement)) {
|
2167
|
-
com.wiris.system.JsDOMUtils.setWindowScroll(lastScroll);
|
2168
|
-
var focusableElements = com.wiris.system.JsDOMUtils.getFocusableElements(js.Lib.document.body);
|
2169
|
-
var focusedElementIndex = 0;
|
2170
|
-
while(focusedElementIndex < focusableElements.length) {
|
2171
|
-
if(focusableElements[focusedElementIndex] == focusedElement) break;
|
2172
|
-
++focusedElementIndex;
|
2173
|
-
}
|
2174
|
-
var direction = previousFocused == focusedElement || com.wiris.system.JsDOMUtils.elementIsBefore(previousFocused,focusedElement)?1:-1;
|
2175
|
-
var alternative = com.wiris.system.JsDOMUtils.findFocusableAlternative(focusableElements,disabledFocusContainer,focusableContainer,focusedElementIndex,direction);
|
2176
|
-
if(alternative != null) alternative.focus();
|
2177
|
-
e.stopPropagation();
|
2178
|
-
} else lastScroll = com.wiris.system.JsDOMUtils.getWindowScroll();
|
2179
|
-
}));
|
2180
|
-
var focusedElement = js.Lib.document.activeElement;
|
2181
|
-
if(!com.wiris.system.JsDOMUtils.isDescendant(focusableContainer,focusedElement)) {
|
2182
|
-
com.wiris.system.JsDOMUtils.setWindowScroll(lastScroll);
|
2183
|
-
var focusableElements = com.wiris.system.JsDOMUtils.getFocusableElements(js.Lib.document.body);
|
2184
|
-
var focusedElementIndex = 0;
|
2185
|
-
while(focusedElementIndex < focusableElements.length) {
|
2186
|
-
if(focusableElements[focusedElementIndex] == focusedElement) break;
|
2187
|
-
++focusedElementIndex;
|
2188
|
-
}
|
2189
|
-
var alternative = com.wiris.system.JsDOMUtils.findFocusableAlternative(focusableElements,disabledFocusContainer,focusableContainer,focusedElementIndex,1);
|
2190
|
-
if(alternative != null) alternative.focus();
|
2191
|
-
}
|
2192
|
-
return descriptor;
|
2193
|
-
}
|
2194
|
-
com.wiris.system.JsDOMUtils.findFocusableAlternative = function(focusableElements,disabledFocusContainer,focusableContainer,focusedElementIndex,direction,stopOnIndex) {
|
2195
|
-
if(stopOnIndex == null) stopOnIndex = -100;
|
2196
|
-
var originalFocusedElementIndex = focusedElementIndex;
|
2197
|
-
focusedElementIndex += direction;
|
2198
|
-
while(focusedElementIndex >= 0 && focusedElementIndex < focusableElements.length && com.wiris.system.JsDOMUtils.isDescendant(disabledFocusContainer,focusableElements[focusedElementIndex]) && !com.wiris.system.JsDOMUtils.isDescendant(focusableContainer,focusableElements[focusedElementIndex])) {
|
2199
|
-
focusedElementIndex += direction;
|
2200
|
-
if(focusedElementIndex == stopOnIndex) return null;
|
2201
|
-
}
|
2202
|
-
if(focusedElementIndex < 0) return com.wiris.system.JsDOMUtils.findFocusableAlternative(focusableElements,disabledFocusContainer,focusableContainer,focusableElements.length - 1,-1,originalFocusedElementIndex);
|
2203
|
-
if(focusedElementIndex >= focusableElements.length) return com.wiris.system.JsDOMUtils.findFocusableAlternative(focusableElements,disabledFocusContainer,focusableContainer,0,1,originalFocusedElementIndex);
|
2204
|
-
return focusableElements[focusedElementIndex];
|
2205
|
-
}
|
2206
|
-
com.wiris.system.JsDOMUtils.untrapFocus = function(descriptor) {
|
2207
|
-
com.wiris.system.JsDOMUtils.removeEventListener(descriptor);
|
2208
|
-
}
|
2209
|
-
com.wiris.system.JsDOMUtils.getFocusableElements = function(container) {
|
2210
|
-
var elements = container.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])");
|
2211
|
-
var focusableElements = new Array();
|
2212
|
-
var i = 0;
|
2213
|
-
while(i < elements.length) {
|
2214
|
-
if(com.wiris.system.JsDOMUtils.getComputedStyleProperty(elements[i],"display") != "none" && com.wiris.system.JsDOMUtils.getComputedStyleProperty(elements[i],"visibility") != "hidden") focusableElements.push(elements[i]);
|
2215
|
-
++i;
|
2216
|
-
}
|
2217
|
-
return focusableElements;
|
2218
|
-
}
|
2219
|
-
com.wiris.system.JsDOMUtils.elementIsBefore = function(elementA,elementB) {
|
2220
|
-
if(elementA == elementB) throw "Trying to compare the same element.";
|
2221
|
-
var pathA = com.wiris.system.JsDOMUtils.getElementPath(elementA);
|
2222
|
-
var pathB = com.wiris.system.JsDOMUtils.getElementPath(elementB);
|
2223
|
-
var i = 1;
|
2224
|
-
var n = Math.min(pathA.length,pathB.length) | 0;
|
2225
|
-
while(i < n) {
|
2226
|
-
if(pathA[i] != pathB[i]) return com.wiris.system.JsDOMUtils.getElementChildIndex(pathA[i]) < com.wiris.system.JsDOMUtils.getElementChildIndex(pathB[i]);
|
2227
|
-
++i;
|
2228
|
-
}
|
2229
|
-
return false;
|
2230
|
-
}
|
2231
|
-
com.wiris.system.JsDOMUtils.getElementPath = function(element) {
|
2232
|
-
var path = new Array();
|
2233
|
-
while(element != null) {
|
2234
|
-
path.splice(0,0,element);
|
2235
|
-
element = element.parentNode;
|
2236
|
-
}
|
2237
|
-
return path;
|
2238
|
-
}
|
2239
|
-
com.wiris.system.JsDOMUtils.getElementChildIndex = function(element) {
|
2240
|
-
if(element.parentNode == null) return -1;
|
2241
|
-
var i = 0;
|
2242
|
-
while(i < element.parentNode.childNodes.length) {
|
2243
|
-
if(element.parentNode.childNodes[i] == element) return i;
|
2244
|
-
++i;
|
2245
|
-
}
|
2246
|
-
return -1;
|
2247
|
-
}
|
2248
|
-
var haxe = haxe || {}
|
2249
|
-
haxe.Http = $hxClasses["haxe.Http"] = function(url) {
|
2250
|
-
this.url = url;
|
2251
|
-
this.headers = new Hash();
|
2252
|
-
this.params = new Hash();
|
2253
|
-
this.async = true;
|
2254
|
-
};
|
2255
|
-
haxe.Http.__name__ = ["haxe","Http"];
|
2256
|
-
haxe.Http.requestUrl = function(url) {
|
2257
|
-
var h = new haxe.Http(url);
|
2258
|
-
h.async = false;
|
2259
|
-
var r = null;
|
2260
|
-
h.onData = function(d) {
|
2261
|
-
r = d;
|
2262
|
-
};
|
2263
|
-
h.onError = function(e) {
|
2264
|
-
throw e;
|
2265
|
-
};
|
2266
|
-
h.request(false);
|
2267
|
-
return r;
|
2268
|
-
}
|
2269
|
-
haxe.Http.prototype = {
|
2270
|
-
onStatus: function(status) {
|
2271
|
-
}
|
2272
|
-
,onError: function(msg) {
|
2273
|
-
}
|
2274
|
-
,onData: function(data) {
|
2275
|
-
}
|
2276
|
-
,request: function(post) {
|
2277
|
-
var me = this;
|
2278
|
-
var r = new js.XMLHttpRequest();
|
2279
|
-
var onreadystatechange = function() {
|
2280
|
-
if(r.readyState != 4) return;
|
2281
|
-
var s = (function($this) {
|
2282
|
-
var $r;
|
2283
|
-
try {
|
2284
|
-
$r = r.status;
|
2285
|
-
} catch( e ) {
|
2286
|
-
$r = null;
|
2287
|
-
}
|
2288
|
-
return $r;
|
2289
|
-
}(this));
|
2290
|
-
if(s == undefined) s = null;
|
2291
|
-
if(s != null) me.onStatus(s);
|
2292
|
-
if(s != null && s >= 200 && s < 400) me.onData(r.responseText); else switch(s) {
|
2293
|
-
case null: case undefined:
|
2294
|
-
me.onError("Failed to connect or resolve host");
|
2295
|
-
break;
|
2296
|
-
case 12029:
|
2297
|
-
me.onError("Failed to connect to host");
|
2298
|
-
break;
|
2299
|
-
case 12007:
|
2300
|
-
me.onError("Unknown host");
|
2301
|
-
break;
|
2302
|
-
default:
|
2303
|
-
me.onError("Http Error #" + r.status);
|
2304
|
-
}
|
2305
|
-
};
|
2306
|
-
if(this.async) r.onreadystatechange = onreadystatechange;
|
2307
|
-
var uri = this.postData;
|
2308
|
-
if(uri != null) post = true; else {
|
2309
|
-
var $it0 = this.params.keys();
|
2310
|
-
while( $it0.hasNext() ) {
|
2311
|
-
var p = $it0.next();
|
2312
|
-
if(uri == null) uri = ""; else uri += "&";
|
2313
|
-
uri += StringTools.urlEncode(p) + "=" + StringTools.urlEncode(this.params.get(p));
|
2314
|
-
}
|
2315
|
-
}
|
2316
|
-
try {
|
2317
|
-
if(post) r.open("POST",this.url,this.async); else if(uri != null) {
|
2318
|
-
var question = this.url.split("?").length <= 1;
|
2319
|
-
r.open("GET",this.url + (question?"?":"&") + uri,this.async);
|
2320
|
-
uri = null;
|
2321
|
-
} else r.open("GET",this.url,this.async);
|
2322
|
-
} catch( e ) {
|
2323
|
-
this.onError(e.toString());
|
2324
|
-
return;
|
2325
|
-
}
|
2326
|
-
if(this.headers.get("Content-Type") == null && post && this.postData == null) r.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
|
2327
|
-
var $it1 = this.headers.keys();
|
2328
|
-
while( $it1.hasNext() ) {
|
2329
|
-
var h = $it1.next();
|
2330
|
-
r.setRequestHeader(h,this.headers.get(h));
|
2331
|
-
}
|
2332
|
-
r.send(uri);
|
2333
|
-
if(!this.async) onreadystatechange();
|
2334
|
-
}
|
2335
|
-
,setPostData: function(data) {
|
2336
|
-
this.postData = data;
|
2337
|
-
}
|
2338
|
-
,setParameter: function(param,value) {
|
2339
|
-
this.params.set(param,value);
|
2340
|
-
}
|
2341
|
-
,setHeader: function(header,value) {
|
2342
|
-
this.headers.set(header,value);
|
2343
|
-
}
|
2344
|
-
,params: null
|
2345
|
-
,headers: null
|
2346
|
-
,postData: null
|
2347
|
-
,async: null
|
2348
|
-
,url: null
|
2349
|
-
,__class__: haxe.Http
|
2350
|
-
}
|
2351
|
-
haxe.Json = $hxClasses["haxe.Json"] = function() {
|
2352
|
-
};
|
2353
|
-
haxe.Json.__name__ = ["haxe","Json"];
|
2354
|
-
haxe.Json.parse = function(text) {
|
2355
|
-
return new haxe.Json().doParse(text);
|
2356
|
-
}
|
2357
|
-
haxe.Json.stringify = function(value) {
|
2358
|
-
return new haxe.Json().toString(value);
|
2359
|
-
}
|
2360
|
-
haxe.Json.prototype = {
|
2361
|
-
parseString: function() {
|
2362
|
-
var start = this.pos;
|
2363
|
-
var buf = new StringBuf();
|
2364
|
-
while(true) {
|
2365
|
-
var c = this.str.charCodeAt(this.pos++);
|
2366
|
-
if(c == 34) break;
|
2367
|
-
if(c == 92) {
|
2368
|
-
buf.b += HxOverrides.substr(this.str,start,this.pos - start - 1);
|
2369
|
-
c = this.str.charCodeAt(this.pos++);
|
2370
|
-
switch(c) {
|
2371
|
-
case 114:
|
2372
|
-
buf.b += String.fromCharCode(13);
|
2373
|
-
break;
|
2374
|
-
case 110:
|
2375
|
-
buf.b += String.fromCharCode(10);
|
2376
|
-
break;
|
2377
|
-
case 116:
|
2378
|
-
buf.b += String.fromCharCode(9);
|
2379
|
-
break;
|
2380
|
-
case 98:
|
2381
|
-
buf.b += String.fromCharCode(8);
|
2382
|
-
break;
|
2383
|
-
case 102:
|
2384
|
-
buf.b += String.fromCharCode(12);
|
2385
|
-
break;
|
2386
|
-
case 47:case 92:case 34:
|
2387
|
-
buf.b += String.fromCharCode(c);
|
2388
|
-
break;
|
2389
|
-
case 117:
|
2390
|
-
var uc = Std.parseInt("0x" + HxOverrides.substr(this.str,this.pos,4));
|
2391
|
-
this.pos += 4;
|
2392
|
-
buf.b += String.fromCharCode(uc);
|
2393
|
-
break;
|
2394
|
-
default:
|
2395
|
-
throw "Invalid escape sequence \\" + String.fromCharCode(c) + " at position " + (this.pos - 1);
|
2396
|
-
}
|
2397
|
-
start = this.pos;
|
2398
|
-
} else if(c != c) throw "Unclosed string";
|
2399
|
-
}
|
2400
|
-
buf.b += HxOverrides.substr(this.str,start,this.pos - start - 1);
|
2401
|
-
return buf.b;
|
2402
|
-
}
|
2403
|
-
,parseRec: function() {
|
2404
|
-
while(true) {
|
2405
|
-
var c = this.str.charCodeAt(this.pos++);
|
2406
|
-
switch(c) {
|
2407
|
-
case 32:case 13:case 10:case 9:
|
2408
|
-
break;
|
2409
|
-
case 123:
|
2410
|
-
var obj = { }, field = null, comma = null;
|
2411
|
-
while(true) {
|
2412
|
-
var c1 = this.str.charCodeAt(this.pos++);
|
2413
|
-
switch(c1) {
|
2414
|
-
case 32:case 13:case 10:case 9:
|
2415
|
-
break;
|
2416
|
-
case 125:
|
2417
|
-
if(field != null || comma == false) this.invalidChar();
|
2418
|
-
return obj;
|
2419
|
-
case 58:
|
2420
|
-
if(field == null) this.invalidChar();
|
2421
|
-
obj[field] = this.parseRec();
|
2422
|
-
field = null;
|
2423
|
-
comma = true;
|
2424
|
-
break;
|
2425
|
-
case 44:
|
2426
|
-
if(comma) comma = false; else this.invalidChar();
|
2427
|
-
break;
|
2428
|
-
case 34:
|
2429
|
-
if(comma) this.invalidChar();
|
2430
|
-
field = this.parseString();
|
2431
|
-
break;
|
2432
|
-
default:
|
2433
|
-
this.invalidChar();
|
2434
|
-
}
|
2435
|
-
}
|
2436
|
-
break;
|
2437
|
-
case 91:
|
2438
|
-
var arr = [], comma = null;
|
2439
|
-
while(true) {
|
2440
|
-
var c1 = this.str.charCodeAt(this.pos++);
|
2441
|
-
switch(c1) {
|
2442
|
-
case 32:case 13:case 10:case 9:
|
2443
|
-
break;
|
2444
|
-
case 93:
|
2445
|
-
if(comma == false) this.invalidChar();
|
2446
|
-
return arr;
|
2447
|
-
case 44:
|
2448
|
-
if(comma) comma = false; else this.invalidChar();
|
2449
|
-
break;
|
2450
|
-
default:
|
2451
|
-
if(comma) this.invalidChar();
|
2452
|
-
this.pos--;
|
2453
|
-
arr.push(this.parseRec());
|
2454
|
-
comma = true;
|
2455
|
-
}
|
2456
|
-
}
|
2457
|
-
break;
|
2458
|
-
case 116:
|
2459
|
-
var save = this.pos;
|
2460
|
-
if(this.str.charCodeAt(this.pos++) != 114 || this.str.charCodeAt(this.pos++) != 117 || this.str.charCodeAt(this.pos++) != 101) {
|
2461
|
-
this.pos = save;
|
2462
|
-
this.invalidChar();
|
2463
|
-
}
|
2464
|
-
return true;
|
2465
|
-
case 102:
|
2466
|
-
var save = this.pos;
|
2467
|
-
if(this.str.charCodeAt(this.pos++) != 97 || this.str.charCodeAt(this.pos++) != 108 || this.str.charCodeAt(this.pos++) != 115 || this.str.charCodeAt(this.pos++) != 101) {
|
2468
|
-
this.pos = save;
|
2469
|
-
this.invalidChar();
|
2470
|
-
}
|
2471
|
-
return false;
|
2472
|
-
case 110:
|
2473
|
-
var save = this.pos;
|
2474
|
-
if(this.str.charCodeAt(this.pos++) != 117 || this.str.charCodeAt(this.pos++) != 108 || this.str.charCodeAt(this.pos++) != 108) {
|
2475
|
-
this.pos = save;
|
2476
|
-
this.invalidChar();
|
2477
|
-
}
|
2478
|
-
return null;
|
2479
|
-
case 34:
|
2480
|
-
return this.parseString();
|
2481
|
-
case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 45:
|
2482
|
-
this.pos--;
|
2483
|
-
if(!this.reg_float.match(HxOverrides.substr(this.str,this.pos,null))) throw "Invalid float at position " + this.pos;
|
2484
|
-
var v = this.reg_float.matched(0);
|
2485
|
-
this.pos += v.length;
|
2486
|
-
var f = Std.parseFloat(v);
|
2487
|
-
var i = f | 0;
|
2488
|
-
return i == f?i:f;
|
2489
|
-
default:
|
2490
|
-
this.invalidChar();
|
2491
|
-
}
|
2492
|
-
}
|
2493
|
-
}
|
2494
|
-
,nextChar: function() {
|
2495
|
-
return this.str.charCodeAt(this.pos++);
|
2496
|
-
}
|
2497
|
-
,invalidChar: function() {
|
2498
|
-
this.pos--;
|
2499
|
-
throw "Invalid char " + this.str.charCodeAt(this.pos) + " at position " + this.pos;
|
2500
|
-
}
|
2501
|
-
,doParse: function(str) {
|
2502
|
-
this.reg_float = new EReg("^-?(0|[1-9][0-9]*)(\\.[0-9]+)?([eE][+-]?[0-9]+)?","");
|
2503
|
-
this.str = str;
|
2504
|
-
this.pos = 0;
|
2505
|
-
return this.parseRec();
|
2506
|
-
}
|
2507
|
-
,quote: function(s) {
|
2508
|
-
this.buf.b += Std.string("\"");
|
2509
|
-
var i = 0;
|
2510
|
-
while(true) {
|
2511
|
-
var c = s.charCodeAt(i++);
|
2512
|
-
if(c != c) break;
|
2513
|
-
switch(c) {
|
2514
|
-
case 34:
|
2515
|
-
this.buf.b += Std.string("\\\"");
|
2516
|
-
break;
|
2517
|
-
case 92:
|
2518
|
-
this.buf.b += Std.string("\\\\");
|
2519
|
-
break;
|
2520
|
-
case 10:
|
2521
|
-
this.buf.b += Std.string("\\n");
|
2522
|
-
break;
|
2523
|
-
case 13:
|
2524
|
-
this.buf.b += Std.string("\\r");
|
2525
|
-
break;
|
2526
|
-
case 9:
|
2527
|
-
this.buf.b += Std.string("\\t");
|
2528
|
-
break;
|
2529
|
-
case 8:
|
2530
|
-
this.buf.b += Std.string("\\b");
|
2531
|
-
break;
|
2532
|
-
case 12:
|
2533
|
-
this.buf.b += Std.string("\\f");
|
2534
|
-
break;
|
2535
|
-
default:
|
2536
|
-
this.buf.b += String.fromCharCode(c);
|
2537
|
-
}
|
2538
|
-
}
|
2539
|
-
this.buf.b += Std.string("\"");
|
2540
|
-
}
|
2541
|
-
,toStringRec: function(v) {
|
2542
|
-
var $e = (Type["typeof"](v));
|
2543
|
-
switch( $e[1] ) {
|
2544
|
-
case 8:
|
2545
|
-
this.buf.b += Std.string("\"???\"");
|
2546
|
-
break;
|
2547
|
-
case 4:
|
2548
|
-
this.objString(v);
|
2549
|
-
break;
|
2550
|
-
case 1:
|
2551
|
-
case 2:
|
2552
|
-
this.buf.b += Std.string(v);
|
2553
|
-
break;
|
2554
|
-
case 5:
|
2555
|
-
this.buf.b += Std.string("\"<fun>\"");
|
2556
|
-
break;
|
2557
|
-
case 6:
|
2558
|
-
var c = $e[2];
|
2559
|
-
if(c == String) this.quote(v); else if(c == Array) {
|
2560
|
-
var v1 = v;
|
2561
|
-
this.buf.b += Std.string("[");
|
2562
|
-
var len = v1.length;
|
2563
|
-
if(len > 0) {
|
2564
|
-
this.toStringRec(v1[0]);
|
2565
|
-
var i = 1;
|
2566
|
-
while(i < len) {
|
2567
|
-
this.buf.b += Std.string(",");
|
2568
|
-
this.toStringRec(v1[i++]);
|
2569
|
-
}
|
2570
|
-
}
|
2571
|
-
this.buf.b += Std.string("]");
|
2572
|
-
} else if(c == Hash) {
|
2573
|
-
var v1 = v;
|
2574
|
-
var o = { };
|
2575
|
-
var $it0 = v1.keys();
|
2576
|
-
while( $it0.hasNext() ) {
|
2577
|
-
var k = $it0.next();
|
2578
|
-
o[k] = v1.get(k);
|
2579
|
-
}
|
2580
|
-
this.objString(o);
|
2581
|
-
} else this.objString(v);
|
2582
|
-
break;
|
2583
|
-
case 7:
|
2584
|
-
var e = $e[2];
|
2585
|
-
this.buf.b += Std.string(v[1]);
|
2586
|
-
break;
|
2587
|
-
case 3:
|
2588
|
-
this.buf.b += Std.string(v?"true":"false");
|
2589
|
-
break;
|
2590
|
-
case 0:
|
2591
|
-
this.buf.b += Std.string("null");
|
2592
|
-
break;
|
2593
|
-
}
|
2594
|
-
}
|
2595
|
-
,objString: function(v) {
|
2596
|
-
this.fieldsString(v,Reflect.fields(v));
|
2597
|
-
}
|
2598
|
-
,fieldsString: function(v,fields) {
|
2599
|
-
var first = true;
|
2600
|
-
this.buf.b += Std.string("{");
|
2601
|
-
var _g = 0;
|
2602
|
-
while(_g < fields.length) {
|
2603
|
-
var f = fields[_g];
|
2604
|
-
++_g;
|
2605
|
-
var value = Reflect.field(v,f);
|
2606
|
-
if(Reflect.isFunction(value)) continue;
|
2607
|
-
if(first) first = false; else this.buf.b += Std.string(",");
|
2608
|
-
this.quote(f);
|
2609
|
-
this.buf.b += Std.string(":");
|
2610
|
-
this.toStringRec(value);
|
2611
|
-
}
|
2612
|
-
this.buf.b += Std.string("}");
|
2613
|
-
}
|
2614
|
-
,toString: function(v) {
|
2615
|
-
this.buf = new StringBuf();
|
2616
|
-
this.toStringRec(v);
|
2617
|
-
return this.buf.b;
|
2618
|
-
}
|
2619
|
-
,reg_float: null
|
2620
|
-
,pos: null
|
2621
|
-
,str: null
|
2622
|
-
,buf: null
|
2623
|
-
,__class__: haxe.Json
|
2624
|
-
}
|
2625
|
-
haxe.Log = $hxClasses["haxe.Log"] = function() { }
|
2626
|
-
haxe.Log.__name__ = ["haxe","Log"];
|
2627
|
-
haxe.Log.trace = function(v,infos) {
|
2628
|
-
js.Boot.__trace(v,infos);
|
2629
|
-
}
|
2630
|
-
haxe.Log.clear = function() {
|
2631
|
-
js.Boot.__clear_trace();
|
2632
|
-
}
|
2633
|
-
haxe.Md5 = $hxClasses["haxe.Md5"] = function() {
|
2634
|
-
};
|
2635
|
-
haxe.Md5.__name__ = ["haxe","Md5"];
|
2636
|
-
haxe.Md5.encode = function(s) {
|
2637
|
-
return new haxe.Md5().doEncode(s);
|
2638
|
-
}
|
2639
|
-
haxe.Md5.prototype = {
|
2640
|
-
doEncode: function(str) {
|
2641
|
-
var x = this.str2blks(str);
|
2642
|
-
var a = 1732584193;
|
2643
|
-
var b = -271733879;
|
2644
|
-
var c = -1732584194;
|
2645
|
-
var d = 271733878;
|
2646
|
-
var step;
|
2647
|
-
var i = 0;
|
2648
|
-
while(i < x.length) {
|
2649
|
-
var olda = a;
|
2650
|
-
var oldb = b;
|
2651
|
-
var oldc = c;
|
2652
|
-
var oldd = d;
|
2653
|
-
step = 0;
|
2654
|
-
a = this.ff(a,b,c,d,x[i],7,-680876936);
|
2655
|
-
d = this.ff(d,a,b,c,x[i + 1],12,-389564586);
|
2656
|
-
c = this.ff(c,d,a,b,x[i + 2],17,606105819);
|
2657
|
-
b = this.ff(b,c,d,a,x[i + 3],22,-1044525330);
|
2658
|
-
a = this.ff(a,b,c,d,x[i + 4],7,-176418897);
|
2659
|
-
d = this.ff(d,a,b,c,x[i + 5],12,1200080426);
|
2660
|
-
c = this.ff(c,d,a,b,x[i + 6],17,-1473231341);
|
2661
|
-
b = this.ff(b,c,d,a,x[i + 7],22,-45705983);
|
2662
|
-
a = this.ff(a,b,c,d,x[i + 8],7,1770035416);
|
2663
|
-
d = this.ff(d,a,b,c,x[i + 9],12,-1958414417);
|
2664
|
-
c = this.ff(c,d,a,b,x[i + 10],17,-42063);
|
2665
|
-
b = this.ff(b,c,d,a,x[i + 11],22,-1990404162);
|
2666
|
-
a = this.ff(a,b,c,d,x[i + 12],7,1804603682);
|
2667
|
-
d = this.ff(d,a,b,c,x[i + 13],12,-40341101);
|
2668
|
-
c = this.ff(c,d,a,b,x[i + 14],17,-1502002290);
|
2669
|
-
b = this.ff(b,c,d,a,x[i + 15],22,1236535329);
|
2670
|
-
a = this.gg(a,b,c,d,x[i + 1],5,-165796510);
|
2671
|
-
d = this.gg(d,a,b,c,x[i + 6],9,-1069501632);
|
2672
|
-
c = this.gg(c,d,a,b,x[i + 11],14,643717713);
|
2673
|
-
b = this.gg(b,c,d,a,x[i],20,-373897302);
|
2674
|
-
a = this.gg(a,b,c,d,x[i + 5],5,-701558691);
|
2675
|
-
d = this.gg(d,a,b,c,x[i + 10],9,38016083);
|
2676
|
-
c = this.gg(c,d,a,b,x[i + 15],14,-660478335);
|
2677
|
-
b = this.gg(b,c,d,a,x[i + 4],20,-405537848);
|
2678
|
-
a = this.gg(a,b,c,d,x[i + 9],5,568446438);
|
2679
|
-
d = this.gg(d,a,b,c,x[i + 14],9,-1019803690);
|
2680
|
-
c = this.gg(c,d,a,b,x[i + 3],14,-187363961);
|
2681
|
-
b = this.gg(b,c,d,a,x[i + 8],20,1163531501);
|
2682
|
-
a = this.gg(a,b,c,d,x[i + 13],5,-1444681467);
|
2683
|
-
d = this.gg(d,a,b,c,x[i + 2],9,-51403784);
|
2684
|
-
c = this.gg(c,d,a,b,x[i + 7],14,1735328473);
|
2685
|
-
b = this.gg(b,c,d,a,x[i + 12],20,-1926607734);
|
2686
|
-
a = this.hh(a,b,c,d,x[i + 5],4,-378558);
|
2687
|
-
d = this.hh(d,a,b,c,x[i + 8],11,-2022574463);
|
2688
|
-
c = this.hh(c,d,a,b,x[i + 11],16,1839030562);
|
2689
|
-
b = this.hh(b,c,d,a,x[i + 14],23,-35309556);
|
2690
|
-
a = this.hh(a,b,c,d,x[i + 1],4,-1530992060);
|
2691
|
-
d = this.hh(d,a,b,c,x[i + 4],11,1272893353);
|
2692
|
-
c = this.hh(c,d,a,b,x[i + 7],16,-155497632);
|
2693
|
-
b = this.hh(b,c,d,a,x[i + 10],23,-1094730640);
|
2694
|
-
a = this.hh(a,b,c,d,x[i + 13],4,681279174);
|
2695
|
-
d = this.hh(d,a,b,c,x[i],11,-358537222);
|
2696
|
-
c = this.hh(c,d,a,b,x[i + 3],16,-722521979);
|
2697
|
-
b = this.hh(b,c,d,a,x[i + 6],23,76029189);
|
2698
|
-
a = this.hh(a,b,c,d,x[i + 9],4,-640364487);
|
2699
|
-
d = this.hh(d,a,b,c,x[i + 12],11,-421815835);
|
2700
|
-
c = this.hh(c,d,a,b,x[i + 15],16,530742520);
|
2701
|
-
b = this.hh(b,c,d,a,x[i + 2],23,-995338651);
|
2702
|
-
a = this.ii(a,b,c,d,x[i],6,-198630844);
|
2703
|
-
d = this.ii(d,a,b,c,x[i + 7],10,1126891415);
|
2704
|
-
c = this.ii(c,d,a,b,x[i + 14],15,-1416354905);
|
2705
|
-
b = this.ii(b,c,d,a,x[i + 5],21,-57434055);
|
2706
|
-
a = this.ii(a,b,c,d,x[i + 12],6,1700485571);
|
2707
|
-
d = this.ii(d,a,b,c,x[i + 3],10,-1894986606);
|
2708
|
-
c = this.ii(c,d,a,b,x[i + 10],15,-1051523);
|
2709
|
-
b = this.ii(b,c,d,a,x[i + 1],21,-2054922799);
|
2710
|
-
a = this.ii(a,b,c,d,x[i + 8],6,1873313359);
|
2711
|
-
d = this.ii(d,a,b,c,x[i + 15],10,-30611744);
|
2712
|
-
c = this.ii(c,d,a,b,x[i + 6],15,-1560198380);
|
2713
|
-
b = this.ii(b,c,d,a,x[i + 13],21,1309151649);
|
2714
|
-
a = this.ii(a,b,c,d,x[i + 4],6,-145523070);
|
2715
|
-
d = this.ii(d,a,b,c,x[i + 11],10,-1120210379);
|
2716
|
-
c = this.ii(c,d,a,b,x[i + 2],15,718787259);
|
2717
|
-
b = this.ii(b,c,d,a,x[i + 9],21,-343485551);
|
2718
|
-
a = this.addme(a,olda);
|
2719
|
-
b = this.addme(b,oldb);
|
2720
|
-
c = this.addme(c,oldc);
|
2721
|
-
d = this.addme(d,oldd);
|
2722
|
-
i += 16;
|
2723
|
-
}
|
2724
|
-
return this.rhex(a) + this.rhex(b) + this.rhex(c) + this.rhex(d);
|
2725
|
-
}
|
2726
|
-
,ii: function(a,b,c,d,x,s,t) {
|
2727
|
-
return this.cmn(this.bitXOR(c,this.bitOR(b,~d)),a,b,x,s,t);
|
2728
|
-
}
|
2729
|
-
,hh: function(a,b,c,d,x,s,t) {
|
2730
|
-
return this.cmn(this.bitXOR(this.bitXOR(b,c),d),a,b,x,s,t);
|
2731
|
-
}
|
2732
|
-
,gg: function(a,b,c,d,x,s,t) {
|
2733
|
-
return this.cmn(this.bitOR(this.bitAND(b,d),this.bitAND(c,~d)),a,b,x,s,t);
|
2734
|
-
}
|
2735
|
-
,ff: function(a,b,c,d,x,s,t) {
|
2736
|
-
return this.cmn(this.bitOR(this.bitAND(b,c),this.bitAND(~b,d)),a,b,x,s,t);
|
2737
|
-
}
|
2738
|
-
,cmn: function(q,a,b,x,s,t) {
|
2739
|
-
return this.addme(this.rol(this.addme(this.addme(a,q),this.addme(x,t)),s),b);
|
2740
|
-
}
|
2741
|
-
,rol: function(num,cnt) {
|
2742
|
-
return num << cnt | num >>> 32 - cnt;
|
2743
|
-
}
|
2744
|
-
,str2blks: function(str) {
|
2745
|
-
var nblk = (str.length + 8 >> 6) + 1;
|
2746
|
-
var blks = new Array();
|
2747
|
-
var _g1 = 0, _g = nblk * 16;
|
2748
|
-
while(_g1 < _g) {
|
2749
|
-
var i = _g1++;
|
2750
|
-
blks[i] = 0;
|
2751
|
-
}
|
2752
|
-
var i = 0;
|
2753
|
-
while(i < str.length) {
|
2754
|
-
blks[i >> 2] |= HxOverrides.cca(str,i) << (str.length * 8 + i) % 4 * 8;
|
2755
|
-
i++;
|
2756
|
-
}
|
2757
|
-
blks[i >> 2] |= 128 << (str.length * 8 + i) % 4 * 8;
|
2758
|
-
var l = str.length * 8;
|
2759
|
-
var k = nblk * 16 - 2;
|
2760
|
-
blks[k] = l & 255;
|
2761
|
-
blks[k] |= (l >>> 8 & 255) << 8;
|
2762
|
-
blks[k] |= (l >>> 16 & 255) << 16;
|
2763
|
-
blks[k] |= (l >>> 24 & 255) << 24;
|
2764
|
-
return blks;
|
2765
|
-
}
|
2766
|
-
,rhex: function(num) {
|
2767
|
-
var str = "";
|
2768
|
-
var hex_chr = "0123456789abcdef";
|
2769
|
-
var _g = 0;
|
2770
|
-
while(_g < 4) {
|
2771
|
-
var j = _g++;
|
2772
|
-
str += hex_chr.charAt(num >> j * 8 + 4 & 15) + hex_chr.charAt(num >> j * 8 & 15);
|
2773
|
-
}
|
2774
|
-
return str;
|
2775
|
-
}
|
2776
|
-
,addme: function(x,y) {
|
2777
|
-
var lsw = (x & 65535) + (y & 65535);
|
2778
|
-
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
2779
|
-
return msw << 16 | lsw & 65535;
|
2780
|
-
}
|
2781
|
-
,bitAND: function(a,b) {
|
2782
|
-
var lsb = a & 1 & (b & 1);
|
2783
|
-
var msb31 = a >>> 1 & b >>> 1;
|
2784
|
-
return msb31 << 1 | lsb;
|
2785
|
-
}
|
2786
|
-
,bitXOR: function(a,b) {
|
2787
|
-
var lsb = a & 1 ^ b & 1;
|
2788
|
-
var msb31 = a >>> 1 ^ b >>> 1;
|
2789
|
-
return msb31 << 1 | lsb;
|
2790
|
-
}
|
2791
|
-
,bitOR: function(a,b) {
|
2792
|
-
var lsb = a & 1 | b & 1;
|
2793
|
-
var msb31 = a >>> 1 | b >>> 1;
|
2794
|
-
return msb31 << 1 | lsb;
|
2795
|
-
}
|
2796
|
-
,__class__: haxe.Md5
|
2797
|
-
}
|
2798
|
-
haxe.Serializer = $hxClasses["haxe.Serializer"] = function() {
|
2799
|
-
this.buf = new StringBuf();
|
2800
|
-
this.cache = new Array();
|
2801
|
-
this.useCache = haxe.Serializer.USE_CACHE;
|
2802
|
-
this.useEnumIndex = haxe.Serializer.USE_ENUM_INDEX;
|
2803
|
-
this.shash = new Hash();
|
2804
|
-
this.scount = 0;
|
2805
|
-
};
|
2806
|
-
haxe.Serializer.__name__ = ["haxe","Serializer"];
|
2807
|
-
haxe.Serializer.run = function(v) {
|
2808
|
-
var s = new haxe.Serializer();
|
2809
|
-
s.serialize(v);
|
2810
|
-
return s.toString();
|
2811
|
-
}
|
2812
|
-
haxe.Serializer.prototype = {
|
2813
|
-
serializeException: function(e) {
|
2814
|
-
this.buf.b += Std.string("x");
|
2815
|
-
this.serialize(e);
|
2816
|
-
}
|
2817
|
-
,serialize: function(v) {
|
2818
|
-
var $e = (Type["typeof"](v));
|
2819
|
-
switch( $e[1] ) {
|
2820
|
-
case 0:
|
2821
|
-
this.buf.b += Std.string("n");
|
2822
|
-
break;
|
2823
|
-
case 1:
|
2824
|
-
if(v == 0) {
|
2825
|
-
this.buf.b += Std.string("z");
|
2826
|
-
return;
|
2827
|
-
}
|
2828
|
-
this.buf.b += Std.string("i");
|
2829
|
-
this.buf.b += Std.string(v);
|
2830
|
-
break;
|
2831
|
-
case 2:
|
2832
|
-
if(Math.isNaN(v)) this.buf.b += Std.string("k"); else if(!Math.isFinite(v)) this.buf.b += Std.string(v < 0?"m":"p"); else {
|
2833
|
-
this.buf.b += Std.string("d");
|
2834
|
-
this.buf.b += Std.string(v);
|
2835
|
-
}
|
2836
|
-
break;
|
2837
|
-
case 3:
|
2838
|
-
this.buf.b += Std.string(v?"t":"f");
|
2839
|
-
break;
|
2840
|
-
case 6:
|
2841
|
-
var c = $e[2];
|
2842
|
-
if(c == String) {
|
2843
|
-
this.serializeString(v);
|
2844
|
-
return;
|
2845
|
-
}
|
2846
|
-
if(this.useCache && this.serializeRef(v)) return;
|
2847
|
-
switch(c) {
|
2848
|
-
case Array:
|
2849
|
-
var ucount = 0;
|
2850
|
-
this.buf.b += Std.string("a");
|
2851
|
-
var l = v.length;
|
2852
|
-
var _g = 0;
|
2853
|
-
while(_g < l) {
|
2854
|
-
var i = _g++;
|
2855
|
-
if(v[i] == null) ucount++; else {
|
2856
|
-
if(ucount > 0) {
|
2857
|
-
if(ucount == 1) this.buf.b += Std.string("n"); else {
|
2858
|
-
this.buf.b += Std.string("u");
|
2859
|
-
this.buf.b += Std.string(ucount);
|
2860
|
-
}
|
2861
|
-
ucount = 0;
|
2862
|
-
}
|
2863
|
-
this.serialize(v[i]);
|
2864
|
-
}
|
2865
|
-
}
|
2866
|
-
if(ucount > 0) {
|
2867
|
-
if(ucount == 1) this.buf.b += Std.string("n"); else {
|
2868
|
-
this.buf.b += Std.string("u");
|
2869
|
-
this.buf.b += Std.string(ucount);
|
2870
|
-
}
|
2871
|
-
}
|
2872
|
-
this.buf.b += Std.string("h");
|
2873
|
-
break;
|
2874
|
-
case List:
|
2875
|
-
this.buf.b += Std.string("l");
|
2876
|
-
var v1 = v;
|
2877
|
-
var $it0 = v1.iterator();
|
2878
|
-
while( $it0.hasNext() ) {
|
2879
|
-
var i = $it0.next();
|
2880
|
-
this.serialize(i);
|
2881
|
-
}
|
2882
|
-
this.buf.b += Std.string("h");
|
2883
|
-
break;
|
2884
|
-
case Date:
|
2885
|
-
var d = v;
|
2886
|
-
this.buf.b += Std.string("v");
|
2887
|
-
this.buf.b += Std.string(HxOverrides.dateStr(d));
|
2888
|
-
break;
|
2889
|
-
case Hash:
|
2890
|
-
this.buf.b += Std.string("b");
|
2891
|
-
var v1 = v;
|
2892
|
-
var $it1 = v1.keys();
|
2893
|
-
while( $it1.hasNext() ) {
|
2894
|
-
var k = $it1.next();
|
2895
|
-
this.serializeString(k);
|
2896
|
-
this.serialize(v1.get(k));
|
2897
|
-
}
|
2898
|
-
this.buf.b += Std.string("h");
|
2899
|
-
break;
|
2900
|
-
case IntHash:
|
2901
|
-
this.buf.b += Std.string("q");
|
2902
|
-
var v1 = v;
|
2903
|
-
var $it2 = v1.keys();
|
2904
|
-
while( $it2.hasNext() ) {
|
2905
|
-
var k = $it2.next();
|
2906
|
-
this.buf.b += Std.string(":");
|
2907
|
-
this.buf.b += Std.string(k);
|
2908
|
-
this.serialize(v1.get(k));
|
2909
|
-
}
|
2910
|
-
this.buf.b += Std.string("h");
|
2911
|
-
break;
|
2912
|
-
case haxe.io.Bytes:
|
2913
|
-
var v1 = v;
|
2914
|
-
var i = 0;
|
2915
|
-
var max = v1.length - 2;
|
2916
|
-
var charsBuf = new StringBuf();
|
2917
|
-
var b64 = haxe.Serializer.BASE64;
|
2918
|
-
while(i < max) {
|
2919
|
-
var b1 = v1.b[i++];
|
2920
|
-
var b2 = v1.b[i++];
|
2921
|
-
var b3 = v1.b[i++];
|
2922
|
-
charsBuf.b += Std.string(b64.charAt(b1 >> 2));
|
2923
|
-
charsBuf.b += Std.string(b64.charAt((b1 << 4 | b2 >> 4) & 63));
|
2924
|
-
charsBuf.b += Std.string(b64.charAt((b2 << 2 | b3 >> 6) & 63));
|
2925
|
-
charsBuf.b += Std.string(b64.charAt(b3 & 63));
|
2926
|
-
}
|
2927
|
-
if(i == max) {
|
2928
|
-
var b1 = v1.b[i++];
|
2929
|
-
var b2 = v1.b[i++];
|
2930
|
-
charsBuf.b += Std.string(b64.charAt(b1 >> 2));
|
2931
|
-
charsBuf.b += Std.string(b64.charAt((b1 << 4 | b2 >> 4) & 63));
|
2932
|
-
charsBuf.b += Std.string(b64.charAt(b2 << 2 & 63));
|
2933
|
-
} else if(i == max + 1) {
|
2934
|
-
var b1 = v1.b[i++];
|
2935
|
-
charsBuf.b += Std.string(b64.charAt(b1 >> 2));
|
2936
|
-
charsBuf.b += Std.string(b64.charAt(b1 << 4 & 63));
|
2937
|
-
}
|
2938
|
-
var chars = charsBuf.b;
|
2939
|
-
this.buf.b += Std.string("s");
|
2940
|
-
this.buf.b += Std.string(chars.length);
|
2941
|
-
this.buf.b += Std.string(":");
|
2942
|
-
this.buf.b += Std.string(chars);
|
2943
|
-
break;
|
2944
|
-
default:
|
2945
|
-
this.cache.pop();
|
2946
|
-
if(v.hxSerialize != null) {
|
2947
|
-
this.buf.b += Std.string("C");
|
2948
|
-
this.serializeString(Type.getClassName(c));
|
2949
|
-
this.cache.push(v);
|
2950
|
-
v.hxSerialize(this);
|
2951
|
-
this.buf.b += Std.string("g");
|
2952
|
-
} else {
|
2953
|
-
this.buf.b += Std.string("c");
|
2954
|
-
this.serializeString(Type.getClassName(c));
|
2955
|
-
this.cache.push(v);
|
2956
|
-
this.serializeFields(v);
|
2957
|
-
}
|
2958
|
-
}
|
2959
|
-
break;
|
2960
|
-
case 4:
|
2961
|
-
if(this.useCache && this.serializeRef(v)) return;
|
2962
|
-
this.buf.b += Std.string("o");
|
2963
|
-
this.serializeFields(v);
|
2964
|
-
break;
|
2965
|
-
case 7:
|
2966
|
-
var e = $e[2];
|
2967
|
-
if(this.useCache && this.serializeRef(v)) return;
|
2968
|
-
this.cache.pop();
|
2969
|
-
this.buf.b += Std.string(this.useEnumIndex?"j":"w");
|
2970
|
-
this.serializeString(Type.getEnumName(e));
|
2971
|
-
if(this.useEnumIndex) {
|
2972
|
-
this.buf.b += Std.string(":");
|
2973
|
-
this.buf.b += Std.string(v[1]);
|
2974
|
-
} else this.serializeString(v[0]);
|
2975
|
-
this.buf.b += Std.string(":");
|
2976
|
-
var l = v.length;
|
2977
|
-
this.buf.b += Std.string(l - 2);
|
2978
|
-
var _g = 2;
|
2979
|
-
while(_g < l) {
|
2980
|
-
var i = _g++;
|
2981
|
-
this.serialize(v[i]);
|
2982
|
-
}
|
2983
|
-
this.cache.push(v);
|
2984
|
-
break;
|
2985
|
-
case 5:
|
2986
|
-
throw "Cannot serialize function";
|
2987
|
-
break;
|
2988
|
-
default:
|
2989
|
-
throw "Cannot serialize " + Std.string(v);
|
2990
|
-
}
|
2991
|
-
}
|
2992
|
-
,serializeFields: function(v) {
|
2993
|
-
var _g = 0, _g1 = Reflect.fields(v);
|
2994
|
-
while(_g < _g1.length) {
|
2995
|
-
var f = _g1[_g];
|
2996
|
-
++_g;
|
2997
|
-
this.serializeString(f);
|
2998
|
-
this.serialize(Reflect.field(v,f));
|
2999
|
-
}
|
3000
|
-
this.buf.b += Std.string("g");
|
3001
|
-
}
|
3002
|
-
,serializeRef: function(v) {
|
3003
|
-
var vt = typeof(v);
|
3004
|
-
var _g1 = 0, _g = this.cache.length;
|
3005
|
-
while(_g1 < _g) {
|
3006
|
-
var i = _g1++;
|
3007
|
-
var ci = this.cache[i];
|
3008
|
-
if(typeof(ci) == vt && ci == v) {
|
3009
|
-
this.buf.b += Std.string("r");
|
3010
|
-
this.buf.b += Std.string(i);
|
3011
|
-
return true;
|
3012
|
-
}
|
3013
|
-
}
|
3014
|
-
this.cache.push(v);
|
3015
|
-
return false;
|
3016
|
-
}
|
3017
|
-
,serializeString: function(s) {
|
3018
|
-
var x = this.shash.get(s);
|
3019
|
-
if(x != null) {
|
3020
|
-
this.buf.b += Std.string("R");
|
3021
|
-
this.buf.b += Std.string(x);
|
3022
|
-
return;
|
3023
|
-
}
|
3024
|
-
this.shash.set(s,this.scount++);
|
3025
|
-
this.buf.b += Std.string("y");
|
3026
|
-
s = StringTools.urlEncode(s);
|
3027
|
-
this.buf.b += Std.string(s.length);
|
3028
|
-
this.buf.b += Std.string(":");
|
3029
|
-
this.buf.b += Std.string(s);
|
3030
|
-
}
|
3031
|
-
,toString: function() {
|
3032
|
-
return this.buf.b;
|
3033
|
-
}
|
3034
|
-
,useEnumIndex: null
|
3035
|
-
,useCache: null
|
3036
|
-
,scount: null
|
3037
|
-
,shash: null
|
3038
|
-
,cache: null
|
3039
|
-
,buf: null
|
3040
|
-
,__class__: haxe.Serializer
|
3041
|
-
}
|
3042
|
-
haxe.Timer = $hxClasses["haxe.Timer"] = function(time_ms) {
|
3043
|
-
var me = this;
|
3044
|
-
this.id = window.setInterval(function() {
|
3045
|
-
me.run();
|
3046
|
-
},time_ms);
|
3047
|
-
};
|
3048
|
-
haxe.Timer.__name__ = ["haxe","Timer"];
|
3049
|
-
haxe.Timer.delay = function(f,time_ms) {
|
3050
|
-
var t = new haxe.Timer(time_ms);
|
3051
|
-
t.run = function() {
|
3052
|
-
t.stop();
|
3053
|
-
f();
|
3054
|
-
};
|
3055
|
-
return t;
|
3056
|
-
}
|
3057
|
-
haxe.Timer.measure = function(f,pos) {
|
3058
|
-
var t0 = haxe.Timer.stamp();
|
3059
|
-
var r = f();
|
3060
|
-
haxe.Log.trace(haxe.Timer.stamp() - t0 + "s",pos);
|
3061
|
-
return r;
|
3062
|
-
}
|
3063
|
-
haxe.Timer.stamp = function() {
|
3064
|
-
return new Date().getTime() / 1000;
|
3065
|
-
}
|
3066
|
-
haxe.Timer.prototype = {
|
3067
|
-
run: function() {
|
3068
|
-
}
|
3069
|
-
,stop: function() {
|
3070
|
-
if(this.id == null) return;
|
3071
|
-
window.clearInterval(this.id);
|
3072
|
-
this.id = null;
|
3073
|
-
}
|
3074
|
-
,id: null
|
3075
|
-
,__class__: haxe.Timer
|
3076
|
-
}
|
3077
|
-
haxe.Unserializer = $hxClasses["haxe.Unserializer"] = function(buf) {
|
3078
|
-
this.buf = buf;
|
3079
|
-
this.length = buf.length;
|
3080
|
-
this.pos = 0;
|
3081
|
-
this.scache = new Array();
|
3082
|
-
this.cache = new Array();
|
3083
|
-
var r = haxe.Unserializer.DEFAULT_RESOLVER;
|
3084
|
-
if(r == null) {
|
3085
|
-
r = Type;
|
3086
|
-
haxe.Unserializer.DEFAULT_RESOLVER = r;
|
3087
|
-
}
|
3088
|
-
this.setResolver(r);
|
3089
|
-
};
|
3090
|
-
haxe.Unserializer.__name__ = ["haxe","Unserializer"];
|
3091
|
-
haxe.Unserializer.initCodes = function() {
|
3092
|
-
var codes = new Array();
|
3093
|
-
var _g1 = 0, _g = haxe.Unserializer.BASE64.length;
|
3094
|
-
while(_g1 < _g) {
|
3095
|
-
var i = _g1++;
|
3096
|
-
codes[haxe.Unserializer.BASE64.charCodeAt(i)] = i;
|
3097
|
-
}
|
3098
|
-
return codes;
|
3099
|
-
}
|
3100
|
-
haxe.Unserializer.run = function(v) {
|
3101
|
-
return new haxe.Unserializer(v).unserialize();
|
3102
|
-
}
|
3103
|
-
haxe.Unserializer.prototype = {
|
3104
|
-
unserialize: function() {
|
3105
|
-
switch(this.buf.charCodeAt(this.pos++)) {
|
3106
|
-
case 110:
|
3107
|
-
return null;
|
3108
|
-
case 116:
|
3109
|
-
return true;
|
3110
|
-
case 102:
|
3111
|
-
return false;
|
3112
|
-
case 122:
|
3113
|
-
return 0;
|
3114
|
-
case 105:
|
3115
|
-
return this.readDigits();
|
3116
|
-
case 100:
|
3117
|
-
var p1 = this.pos;
|
3118
|
-
while(true) {
|
3119
|
-
var c = this.buf.charCodeAt(this.pos);
|
3120
|
-
if(c >= 43 && c < 58 || c == 101 || c == 69) this.pos++; else break;
|
3121
|
-
}
|
3122
|
-
return Std.parseFloat(HxOverrides.substr(this.buf,p1,this.pos - p1));
|
3123
|
-
case 121:
|
3124
|
-
var len = this.readDigits();
|
3125
|
-
if(this.buf.charCodeAt(this.pos++) != 58 || this.length - this.pos < len) throw "Invalid string length";
|
3126
|
-
var s = HxOverrides.substr(this.buf,this.pos,len);
|
3127
|
-
this.pos += len;
|
3128
|
-
s = StringTools.urlDecode(s);
|
3129
|
-
this.scache.push(s);
|
3130
|
-
return s;
|
3131
|
-
case 107:
|
3132
|
-
return Math.NaN;
|
3133
|
-
case 109:
|
3134
|
-
return Math.NEGATIVE_INFINITY;
|
3135
|
-
case 112:
|
3136
|
-
return Math.POSITIVE_INFINITY;
|
3137
|
-
case 97:
|
3138
|
-
var buf = this.buf;
|
3139
|
-
var a = new Array();
|
3140
|
-
this.cache.push(a);
|
3141
|
-
while(true) {
|
3142
|
-
var c = this.buf.charCodeAt(this.pos);
|
3143
|
-
if(c == 104) {
|
3144
|
-
this.pos++;
|
3145
|
-
break;
|
3146
|
-
}
|
3147
|
-
if(c == 117) {
|
3148
|
-
this.pos++;
|
3149
|
-
var n = this.readDigits();
|
3150
|
-
a[a.length + n - 1] = null;
|
3151
|
-
} else a.push(this.unserialize());
|
3152
|
-
}
|
3153
|
-
return a;
|
3154
|
-
case 111:
|
3155
|
-
var o = { };
|
3156
|
-
this.cache.push(o);
|
3157
|
-
this.unserializeObject(o);
|
3158
|
-
return o;
|
3159
|
-
case 114:
|
3160
|
-
var n = this.readDigits();
|
3161
|
-
if(n < 0 || n >= this.cache.length) throw "Invalid reference";
|
3162
|
-
return this.cache[n];
|
3163
|
-
case 82:
|
3164
|
-
var n = this.readDigits();
|
3165
|
-
if(n < 0 || n >= this.scache.length) throw "Invalid string reference";
|
3166
|
-
return this.scache[n];
|
3167
|
-
case 120:
|
3168
|
-
throw this.unserialize();
|
3169
|
-
break;
|
3170
|
-
case 99:
|
3171
|
-
var name = this.unserialize();
|
3172
|
-
var cl = this.resolver.resolveClass(name);
|
3173
|
-
if(cl == null) throw "Class not found " + name;
|
3174
|
-
var o = Type.createEmptyInstance(cl);
|
3175
|
-
this.cache.push(o);
|
3176
|
-
this.unserializeObject(o);
|
3177
|
-
return o;
|
3178
|
-
case 119:
|
3179
|
-
var name = this.unserialize();
|
3180
|
-
var edecl = this.resolver.resolveEnum(name);
|
3181
|
-
if(edecl == null) throw "Enum not found " + name;
|
3182
|
-
var e = this.unserializeEnum(edecl,this.unserialize());
|
3183
|
-
this.cache.push(e);
|
3184
|
-
return e;
|
3185
|
-
case 106:
|
3186
|
-
var name = this.unserialize();
|
3187
|
-
var edecl = this.resolver.resolveEnum(name);
|
3188
|
-
if(edecl == null) throw "Enum not found " + name;
|
3189
|
-
this.pos++;
|
3190
|
-
var index = this.readDigits();
|
3191
|
-
var tag = Type.getEnumConstructs(edecl)[index];
|
3192
|
-
if(tag == null) throw "Unknown enum index " + name + "@" + index;
|
3193
|
-
var e = this.unserializeEnum(edecl,tag);
|
3194
|
-
this.cache.push(e);
|
3195
|
-
return e;
|
3196
|
-
case 108:
|
3197
|
-
var l = new List();
|
3198
|
-
this.cache.push(l);
|
3199
|
-
var buf = this.buf;
|
3200
|
-
while(this.buf.charCodeAt(this.pos) != 104) l.add(this.unserialize());
|
3201
|
-
this.pos++;
|
3202
|
-
return l;
|
3203
|
-
case 98:
|
3204
|
-
var h = new Hash();
|
3205
|
-
this.cache.push(h);
|
3206
|
-
var buf = this.buf;
|
3207
|
-
while(this.buf.charCodeAt(this.pos) != 104) {
|
3208
|
-
var s = this.unserialize();
|
3209
|
-
h.set(s,this.unserialize());
|
3210
|
-
}
|
3211
|
-
this.pos++;
|
3212
|
-
return h;
|
3213
|
-
case 113:
|
3214
|
-
var h = new IntHash();
|
3215
|
-
this.cache.push(h);
|
3216
|
-
var buf = this.buf;
|
3217
|
-
var c = this.buf.charCodeAt(this.pos++);
|
3218
|
-
while(c == 58) {
|
3219
|
-
var i = this.readDigits();
|
3220
|
-
h.set(i,this.unserialize());
|
3221
|
-
c = this.buf.charCodeAt(this.pos++);
|
3222
|
-
}
|
3223
|
-
if(c != 104) throw "Invalid IntHash format";
|
3224
|
-
return h;
|
3225
|
-
case 118:
|
3226
|
-
var d = HxOverrides.strDate(HxOverrides.substr(this.buf,this.pos,19));
|
3227
|
-
this.cache.push(d);
|
3228
|
-
this.pos += 19;
|
3229
|
-
return d;
|
3230
|
-
case 115:
|
3231
|
-
var len = this.readDigits();
|
3232
|
-
var buf = this.buf;
|
3233
|
-
if(this.buf.charCodeAt(this.pos++) != 58 || this.length - this.pos < len) throw "Invalid bytes length";
|
3234
|
-
var codes = haxe.Unserializer.CODES;
|
3235
|
-
if(codes == null) {
|
3236
|
-
codes = haxe.Unserializer.initCodes();
|
3237
|
-
haxe.Unserializer.CODES = codes;
|
3238
|
-
}
|
3239
|
-
var i = this.pos;
|
3240
|
-
var rest = len & 3;
|
3241
|
-
var size = (len >> 2) * 3 + (rest >= 2?rest - 1:0);
|
3242
|
-
var max = i + (len - rest);
|
3243
|
-
var bytes = haxe.io.Bytes.alloc(size);
|
3244
|
-
var bpos = 0;
|
3245
|
-
while(i < max) {
|
3246
|
-
var c1 = codes[buf.charCodeAt(i++)];
|
3247
|
-
var c2 = codes[buf.charCodeAt(i++)];
|
3248
|
-
bytes.b[bpos++] = (c1 << 2 | c2 >> 4) & 255;
|
3249
|
-
var c3 = codes[buf.charCodeAt(i++)];
|
3250
|
-
bytes.b[bpos++] = (c2 << 4 | c3 >> 2) & 255;
|
3251
|
-
var c4 = codes[buf.charCodeAt(i++)];
|
3252
|
-
bytes.b[bpos++] = (c3 << 6 | c4) & 255;
|
3253
|
-
}
|
3254
|
-
if(rest >= 2) {
|
3255
|
-
var c1 = codes[buf.charCodeAt(i++)];
|
3256
|
-
var c2 = codes[buf.charCodeAt(i++)];
|
3257
|
-
bytes.b[bpos++] = (c1 << 2 | c2 >> 4) & 255;
|
3258
|
-
if(rest == 3) {
|
3259
|
-
var c3 = codes[buf.charCodeAt(i++)];
|
3260
|
-
bytes.b[bpos++] = (c2 << 4 | c3 >> 2) & 255;
|
3261
|
-
}
|
3262
|
-
}
|
3263
|
-
this.pos += len;
|
3264
|
-
this.cache.push(bytes);
|
3265
|
-
return bytes;
|
3266
|
-
case 67:
|
3267
|
-
var name = this.unserialize();
|
3268
|
-
var cl = this.resolver.resolveClass(name);
|
3269
|
-
if(cl == null) throw "Class not found " + name;
|
3270
|
-
var o = Type.createEmptyInstance(cl);
|
3271
|
-
this.cache.push(o);
|
3272
|
-
o.hxUnserialize(this);
|
3273
|
-
if(this.buf.charCodeAt(this.pos++) != 103) throw "Invalid custom data";
|
3274
|
-
return o;
|
3275
|
-
default:
|
3276
|
-
}
|
3277
|
-
this.pos--;
|
3278
|
-
throw "Invalid char " + this.buf.charAt(this.pos) + " at position " + this.pos;
|
3279
|
-
}
|
3280
|
-
,unserializeEnum: function(edecl,tag) {
|
3281
|
-
if(this.buf.charCodeAt(this.pos++) != 58) throw "Invalid enum format";
|
3282
|
-
var nargs = this.readDigits();
|
3283
|
-
if(nargs == 0) return Type.createEnum(edecl,tag);
|
3284
|
-
var args = new Array();
|
3285
|
-
while(nargs-- > 0) args.push(this.unserialize());
|
3286
|
-
return Type.createEnum(edecl,tag,args);
|
3287
|
-
}
|
3288
|
-
,unserializeObject: function(o) {
|
3289
|
-
while(true) {
|
3290
|
-
if(this.pos >= this.length) throw "Invalid object";
|
3291
|
-
if(this.buf.charCodeAt(this.pos) == 103) break;
|
3292
|
-
var k = this.unserialize();
|
3293
|
-
if(!js.Boot.__instanceof(k,String)) throw "Invalid object key";
|
3294
|
-
var v = this.unserialize();
|
3295
|
-
o[k] = v;
|
3296
|
-
}
|
3297
|
-
this.pos++;
|
3298
|
-
}
|
3299
|
-
,readDigits: function() {
|
3300
|
-
var k = 0;
|
3301
|
-
var s = false;
|
3302
|
-
var fpos = this.pos;
|
3303
|
-
while(true) {
|
3304
|
-
var c = this.buf.charCodeAt(this.pos);
|
3305
|
-
if(c != c) break;
|
3306
|
-
if(c == 45) {
|
3307
|
-
if(this.pos != fpos) break;
|
3308
|
-
s = true;
|
3309
|
-
this.pos++;
|
3310
|
-
continue;
|
3311
|
-
}
|
3312
|
-
if(c < 48 || c > 57) break;
|
3313
|
-
k = k * 10 + (c - 48);
|
3314
|
-
this.pos++;
|
3315
|
-
}
|
3316
|
-
if(s) k *= -1;
|
3317
|
-
return k;
|
3318
|
-
}
|
3319
|
-
,get: function(p) {
|
3320
|
-
return this.buf.charCodeAt(p);
|
3321
|
-
}
|
3322
|
-
,getResolver: function() {
|
3323
|
-
return this.resolver;
|
3324
|
-
}
|
3325
|
-
,setResolver: function(r) {
|
3326
|
-
if(r == null) this.resolver = { resolveClass : function(_) {
|
3327
|
-
return null;
|
3328
|
-
}, resolveEnum : function(_) {
|
3329
|
-
return null;
|
3330
|
-
}}; else this.resolver = r;
|
3331
|
-
}
|
3332
|
-
,resolver: null
|
3333
|
-
,scache: null
|
3334
|
-
,cache: null
|
3335
|
-
,length: null
|
3336
|
-
,pos: null
|
3337
|
-
,buf: null
|
3338
|
-
,__class__: haxe.Unserializer
|
3339
|
-
}
|
3340
|
-
if(!haxe.io) haxe.io = {}
|
3341
|
-
haxe.io.Bytes = $hxClasses["haxe.io.Bytes"] = function(length,b) {
|
3342
|
-
this.length = length;
|
3343
|
-
this.b = b;
|
3344
|
-
};
|
3345
|
-
haxe.io.Bytes.__name__ = ["haxe","io","Bytes"];
|
3346
|
-
haxe.io.Bytes.alloc = function(length) {
|
3347
|
-
var a = new Array();
|
3348
|
-
var _g = 0;
|
3349
|
-
while(_g < length) {
|
3350
|
-
var i = _g++;
|
3351
|
-
a.push(0);
|
3352
|
-
}
|
3353
|
-
return new haxe.io.Bytes(length,a);
|
3354
|
-
}
|
3355
|
-
haxe.io.Bytes.ofString = function(s) {
|
3356
|
-
var a = new Array();
|
3357
|
-
var _g1 = 0, _g = s.length;
|
3358
|
-
while(_g1 < _g) {
|
3359
|
-
var i = _g1++;
|
3360
|
-
var c = s.charCodeAt(i);
|
3361
|
-
if(c <= 127) a.push(c); else if(c <= 2047) {
|
3362
|
-
a.push(192 | c >> 6);
|
3363
|
-
a.push(128 | c & 63);
|
3364
|
-
} else if(c <= 65535) {
|
3365
|
-
a.push(224 | c >> 12);
|
3366
|
-
a.push(128 | c >> 6 & 63);
|
3367
|
-
a.push(128 | c & 63);
|
3368
|
-
} else {
|
3369
|
-
a.push(240 | c >> 18);
|
3370
|
-
a.push(128 | c >> 12 & 63);
|
3371
|
-
a.push(128 | c >> 6 & 63);
|
3372
|
-
a.push(128 | c & 63);
|
3373
|
-
}
|
3374
|
-
}
|
3375
|
-
return new haxe.io.Bytes(a.length,a);
|
3376
|
-
}
|
3377
|
-
haxe.io.Bytes.ofData = function(b) {
|
3378
|
-
return new haxe.io.Bytes(b.length,b);
|
3379
|
-
}
|
3380
|
-
haxe.io.Bytes.prototype = {
|
3381
|
-
getData: function() {
|
3382
|
-
return this.b;
|
3383
|
-
}
|
3384
|
-
,toHex: function() {
|
3385
|
-
var s = new StringBuf();
|
3386
|
-
var chars = [];
|
3387
|
-
var str = "0123456789abcdef";
|
3388
|
-
var _g1 = 0, _g = str.length;
|
3389
|
-
while(_g1 < _g) {
|
3390
|
-
var i = _g1++;
|
3391
|
-
chars.push(HxOverrides.cca(str,i));
|
3392
|
-
}
|
3393
|
-
var _g1 = 0, _g = this.length;
|
3394
|
-
while(_g1 < _g) {
|
3395
|
-
var i = _g1++;
|
3396
|
-
var c = this.b[i];
|
3397
|
-
s.b += String.fromCharCode(chars[c >> 4]);
|
3398
|
-
s.b += String.fromCharCode(chars[c & 15]);
|
3399
|
-
}
|
3400
|
-
return s.b;
|
3401
|
-
}
|
3402
|
-
,toString: function() {
|
3403
|
-
return this.readString(0,this.length);
|
3404
|
-
}
|
3405
|
-
,readString: function(pos,len) {
|
3406
|
-
if(pos < 0 || len < 0 || pos + len > this.length) throw haxe.io.Error.OutsideBounds;
|
3407
|
-
var s = "";
|
3408
|
-
var b = this.b;
|
3409
|
-
var fcc = String.fromCharCode;
|
3410
|
-
var i = pos;
|
3411
|
-
var max = pos + len;
|
3412
|
-
while(i < max) {
|
3413
|
-
var c = b[i++];
|
3414
|
-
if(c < 128) {
|
3415
|
-
if(c == 0) break;
|
3416
|
-
s += fcc(c);
|
3417
|
-
} else if(c < 224) s += fcc((c & 63) << 6 | b[i++] & 127); else if(c < 240) {
|
3418
|
-
var c2 = b[i++];
|
3419
|
-
s += fcc((c & 31) << 12 | (c2 & 127) << 6 | b[i++] & 127);
|
3420
|
-
} else {
|
3421
|
-
var c2 = b[i++];
|
3422
|
-
var c3 = b[i++];
|
3423
|
-
s += fcc((c & 15) << 18 | (c2 & 127) << 12 | c3 << 6 & 127 | b[i++] & 127);
|
3424
|
-
}
|
3425
|
-
}
|
3426
|
-
return s;
|
3427
|
-
}
|
3428
|
-
,compare: function(other) {
|
3429
|
-
var b1 = this.b;
|
3430
|
-
var b2 = other.b;
|
3431
|
-
var len = this.length < other.length?this.length:other.length;
|
3432
|
-
var _g = 0;
|
3433
|
-
while(_g < len) {
|
3434
|
-
var i = _g++;
|
3435
|
-
if(b1[i] != b2[i]) return b1[i] - b2[i];
|
3436
|
-
}
|
3437
|
-
return this.length - other.length;
|
3438
|
-
}
|
3439
|
-
,sub: function(pos,len) {
|
3440
|
-
if(pos < 0 || len < 0 || pos + len > this.length) throw haxe.io.Error.OutsideBounds;
|
3441
|
-
return new haxe.io.Bytes(len,this.b.slice(pos,pos + len));
|
3442
|
-
}
|
3443
|
-
,blit: function(pos,src,srcpos,len) {
|
3444
|
-
if(pos < 0 || srcpos < 0 || len < 0 || pos + len > this.length || srcpos + len > src.length) throw haxe.io.Error.OutsideBounds;
|
3445
|
-
var b1 = this.b;
|
3446
|
-
var b2 = src.b;
|
3447
|
-
if(b1 == b2 && pos > srcpos) {
|
3448
|
-
var i = len;
|
3449
|
-
while(i > 0) {
|
3450
|
-
i--;
|
3451
|
-
b1[i + pos] = b2[i + srcpos];
|
3452
|
-
}
|
3453
|
-
return;
|
3454
|
-
}
|
3455
|
-
var _g = 0;
|
3456
|
-
while(_g < len) {
|
3457
|
-
var i = _g++;
|
3458
|
-
b1[i + pos] = b2[i + srcpos];
|
3459
|
-
}
|
3460
|
-
}
|
3461
|
-
,set: function(pos,v) {
|
3462
|
-
this.b[pos] = v & 255;
|
3463
|
-
}
|
3464
|
-
,get: function(pos) {
|
3465
|
-
return this.b[pos];
|
3466
|
-
}
|
3467
|
-
,b: null
|
3468
|
-
,length: null
|
3469
|
-
,__class__: haxe.io.Bytes
|
3470
|
-
}
|
3471
|
-
haxe.io.Error = $hxClasses["haxe.io.Error"] = { __ename__ : ["haxe","io","Error"], __constructs__ : ["Blocked","Overflow","OutsideBounds","Custom"] }
|
3472
|
-
haxe.io.Error.Blocked = ["Blocked",0];
|
3473
|
-
haxe.io.Error.Blocked.toString = $estr;
|
3474
|
-
haxe.io.Error.Blocked.__enum__ = haxe.io.Error;
|
3475
|
-
haxe.io.Error.Overflow = ["Overflow",1];
|
3476
|
-
haxe.io.Error.Overflow.toString = $estr;
|
3477
|
-
haxe.io.Error.Overflow.__enum__ = haxe.io.Error;
|
3478
|
-
haxe.io.Error.OutsideBounds = ["OutsideBounds",2];
|
3479
|
-
haxe.io.Error.OutsideBounds.toString = $estr;
|
3480
|
-
haxe.io.Error.OutsideBounds.__enum__ = haxe.io.Error;
|
3481
|
-
haxe.io.Error.Custom = function(e) { var $x = ["Custom",3,e]; $x.__enum__ = haxe.io.Error; $x.toString = $estr; return $x; }
|
3482
|
-
if(!haxe.remoting) haxe.remoting = {}
|
3483
|
-
haxe.remoting.Connection = $hxClasses["haxe.remoting.Connection"] = function() { }
|
3484
|
-
haxe.remoting.Connection.__name__ = ["haxe","remoting","Connection"];
|
3485
|
-
haxe.remoting.Connection.prototype = {
|
3486
|
-
call: null
|
3487
|
-
,resolve: null
|
3488
|
-
,__class__: haxe.remoting.Connection
|
3489
|
-
}
|
3490
|
-
haxe.remoting.Context = $hxClasses["haxe.remoting.Context"] = function() {
|
3491
|
-
this.objects = new Hash();
|
3492
|
-
};
|
3493
|
-
haxe.remoting.Context.__name__ = ["haxe","remoting","Context"];
|
3494
|
-
haxe.remoting.Context.share = function(name,obj) {
|
3495
|
-
var ctx = new haxe.remoting.Context();
|
3496
|
-
ctx.addObject(name,obj);
|
3497
|
-
return ctx;
|
3498
|
-
}
|
3499
|
-
haxe.remoting.Context.prototype = {
|
3500
|
-
call: function(path,params) {
|
3501
|
-
if(path.length < 2) throw "Invalid path '" + path.join(".") + "'";
|
3502
|
-
var inf = this.objects.get(path[0]);
|
3503
|
-
if(inf == null) throw "No such object " + path[0];
|
3504
|
-
var o = inf.obj;
|
3505
|
-
var m = Reflect.field(o,path[1]);
|
3506
|
-
if(path.length > 2) {
|
3507
|
-
if(!inf.rec) throw "Can't access " + path.join(".");
|
3508
|
-
var _g1 = 2, _g = path.length;
|
3509
|
-
while(_g1 < _g) {
|
3510
|
-
var i = _g1++;
|
3511
|
-
o = m;
|
3512
|
-
m = Reflect.field(o,path[i]);
|
3513
|
-
}
|
3514
|
-
}
|
3515
|
-
if(!Reflect.isFunction(m)) throw "No such method " + path.join(".");
|
3516
|
-
return m.apply(o,params);
|
3517
|
-
}
|
3518
|
-
,addObject: function(name,obj,recursive) {
|
3519
|
-
this.objects.set(name,{ obj : obj, rec : recursive});
|
3520
|
-
}
|
3521
|
-
,objects: null
|
3522
|
-
,__class__: haxe.remoting.Context
|
3523
|
-
}
|
3524
|
-
haxe.remoting.HttpConnection = $hxClasses["haxe.remoting.HttpConnection"] = function(url,path) {
|
3525
|
-
this.__url = url;
|
3526
|
-
this.__path = path;
|
3527
|
-
};
|
3528
|
-
haxe.remoting.HttpConnection.__name__ = ["haxe","remoting","HttpConnection"];
|
3529
|
-
haxe.remoting.HttpConnection.__interfaces__ = [haxe.remoting.Connection];
|
3530
|
-
haxe.remoting.HttpConnection.urlConnect = function(url) {
|
3531
|
-
return new haxe.remoting.HttpConnection(url,[]);
|
3532
|
-
}
|
3533
|
-
haxe.remoting.HttpConnection.processRequest = function(requestData,ctx) {
|
3534
|
-
try {
|
3535
|
-
var u = new haxe.Unserializer(requestData);
|
3536
|
-
var path = u.unserialize();
|
3537
|
-
var args = u.unserialize();
|
3538
|
-
var data = ctx.call(path,args);
|
3539
|
-
var s = new haxe.Serializer();
|
3540
|
-
s.serialize(data);
|
3541
|
-
return "hxr" + s.toString();
|
3542
|
-
} catch( e ) {
|
3543
|
-
var s = new haxe.Serializer();
|
3544
|
-
s.serializeException(e);
|
3545
|
-
return "hxr" + s.toString();
|
3546
|
-
}
|
3547
|
-
}
|
3548
|
-
haxe.remoting.HttpConnection.prototype = {
|
3549
|
-
call: function(params) {
|
3550
|
-
var data = null;
|
3551
|
-
var h = new haxe.Http(this.__url);
|
3552
|
-
h.async = false;
|
3553
|
-
var s = new haxe.Serializer();
|
3554
|
-
s.serialize(this.__path);
|
3555
|
-
s.serialize(params);
|
3556
|
-
h.setHeader("X-Haxe-Remoting","1");
|
3557
|
-
h.setParameter("__x",s.toString());
|
3558
|
-
h.onData = function(d) {
|
3559
|
-
data = d;
|
3560
|
-
};
|
3561
|
-
h.onError = function(e) {
|
3562
|
-
throw e;
|
3563
|
-
};
|
3564
|
-
h.request(true);
|
3565
|
-
if(HxOverrides.substr(data,0,3) != "hxr") throw "Invalid response : '" + data + "'";
|
3566
|
-
data = HxOverrides.substr(data,3,null);
|
3567
|
-
return new haxe.Unserializer(data).unserialize();
|
3568
|
-
}
|
3569
|
-
,resolve: function(name) {
|
3570
|
-
var c = new haxe.remoting.HttpConnection(this.__url,this.__path.slice());
|
3571
|
-
c.__path.push(name);
|
3572
|
-
return c;
|
3573
|
-
}
|
3574
|
-
,__path: null
|
3575
|
-
,__url: null
|
3576
|
-
,__class__: haxe.remoting.HttpConnection
|
3577
|
-
}
|
3578
|
-
var js = js || {}
|
3579
|
-
js.Boot = $hxClasses["js.Boot"] = function() { }
|
3580
|
-
js.Boot.__name__ = ["js","Boot"];
|
3581
|
-
js.Boot.__unhtml = function(s) {
|
3582
|
-
return s.split("&").join("&").split("<").join("<").split(">").join(">");
|
3583
|
-
}
|
3584
|
-
js.Boot.__trace = function(v,i) {
|
3585
|
-
var msg = i != null?i.fileName + ":" + i.lineNumber + ": ":"";
|
3586
|
-
msg += js.Boot.__string_rec(v,"");
|
3587
|
-
var d;
|
3588
|
-
if(typeof(document) != "undefined" && (d = document.getElementById("haxe:trace")) != null) d.innerHTML += js.Boot.__unhtml(msg) + "<br/>"; else if(typeof(console) != "undefined" && console.log != null) console.log(msg);
|
3589
|
-
}
|
3590
|
-
js.Boot.__clear_trace = function() {
|
3591
|
-
var d = document.getElementById("haxe:trace");
|
3592
|
-
if(d != null) d.innerHTML = "";
|
3593
|
-
}
|
3594
|
-
js.Boot.isClass = function(o) {
|
3595
|
-
return o.__name__;
|
3596
|
-
}
|
3597
|
-
js.Boot.isEnum = function(e) {
|
3598
|
-
return e.__ename__;
|
3599
|
-
}
|
3600
|
-
js.Boot.getClass = function(o) {
|
3601
|
-
return o.__class__;
|
3602
|
-
}
|
3603
|
-
js.Boot.__string_rec = function(o,s) {
|
3604
|
-
if(o == null) return "null";
|
3605
|
-
if(s.length >= 5) return "<...>";
|
3606
|
-
var t = typeof(o);
|
3607
|
-
if(t == "function" && (o.__name__ || o.__ename__)) t = "object";
|
3608
|
-
switch(t) {
|
3609
|
-
case "object":
|
3610
|
-
if(o instanceof Array) {
|
3611
|
-
if(o.__enum__) {
|
3612
|
-
if(o.length == 2) return o[0];
|
3613
|
-
var str = o[0] + "(";
|
3614
|
-
s += "\t";
|
3615
|
-
var _g1 = 2, _g = o.length;
|
3616
|
-
while(_g1 < _g) {
|
3617
|
-
var i = _g1++;
|
3618
|
-
if(i != 2) str += "," + js.Boot.__string_rec(o[i],s); else str += js.Boot.__string_rec(o[i],s);
|
3619
|
-
}
|
3620
|
-
return str + ")";
|
3621
|
-
}
|
3622
|
-
var l = o.length;
|
3623
|
-
var i;
|
3624
|
-
var str = "[";
|
3625
|
-
s += "\t";
|
3626
|
-
var _g = 0;
|
3627
|
-
while(_g < l) {
|
3628
|
-
var i1 = _g++;
|
3629
|
-
str += (i1 > 0?",":"") + js.Boot.__string_rec(o[i1],s);
|
3630
|
-
}
|
3631
|
-
str += "]";
|
3632
|
-
return str;
|
3633
|
-
}
|
3634
|
-
var tostr;
|
3635
|
-
try {
|
3636
|
-
tostr = o.toString;
|
3637
|
-
} catch( e ) {
|
3638
|
-
return "???";
|
3639
|
-
}
|
3640
|
-
if(tostr != null && tostr != Object.toString) {
|
3641
|
-
var s2 = o.toString();
|
3642
|
-
if(s2 != "[object Object]") return s2;
|
3643
|
-
}
|
3644
|
-
var k = null;
|
3645
|
-
var str = "{\n";
|
3646
|
-
s += "\t";
|
3647
|
-
var hasp = o.hasOwnProperty != null;
|
3648
|
-
for( var k in o ) { ;
|
3649
|
-
if(hasp && !o.hasOwnProperty(k)) {
|
3650
|
-
continue;
|
3651
|
-
}
|
3652
|
-
if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") {
|
3653
|
-
continue;
|
3654
|
-
}
|
3655
|
-
if(str.length != 2) str += ", \n";
|
3656
|
-
str += s + k + " : " + js.Boot.__string_rec(o[k],s);
|
3657
|
-
}
|
3658
|
-
s = s.substring(1);
|
3659
|
-
str += "\n" + s + "}";
|
3660
|
-
return str;
|
3661
|
-
case "function":
|
3662
|
-
return "<function>";
|
3663
|
-
case "string":
|
3664
|
-
return o;
|
3665
|
-
default:
|
3666
|
-
return String(o);
|
3667
|
-
}
|
3668
|
-
}
|
3669
|
-
js.Boot.__interfLoop = function(cc,cl) {
|
3670
|
-
if(cc == null) return false;
|
3671
|
-
if(cc == cl) return true;
|
3672
|
-
var intf = cc.__interfaces__;
|
3673
|
-
if(intf != null) {
|
3674
|
-
var _g1 = 0, _g = intf.length;
|
3675
|
-
while(_g1 < _g) {
|
3676
|
-
var i = _g1++;
|
3677
|
-
var i1 = intf[i];
|
3678
|
-
if(i1 == cl || js.Boot.__interfLoop(i1,cl)) return true;
|
3679
|
-
}
|
3680
|
-
}
|
3681
|
-
return js.Boot.__interfLoop(cc.__super__,cl);
|
3682
|
-
}
|
3683
|
-
js.Boot.__instanceof = function(o,cl) {
|
3684
|
-
try {
|
3685
|
-
if(o instanceof cl) {
|
3686
|
-
if(cl == Array) return o.__enum__ == null;
|
3687
|
-
return true;
|
3688
|
-
}
|
3689
|
-
if(js.Boot.__interfLoop(o.__class__,cl)) return true;
|
3690
|
-
} catch( e ) {
|
3691
|
-
if(cl == null) return false;
|
3692
|
-
}
|
3693
|
-
switch(cl) {
|
3694
|
-
case Int:
|
3695
|
-
return Math.ceil(o%2147483648.0) === o;
|
3696
|
-
case Float:
|
3697
|
-
return typeof(o) == "number";
|
3698
|
-
case Bool:
|
3699
|
-
return o === true || o === false;
|
3700
|
-
case String:
|
3701
|
-
return typeof(o) == "string";
|
3702
|
-
case Dynamic:
|
3703
|
-
return true;
|
3704
|
-
default:
|
3705
|
-
if(o == null) return false;
|
3706
|
-
if(cl == Class && o.__name__ != null) return true; else null;
|
3707
|
-
if(cl == Enum && o.__ename__ != null) return true; else null;
|
3708
|
-
return o.__enum__ == cl;
|
3709
|
-
}
|
3710
|
-
}
|
3711
|
-
js.Boot.__cast = function(o,t) {
|
3712
|
-
if(js.Boot.__instanceof(o,t)) return o; else throw "Cannot cast " + Std.string(o) + " to " + Std.string(t);
|
3713
|
-
}
|
3714
|
-
js.Lib = $hxClasses["js.Lib"] = function() { }
|
3715
|
-
js.Lib.__name__ = ["js","Lib"];
|
3716
|
-
js.Lib.document = null;
|
3717
|
-
js.Lib.window = null;
|
3718
|
-
js.Lib.debug = function() {
|
3719
|
-
debugger;
|
3720
|
-
}
|
3721
|
-
js.Lib.alert = function(v) {
|
3722
|
-
alert(js.Boot.__string_rec(v,""));
|
3723
|
-
}
|
3724
|
-
js.Lib.eval = function(code) {
|
3725
|
-
return eval(code);
|
3726
|
-
}
|
3727
|
-
js.Lib.setErrorHandler = function(f) {
|
3728
|
-
js.Lib.onerror = f;
|
3729
|
-
}
|
3730
|
-
function $iterator(o) { if( o instanceof Array ) return function() { return HxOverrides.iter(o); }; return typeof(o.iterator) == 'function' ? $bind(o,o.iterator) : o.iterator; };
|
3731
|
-
var $_;
|
3732
|
-
function $bind(o,m) { var f = function(){ return f.method.apply(f.scope, arguments); }; f.scope = o; f.method = m; return f; };
|
3733
|
-
if(Array.prototype.indexOf) HxOverrides.remove = function(a,o) {
|
3734
|
-
var i = a.indexOf(o);
|
3735
|
-
if(i == -1) return false;
|
3736
|
-
a.splice(i,1);
|
3737
|
-
return true;
|
3738
|
-
}; else null;
|
3739
|
-
Math.__name__ = ["Math"];
|
3740
|
-
Math.NaN = Number.NaN;
|
3741
|
-
Math.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
|
3742
|
-
Math.POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
3743
|
-
$hxClasses.Math = Math;
|
3744
|
-
Math.isFinite = function(i) {
|
3745
|
-
return isFinite(i);
|
3746
|
-
};
|
3747
|
-
Math.isNaN = function(i) {
|
3748
|
-
return isNaN(i);
|
3749
|
-
};
|
3750
|
-
String.prototype.__class__ = $hxClasses.String = String;
|
3751
|
-
String.__name__ = ["String"];
|
3752
|
-
Array.prototype.__class__ = $hxClasses.Array = Array;
|
3753
|
-
Array.__name__ = ["Array"];
|
3754
|
-
Date.prototype.__class__ = $hxClasses.Date = Date;
|
3755
|
-
Date.__name__ = ["Date"];
|
3756
|
-
var Int = $hxClasses.Int = { __name__ : ["Int"]};
|
3757
|
-
var Dynamic = $hxClasses.Dynamic = { __name__ : ["Dynamic"]};
|
3758
|
-
var Float = $hxClasses.Float = Number;
|
3759
|
-
Float.__name__ = ["Float"];
|
3760
|
-
var Bool = $hxClasses.Bool = Boolean;
|
3761
|
-
Bool.__ename__ = ["Bool"];
|
3762
|
-
var Class = $hxClasses.Class = { __name__ : ["Class"]};
|
3763
|
-
var Enum = { };
|
3764
|
-
var Void = $hxClasses.Void = { __ename__ : ["Void"]};
|
3765
|
-
if(typeof(JSON) != "undefined") haxe.Json = JSON;
|
3766
|
-
if(typeof document != "undefined") js.Lib.document = document;
|
3767
|
-
if(typeof window != "undefined") {
|
3768
|
-
js.Lib.window = window;
|
3769
|
-
js.Lib.window.onerror = function(msg,url,line) {
|
3770
|
-
var f = js.Lib.onerror;
|
3771
|
-
if(f == null) return false;
|
3772
|
-
return f(msg,[url + ":" + line]);
|
3773
|
-
};
|
3774
|
-
}
|
3775
|
-
js.XMLHttpRequest = window.XMLHttpRequest?XMLHttpRequest:window.ActiveXObject?function() {
|
3776
|
-
try {
|
3777
|
-
return new ActiveXObject("Msxml2.XMLHTTP");
|
3778
|
-
} catch( e ) {
|
3779
|
-
try {
|
3780
|
-
return new ActiveXObject("Microsoft.XMLHTTP");
|
3781
|
-
} catch( e1 ) {
|
3782
|
-
throw "Unable to create XMLHttpRequest object.";
|
3783
|
-
}
|
3784
|
-
}
|
3785
|
-
}:(function($this) {
|
3786
|
-
var $r;
|
3787
|
-
throw "Unable to create XMLHttpRequest object.";
|
3788
|
-
return $r;
|
3789
|
-
}(this));
|
3790
|
-
com.wiris.js.JsPluginViewer.USE_CREATE_IMAGE = 1;
|
3791
|
-
com.wiris.js.JsPluginViewer.DEBUG = false;
|
3792
|
-
com.wiris.js.JsPluginViewer.TECH = "@param.js.tech.discover@";
|
3793
|
-
com.wiris.js.JsPluginViewer.VERSION = "7.14.0.1422";
|
3794
|
-
com.wiris.system.JsDOMUtils.TOUCHHOLD_MOVE_MARGIN = 10;
|
3795
|
-
com.wiris.system.JsDOMUtils.browser = new com.wiris.system.JsBrowser();
|
3796
|
-
com.wiris.system.JsDOMUtils.initialized = false;
|
3797
|
-
com.wiris.system.JsDOMUtils.touchDeviceListeners = new Array();
|
3798
|
-
com.wiris.system.JsDOMUtils.mouseDeviceListeners = new Array();
|
3799
|
-
com.wiris.system.JsDOMUtils.internetExplorerPointers = new Hash();
|
3800
|
-
haxe.Serializer.USE_CACHE = false;
|
3801
|
-
haxe.Serializer.USE_ENUM_INDEX = false;
|
3802
|
-
haxe.Serializer.BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:";
|
3803
|
-
haxe.Unserializer.DEFAULT_RESOLVER = Type;
|
3804
|
-
haxe.Unserializer.BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:";
|
3805
|
-
haxe.Unserializer.CODES = null;
|
3806
|
-
haxe.remoting.HttpConnection.TIMEOUT = 10;
|
3807
|
-
js.Lib.onerror = null;
|
3808
|
-
com.wiris.js.JsPluginViewer.main();
|
3809
|
-
delete Array.prototype.__class__; }());
|