wirispluginengine 3.62.0.1322
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 +7 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/wirispluginengine/WIRISplugins.js +2833 -0
- data/app/controllers/wirispluginengine/application_controller.rb +75 -0
- data/app/helpers/wirispluginengine/application_helper.rb +4 -0
- data/config/routes.rb +4 -0
- data/configuration.ini.dist +104 -0
- data/lib/com/wiris/common/WInteger.rb +57 -0
- data/lib/com/wiris/plugin/api/Cas.rb +8 -0
- data/lib/com/wiris/plugin/api/CleanCache.rb +8 -0
- data/lib/com/wiris/plugin/api/Configuration.rb +8 -0
- data/lib/com/wiris/plugin/api/ConfigurationKeys.rb +96 -0
- data/lib/com/wiris/plugin/api/Editor.rb +8 -0
- data/lib/com/wiris/plugin/api/Filter.rb +8 -0
- data/lib/com/wiris/plugin/api/ImageFormatController.rb +8 -0
- data/lib/com/wiris/plugin/api/ParamsProvider.rb +8 -0
- data/lib/com/wiris/plugin/api/PluginBuilder.rb +79 -0
- data/lib/com/wiris/plugin/api/Render.rb +8 -0
- data/lib/com/wiris/plugin/api/ServiceResourceLoader.rb +8 -0
- data/lib/com/wiris/plugin/api/Test.rb +8 -0
- data/lib/com/wiris/plugin/api/TextService.rb +8 -0
- data/lib/com/wiris/plugin/configuration/ConfigurationUpdater.rb +8 -0
- data/lib/com/wiris/plugin/impl/CasImpl.rb +146 -0
- data/lib/com/wiris/plugin/impl/CleanCacheImpl.rb +111 -0
- data/lib/com/wiris/plugin/impl/ConfigurationImpl.rb +176 -0
- data/lib/com/wiris/plugin/impl/CustomConfigurationUpdater.rb +38 -0
- data/lib/com/wiris/plugin/impl/DefaultConfigurationUpdater.rb +29 -0
- data/lib/com/wiris/plugin/impl/EditorImpl.rb +86 -0
- data/lib/com/wiris/plugin/impl/FileConfigurationUpdater.rb +34 -0
- data/lib/com/wiris/plugin/impl/FileStorageAndCache.rb +59 -0
- data/lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb +144 -0
- data/lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb +56 -0
- data/lib/com/wiris/plugin/impl/HttpImpl.rb +53 -0
- data/lib/com/wiris/plugin/impl/HttpListener.rb +8 -0
- data/lib/com/wiris/plugin/impl/ImageFormatControllerPng.rb +73 -0
- data/lib/com/wiris/plugin/impl/ImageFormatControllerSvg.rb +34 -0
- data/lib/com/wiris/plugin/impl/PluginBuilderImpl.rb +253 -0
- data/lib/com/wiris/plugin/impl/RenderImpl.rb +280 -0
- data/lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb +52 -0
- data/lib/com/wiris/plugin/impl/TestImpl.rb +166 -0
- data/lib/com/wiris/plugin/impl/TextFilter.rb +211 -0
- data/lib/com/wiris/plugin/impl/TextFilterTags.rb +55 -0
- data/lib/com/wiris/plugin/impl/TextServiceImpl.rb +118 -0
- data/lib/com/wiris/plugin/storage/StorageAndCache.rb +8 -0
- data/lib/com/wiris/util/json/JSon.rb +536 -0
- data/lib/com/wiris/util/json/JSonIntegerFormat.rb +21 -0
- data/lib/com/wiris/util/json/StringParser.rb +61 -0
- data/lib/com/wiris/util/sys/HttpConnection.rb +18 -0
- data/lib/com/wiris/util/sys/HttpConnectionListener.rb +8 -0
- data/lib/com/wiris/util/sys/IniFile.rb +143 -0
- data/lib/com/wiris/util/sys/Store.rb +109 -0
- data/lib/com/wiris/util/xml/SerializableImpl.rb +20 -0
- data/lib/com/wiris/util/xml/WCharacterBase.rb +634 -0
- data/lib/com/wiris/util/xml/WEntities.rb +14 -0
- data/lib/com/wiris/util/xml/WXmlUtils.rb +515 -0
- data/lib/com/wiris/util/xml/XmlSerializer.rb +485 -0
- data/lib/com/wiris/util/xml/XmlWriter.rb +279 -0
- data/lib/loader.rb +12 -0
- data/lib/src-generic/Array.rb +23 -0
- data/lib/src-generic/ArrayInt.rb +32 -0
- data/lib/src-generic/Base64.rb +15 -0
- data/lib/src-generic/BaseCode.rb +94 -0
- data/lib/src-generic/Bytes.rb +50 -0
- data/lib/src-generic/BytesInput.rb +38 -0
- data/lib/src-generic/EReg.rb +56 -0
- data/lib/src-generic/File.rb +36 -0
- data/lib/src-generic/FileLock.rb +27 -0
- data/lib/src-generic/FileSystem.rb +37 -0
- data/lib/src-generic/Hash.rb +43 -0
- data/lib/src-generic/Http.rb +107 -0
- data/lib/src-generic/HttpRequest.rb +25 -0
- data/lib/src-generic/HttpResponse.rb +71 -0
- data/lib/src-generic/Iterator.rb +20 -0
- data/lib/src-generic/Math.rb +15 -0
- data/lib/src-generic/Md5.rb +8 -0
- data/lib/src-generic/Md5Tools.rb +12 -0
- data/lib/src-generic/PropertiesTools.rb +33 -0
- data/lib/src-generic/Reflect.rb +17 -0
- data/lib/src-generic/RubyConfigurationUpdater.rb +45 -0
- data/lib/src-generic/Serializer.rb +85 -0
- data/lib/src-generic/Std.rb +74 -0
- data/lib/src-generic/Storage.rb +153 -0
- data/lib/src-generic/StringBuf.rb +41 -0
- data/lib/src-generic/StringTools.rb +46 -0
- data/lib/src-generic/Timer.rb +7 -0
- data/lib/src-generic/Type.rb +19 -0
- data/lib/src-generic/TypeTools.rb +32 -0
- data/lib/src-generic/Unserializer.rb +73 -0
- data/lib/src-generic/Utf8.rb +27 -0
- data/lib/src-generic/Xml.rb +199 -0
- data/lib/src-generic/extended/Integer.rb +5 -0
- data/lib/src-generic/extended/Math.rb +7 -0
- data/lib/src-generic/extended/Properties.rb +12 -0
- data/lib/src-generic/extended/String.rb +39 -0
- data/lib/src-generic/settings/PlatformSettings.rb +19 -0
- data/lib/wirispluginengine.rb +5 -0
- data/lib/wirispluginengine/engine.rb +5 -0
- data/lib/wirispluginengine/integration/cleancache.rb +8 -0
- data/lib/wirispluginengine/integration/configurationjs.rb +16 -0
- data/lib/wirispluginengine/integration/configurationjson.rb +7 -0
- data/lib/wirispluginengine/integration/createimage.rb +8 -0
- data/lib/wirispluginengine/integration/getmathml.rb +18 -0
- data/lib/wirispluginengine/integration/resource.rb +8 -0
- data/lib/wirispluginengine/integration/service.rb +6 -0
- data/lib/wirispluginengine/integration/showimage.rb +21 -0
- data/lib/wirispluginengine/integration/test.rb +6 -0
- data/lib/wirispluginengine/version.rb +3 -0
- data/resources/VERSION +1 -0
- data/resources/default-configuration.ini +45 -0
- data/resources/tech.txt +1 -0
- data/resources/wirisplugin.css +43 -0
- metadata +182 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 14c366ad765de6dfe59889954b7dc9296c468bf2
|
4
|
+
data.tar.gz: aa61046dcf44ef83253d0a3df30d18693626fa58
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3abbf3ecc7513156dfda4af3a0026934c8187cfa80b49a34b37a833e7f58d5ffeced047d0efd16bb381a270a904d7492d89797f2739252778e2744d587b2bb10
|
7
|
+
data.tar.gz: 4af2c079d559a9e48bafe0262b1e9d98900838dfc0f0e393b9849aeca668ec01586361931be2c04464b7faf1d3a9eae4c7e90ecf45271420085a104ee130312c
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Wirispluginengine'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
@@ -0,0 +1,2833 @@
|
|
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,"Chrome",null,"Chrome");
|
763
|
+
this.addBrowser("navigator.userAgent",null,"OmniWeb",null,"OmniWeb");
|
764
|
+
this.addBrowser("navigator.vendor",null,"Apple","Version","Safari");
|
765
|
+
this.addBrowser(null,"window.opera",null,"Version","Opera");
|
766
|
+
this.addBrowser("navigator.vendor",null,"iCab",null,"iCab");
|
767
|
+
this.addBrowser("navigator.vendor",null,"KDE",null,"Konkeror");
|
768
|
+
this.addBrowser("navigator.userAgent",null,"Firefox",null,"Firefox");
|
769
|
+
this.addBrowser("navigator.vendor",null,"Camino",null,"Camino");
|
770
|
+
this.addBrowser("navigator.userAgent",null,"Netscape",null,"Netscape");
|
771
|
+
this.addBrowser("navigator.userAgent",null,"MSIE","MSIE","Explorer");
|
772
|
+
this.addBrowser("navigator.userAgent",null,"Gecko","rv","Mozilla");
|
773
|
+
this.addBrowser("navigator.userAgent",null,"Mozilla","Mozilla","Netscape");
|
774
|
+
this.dataOS = new Array();
|
775
|
+
this.addOS("navigator.platform","Win","Windows");
|
776
|
+
this.addOS("navigator.platform","Mac","Mac");
|
777
|
+
this.addOS("navigator.userAgent","iPhone","iOS");
|
778
|
+
this.addOS("navigator.userAgent","iPad","iOS");
|
779
|
+
this.addOS("navigator.userAgent","Android","Android");
|
780
|
+
this.addOS("navigator.platform","Linux","Linux");
|
781
|
+
this.setBrowser();
|
782
|
+
this.setOS();
|
783
|
+
};
|
784
|
+
com.wiris.js.JsBrowser.__name__ = ["com","wiris","js","JsBrowser"];
|
785
|
+
com.wiris.js.JsBrowser.prototype = {
|
786
|
+
isAndroid: function() {
|
787
|
+
return this.os == "Android";
|
788
|
+
}
|
789
|
+
,isIOS: function() {
|
790
|
+
return this.os == "iOS";
|
791
|
+
}
|
792
|
+
,isFF: function() {
|
793
|
+
return this.browser == "Firefox";
|
794
|
+
}
|
795
|
+
,isChrome: function() {
|
796
|
+
return this.browser == "Chrome";
|
797
|
+
}
|
798
|
+
,isIE: function() {
|
799
|
+
return this.browser == "Explorer";
|
800
|
+
}
|
801
|
+
,getVersion: function() {
|
802
|
+
return this.ver;
|
803
|
+
}
|
804
|
+
,getOS: function() {
|
805
|
+
return this.os;
|
806
|
+
}
|
807
|
+
,getBrowser: function() {
|
808
|
+
return this.browser;
|
809
|
+
}
|
810
|
+
,searchVersion: function(prop,search) {
|
811
|
+
var str = js.Boot.__cast(eval(prop) , String);
|
812
|
+
var index = str.indexOf(search);
|
813
|
+
if(index == -1) return null;
|
814
|
+
return "" + Std.parseFloat(HxOverrides.substr(str,index + search.length + 1,null));
|
815
|
+
}
|
816
|
+
,setOS: function() {
|
817
|
+
var i = HxOverrides.iter(this.dataOS);
|
818
|
+
while(i.hasNext()) {
|
819
|
+
var s = i.next();
|
820
|
+
var str = js.Boot.__cast(eval(s.string) , String);
|
821
|
+
if(str.indexOf(s.subString) != -1) {
|
822
|
+
this.os = s.identity;
|
823
|
+
return;
|
824
|
+
}
|
825
|
+
}
|
826
|
+
}
|
827
|
+
,setBrowser: function() {
|
828
|
+
var i = HxOverrides.iter(this.dataBrowser);
|
829
|
+
while(i.hasNext()) {
|
830
|
+
var b = i.next();
|
831
|
+
if(b.string != null) {
|
832
|
+
var obj = eval(b.string);
|
833
|
+
if(obj != null) {
|
834
|
+
var str = js.Boot.__cast(obj , String);
|
835
|
+
if(str.indexOf(b.subString) != -1) {
|
836
|
+
this.browser = b.identity;
|
837
|
+
this.ver = this.searchVersion("navigator.userAgent",b.versionSearch);
|
838
|
+
if(this.ver == null) this.ver = this.searchVersion("navigator.appVersion",b.versionSearch);
|
839
|
+
return;
|
840
|
+
}
|
841
|
+
}
|
842
|
+
}
|
843
|
+
}
|
844
|
+
}
|
845
|
+
,addOS: function(string,subString,identity) {
|
846
|
+
var s = new com.wiris.js.JsOSData();
|
847
|
+
s.string = string;
|
848
|
+
s.subString = subString;
|
849
|
+
s.identity = identity;
|
850
|
+
this.dataOS.push(s);
|
851
|
+
}
|
852
|
+
,addBrowser: function(string,prop,subString,versionSearch,identity) {
|
853
|
+
var b = new com.wiris.js.JsBrowserData();
|
854
|
+
b.string = string;
|
855
|
+
b.prop = prop;
|
856
|
+
b.subString = subString;
|
857
|
+
b.versionSearch = versionSearch != null?versionSearch:identity;
|
858
|
+
b.identity = identity;
|
859
|
+
this.dataBrowser.push(b);
|
860
|
+
}
|
861
|
+
,os: null
|
862
|
+
,ver: null
|
863
|
+
,browser: null
|
864
|
+
,dataOS: null
|
865
|
+
,dataBrowser: null
|
866
|
+
,__class__: com.wiris.js.JsBrowser
|
867
|
+
}
|
868
|
+
com.wiris.js.JsPluginTools = $hxClasses["com.wiris.js.JsPluginTools"] = function() {
|
869
|
+
this.tryReady();
|
870
|
+
};
|
871
|
+
com.wiris.js.JsPluginTools.__name__ = ["com","wiris","js","JsPluginTools"];
|
872
|
+
com.wiris.js.JsPluginTools.instance = null;
|
873
|
+
com.wiris.js.JsPluginTools.main = function() {
|
874
|
+
var ev;
|
875
|
+
ev = com.wiris.js.JsPluginTools.getInstance();
|
876
|
+
haxe.Timer.delay($bind(ev,ev.tryReady),100);
|
877
|
+
}
|
878
|
+
com.wiris.js.JsPluginTools.getInstance = function() {
|
879
|
+
if(com.wiris.js.JsPluginTools.instance == null) com.wiris.js.JsPluginTools.instance = new com.wiris.js.JsPluginTools();
|
880
|
+
return com.wiris.js.JsPluginTools.instance;
|
881
|
+
}
|
882
|
+
com.wiris.js.JsPluginTools.bypassEncapsulation = function() {
|
883
|
+
if(window.com == null) window.com = { };
|
884
|
+
if(window.com.wiris == null) window.com.wiris = { };
|
885
|
+
if(window.com.wiris.js == null) window.com.wiris.js = { };
|
886
|
+
if(window.com.wiris.js.JsPluginTools == null) window.com.wiris.js.JsPluginTools = com.wiris.js.JsPluginTools.getInstance();
|
887
|
+
}
|
888
|
+
com.wiris.js.JsPluginTools.prototype = {
|
889
|
+
md5encode: function(content) {
|
890
|
+
return haxe.Md5.encode(content);
|
891
|
+
}
|
892
|
+
,doLoad: function() {
|
893
|
+
this.ready = true;
|
894
|
+
com.wiris.js.JsPluginTools.instance = this;
|
895
|
+
com.wiris.js.JsPluginTools.bypassEncapsulation();
|
896
|
+
}
|
897
|
+
,tryReady: function() {
|
898
|
+
this.ready = false;
|
899
|
+
if(js.Lib.document.readyState) {
|
900
|
+
this.doLoad();
|
901
|
+
this.ready = true;
|
902
|
+
}
|
903
|
+
if(!this.ready) haxe.Timer.delay($bind(this,this.tryReady),100);
|
904
|
+
}
|
905
|
+
,ready: null
|
906
|
+
,__class__: com.wiris.js.JsPluginTools
|
907
|
+
}
|
908
|
+
com.wiris.js.JsPluginViewer = $hxClasses["com.wiris.js.JsPluginViewer"] = function() {
|
909
|
+
this._wrs_conf_imageFormat = null;
|
910
|
+
this.javaServicePath = "/pluginwiris_engine/app";
|
911
|
+
this.performanceenabled = null;
|
912
|
+
this.params = new Hash();
|
913
|
+
this.mode = com.wiris.js.JsPluginViewer.USE_CREATE_IMAGE;
|
914
|
+
this.zoom = 1;
|
915
|
+
this.viewer = "";
|
916
|
+
this.lang = "inherit";
|
917
|
+
this.ready = false;
|
918
|
+
this.extension = "@param.configuration.script.extension@";
|
919
|
+
this.localpath = "@param.configuration.script.local.path@";
|
920
|
+
this.absoluteURL = "@param.configuration.script.base.path@";
|
921
|
+
if(this.extension.indexOf("@") >= 0) this.extension = "";
|
922
|
+
if(this.localpath.indexOf("@") >= 0) this.localpath = "/app";
|
923
|
+
if(this.absoluteURL.indexOf("@") >= 0) this.absoluteURL = "/java-java-context-root";
|
924
|
+
};
|
925
|
+
com.wiris.js.JsPluginViewer.__name__ = ["com","wiris","js","JsPluginViewer"];
|
926
|
+
com.wiris.js.JsPluginViewer.instance = null;
|
927
|
+
com.wiris.js.JsPluginViewer.main = function() {
|
928
|
+
var ev;
|
929
|
+
ev = com.wiris.js.JsPluginViewer.getInstance();
|
930
|
+
haxe.Timer.delay($bind(ev,ev.tryReady),100);
|
931
|
+
}
|
932
|
+
com.wiris.js.JsPluginViewer.getInstance = function() {
|
933
|
+
if(com.wiris.js.JsPluginViewer.instance == null) com.wiris.js.JsPluginViewer.instance = new com.wiris.js.JsPluginViewer();
|
934
|
+
return com.wiris.js.JsPluginViewer.instance;
|
935
|
+
}
|
936
|
+
com.wiris.js.JsPluginViewer.bypassEncapsulation = function() {
|
937
|
+
if(window.com == null) window.com = { };
|
938
|
+
if(window.com.wiris == null) window.com.wiris = { };
|
939
|
+
if(window.com.wiris.js == null) window.com.wiris.js = { };
|
940
|
+
if(window.com.wiris.js.JsPluginViewer == null) window.com.wiris.js.JsPluginViewer = com.wiris.js.JsPluginViewer.getInstance();
|
941
|
+
}
|
942
|
+
com.wiris.js.JsPluginViewer.prototype = {
|
943
|
+
getBaseURL: function() {
|
944
|
+
return this.baseURL;
|
945
|
+
}
|
946
|
+
,queryToParams: function(query) {
|
947
|
+
var ss = query.split("&");
|
948
|
+
var h = new Hash();
|
949
|
+
var _g = 0;
|
950
|
+
while(_g < ss.length) {
|
951
|
+
var s = ss[_g];
|
952
|
+
++_g;
|
953
|
+
var kv = s.split("=");
|
954
|
+
if(kv.length > 1) h.set(kv[0],StringTools.urlDecode(kv[1]));
|
955
|
+
}
|
956
|
+
return h;
|
957
|
+
}
|
958
|
+
,isPerformanceEnabled: function() {
|
959
|
+
var data;
|
960
|
+
data = this.callGetVariableKeys("wirispluginperformance");
|
961
|
+
if(haxe.Json.parse(data).status != "ok") return false; else return haxe.Json.parse(data).result.wirispluginperformance == "true"?true:false;
|
962
|
+
}
|
963
|
+
,callGetVariableKeys: function(variableKeys) {
|
964
|
+
var con;
|
965
|
+
var data;
|
966
|
+
var url;
|
967
|
+
url = (this.absoluteURL.length > 0?this.absoluteURL:this.baseURL + this.localpath) + "/configurationjson" + this.extension;
|
968
|
+
con = new js.XMLHttpRequest();
|
969
|
+
data = "?variablekeys=" + variableKeys;
|
970
|
+
con.open("GET",url + data,false);
|
971
|
+
con.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8");
|
972
|
+
con.send(null);
|
973
|
+
return con.responseText;
|
974
|
+
}
|
975
|
+
,callService: function(mml,servicename) {
|
976
|
+
var con;
|
977
|
+
var height = 0;
|
978
|
+
var width = 0;
|
979
|
+
var baseline = 0;
|
980
|
+
var text = null;
|
981
|
+
var data;
|
982
|
+
var url;
|
983
|
+
con = new js.XMLHttpRequest();
|
984
|
+
url = (this.absoluteURL.length > 0?this.absoluteURL:this.baseURL + this.localpath) + "/service" + this.extension;
|
985
|
+
data = "service=" + servicename;
|
986
|
+
data += "&metrics=true¢erbaseline=false&mml=" + StringTools.urlEncode(mml);
|
987
|
+
data += "&lang=" + this.lang;
|
988
|
+
if(this.zoom != 1) data += "&zoom=" + this.zoom;
|
989
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Calling: " + url,{ fileName : "JsPluginViewer.hx", lineNumber : 535, className : "com.wiris.js.JsPluginViewer", methodName : "callService"});
|
990
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("POST:" + data,{ fileName : "JsPluginViewer.hx", lineNumber : 537, className : "com.wiris.js.JsPluginViewer", methodName : "callService"});
|
991
|
+
con.open("POST",url,false);
|
992
|
+
con.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8");
|
993
|
+
con.send(data);
|
994
|
+
return con.responseText;
|
995
|
+
}
|
996
|
+
,callShowimage: function(mml,img) {
|
997
|
+
var con;
|
998
|
+
var height = 0;
|
999
|
+
var width = 0;
|
1000
|
+
var baseline = 0;
|
1001
|
+
var text = null;
|
1002
|
+
var data;
|
1003
|
+
var url;
|
1004
|
+
con = new js.XMLHttpRequest();
|
1005
|
+
var mmlEntities;
|
1006
|
+
mmlEntities = "";
|
1007
|
+
var _g1 = 0, _g = mml.length;
|
1008
|
+
while(_g1 < _g) {
|
1009
|
+
var i = _g1++;
|
1010
|
+
var character;
|
1011
|
+
character = mml.charAt(i);
|
1012
|
+
if(HxOverrides.cca(mml,i) > 128) mmlEntities += "&#" + HxOverrides.cca(mml,i) + ";"; else mmlEntities += character;
|
1013
|
+
}
|
1014
|
+
var md5 = haxe.Md5.encode("centerbaseline=false\nmml=" + mmlEntities + "\n");
|
1015
|
+
url = (this.absoluteURL.length > 0?this.absoluteURL:this.baseURL + this.localpath) + "/showimage" + this.extension;
|
1016
|
+
data = "?formula=" + md5 + "&lang=" + this.lang;
|
1017
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Calling: " + url,{ fileName : "JsPluginViewer.hx", lineNumber : 474, className : "com.wiris.js.JsPluginViewer", methodName : "callShowimage"});
|
1018
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("GET:" + data,{ fileName : "JsPluginViewer.hx", lineNumber : 476, className : "com.wiris.js.JsPluginViewer", methodName : "callShowimage"});
|
1019
|
+
con.open("GET",url + data,false);
|
1020
|
+
con.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8");
|
1021
|
+
con.send(null);
|
1022
|
+
var s = con.responseText;
|
1023
|
+
if(haxe.Json.parse(con.responseText).status == "warning") {
|
1024
|
+
con.open("POST",url,false);
|
1025
|
+
con.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8");
|
1026
|
+
data = "centerbaseline=false&mml=" + StringTools.urlEncode(mml);
|
1027
|
+
con.send(data);
|
1028
|
+
s = con.responseText;
|
1029
|
+
}
|
1030
|
+
var result = haxe.Json.parse(con.responseText).result;
|
1031
|
+
img.src = result.format == "svg"?"data:image/svg+xml;base64,":"data:image/png;base64,";
|
1032
|
+
img.src = img.src + Std.string(result.base64);
|
1033
|
+
if(result.height > 0) {
|
1034
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace(this.calculateAlignment(height,baseline),{ fileName : "JsPluginViewer.hx", lineNumber : 498, className : "com.wiris.js.JsPluginViewer", methodName : "callShowimage"});
|
1035
|
+
img.style.verticalAlign = "-" + this.calculateAlignment(result.height,result.baseline) + "px";
|
1036
|
+
img.style.height = "" + Std.string(result.height) + "px";
|
1037
|
+
img.style.width = "" + Std.string(result.width) + "px";
|
1038
|
+
}
|
1039
|
+
img.setAttribute("data-mathml",mml);
|
1040
|
+
img.setAttribute("class","Wirisformula");
|
1041
|
+
img.setAttribute("role","math");
|
1042
|
+
if(result.alt != null) img.alt = result.alt; else {
|
1043
|
+
var accessibility = this.callService(mml,"mathml2accessible");
|
1044
|
+
if(accessibility != null) img.alt = accessibility;
|
1045
|
+
}
|
1046
|
+
}
|
1047
|
+
,callCreateImage: function(mml,img) {
|
1048
|
+
var con;
|
1049
|
+
var height = 0;
|
1050
|
+
var width = 0;
|
1051
|
+
var baseline = 0;
|
1052
|
+
var text = null;
|
1053
|
+
var data;
|
1054
|
+
var url;
|
1055
|
+
con = new js.XMLHttpRequest();
|
1056
|
+
url = (this.absoluteURL.length > 0?this.absoluteURL:this.baseURL + this.localpath) + "/createimage" + this.extension;
|
1057
|
+
data = "metrics=true¢erbaseline=false&mml=" + StringTools.urlEncode(mml);
|
1058
|
+
data += "&lang=" + this.lang;
|
1059
|
+
if(this.zoom != 1) data += "&zoom=" + this.zoom;
|
1060
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Calling: " + url,{ fileName : "JsPluginViewer.hx", lineNumber : 400, className : "com.wiris.js.JsPluginViewer", methodName : "callCreateImage"});
|
1061
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("POST:" + data,{ fileName : "JsPluginViewer.hx", lineNumber : 402, className : "com.wiris.js.JsPluginViewer", methodName : "callCreateImage"});
|
1062
|
+
con.open("POST",url,false);
|
1063
|
+
con.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=utf-8");
|
1064
|
+
con.send(data);
|
1065
|
+
var s = con.responseText;
|
1066
|
+
var i = s.indexOf("?");
|
1067
|
+
if(i >= 0) {
|
1068
|
+
var scaleDpi = 1;
|
1069
|
+
var h = this.queryToParams(HxOverrides.substr(s,i + 1,null));
|
1070
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace(h.get("formula"),{ fileName : "JsPluginViewer.hx", lineNumber : 425, className : "com.wiris.js.JsPluginViewer", methodName : "callCreateImage"});
|
1071
|
+
if(h.exists("dpi")) scaleDpi = this.zoom * (Std.parseInt(h.get("dpi")) / 96);
|
1072
|
+
baseline = Std.parseInt(h.get("cb")) / scaleDpi | 0;
|
1073
|
+
height = Std.parseInt(h.get("ch")) / scaleDpi | 0;
|
1074
|
+
width = Std.parseInt(h.get("cw")) / scaleDpi | 0;
|
1075
|
+
text = h.get("text");
|
1076
|
+
}
|
1077
|
+
img.src = con.responseText;
|
1078
|
+
if(height > 0) {
|
1079
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace(this.calculateAlignment(height,baseline),{ fileName : "JsPluginViewer.hx", lineNumber : 436, className : "com.wiris.js.JsPluginViewer", methodName : "callCreateImage"});
|
1080
|
+
img.style.verticalAlign = "-" + this.calculateAlignment(height,baseline) + "px";
|
1081
|
+
img.style.height = "" + height + "px";
|
1082
|
+
img.style.width = "" + width + "px";
|
1083
|
+
}
|
1084
|
+
img.setAttribute("data-mathml",mml);
|
1085
|
+
img.setAttribute("class","Wirisformula");
|
1086
|
+
img.setAttribute("role","math");
|
1087
|
+
var accessibility = this.callService(mml,"mathml2accessible");
|
1088
|
+
if(accessibility != null) img.alt = accessibility;
|
1089
|
+
}
|
1090
|
+
,calculateAlignment: function(height,baseline) {
|
1091
|
+
var result;
|
1092
|
+
result = 0;
|
1093
|
+
var ALIGN_CONSTANT = 0.5;
|
1094
|
+
if(this._wrs_conf_imageFormat == null) this._wrs_conf_imageFormat = haxe.Json.parse(this.callGetVariableKeys("wirisimageformat")).result.wirisimageformat;
|
1095
|
+
if(this._wrs_conf_imageFormat == "svg") result = height - baseline - ALIGN_CONSTANT; else result = height - baseline;
|
1096
|
+
return result;
|
1097
|
+
}
|
1098
|
+
,getTechnology: function() {
|
1099
|
+
if(HxOverrides.substr(com.wiris.js.JsPluginViewer.TECH,1,null) == "param.js.tech.discover@") {
|
1100
|
+
var con;
|
1101
|
+
con = new js.XMLHttpRequest();
|
1102
|
+
con.open("GET",this.baseURL + "/../tech.txt",false);
|
1103
|
+
con.send(null);
|
1104
|
+
var s = con.responseText;
|
1105
|
+
return StringTools.trim(s.split("#")[0]);
|
1106
|
+
} else return com.wiris.js.JsPluginViewer.TECH;
|
1107
|
+
}
|
1108
|
+
,processMathML: function(mml,container) {
|
1109
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace(mml,{ fileName : "JsPluginViewer.hx", lineNumber : 336, className : "com.wiris.js.JsPluginViewer", methodName : "processMathML"});
|
1110
|
+
var img = js.Lib.document.createElement("img");
|
1111
|
+
if(this.performanceenabled == null) this.performanceenabled = this.isPerformanceEnabled();
|
1112
|
+
if(this.mode == com.wiris.js.JsPluginViewer.USE_CREATE_IMAGE && this.performanceenabled) this.callShowimage(mml,img); 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);
|
1113
|
+
container.appendChild(img);
|
1114
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace(img.src,{ fileName : "JsPluginViewer.hx", lineNumber : 350, className : "com.wiris.js.JsPluginViewer", methodName : "processMathML"});
|
1115
|
+
}
|
1116
|
+
,getMathML_IE7: function(mathNode0) {
|
1117
|
+
var mathml = "";
|
1118
|
+
var mathNode = mathNode0;
|
1119
|
+
while(mathNode != null && mathNode.nodeName != "/MATH") {
|
1120
|
+
if(mathNode.nodeType == 3) mathml += mathNode.nodeValue; else {
|
1121
|
+
var nodeName = mathNode.nodeName.toLowerCase();
|
1122
|
+
if(nodeName.charAt(0) == "/") mathml += "</" + HxOverrides.substr(nodeName,1,null) + ">"; else {
|
1123
|
+
mathml += "<" + nodeName;
|
1124
|
+
var attributes = mathNode.attributes;
|
1125
|
+
var i = 0;
|
1126
|
+
while(i < attributes.length) {
|
1127
|
+
var attribute = attributes[i];
|
1128
|
+
if(attribute.nodeValue != "" && attribute.nodeValue != null && attribute.nodeValue != "inherit") mathml += " " + attribute.nodeName + "=\"" + attribute.nodeValue + "\"";
|
1129
|
+
++i;
|
1130
|
+
}
|
1131
|
+
var counter = 1;
|
1132
|
+
var nextMathNode = mathNode.nextSibling;
|
1133
|
+
while(nextMathNode != null && counter > 0) {
|
1134
|
+
var nextNodeName = nextMathNode.nodeName.toLowerCase();
|
1135
|
+
if(nextNodeName == nodeName) ++counter; else if(nextNodeName == "/" + nodeName) --counter;
|
1136
|
+
nextMathNode = nextMathNode.nextSibling;
|
1137
|
+
}
|
1138
|
+
if(counter > 0) mathml += "/";
|
1139
|
+
mathml += ">";
|
1140
|
+
}
|
1141
|
+
}
|
1142
|
+
var nextMathNode = mathNode.nextSibling;
|
1143
|
+
if(mathNode != mathNode0) mathNode.parentNode.removeChild(mathNode);
|
1144
|
+
mathNode = nextMathNode;
|
1145
|
+
}
|
1146
|
+
if(mathNode.nodeName == "/MATH") mathNode.parentNode.removeChild(mathNode);
|
1147
|
+
mathml += "</math>";
|
1148
|
+
return mathml;
|
1149
|
+
}
|
1150
|
+
,replaceNodes: function(mathNodes,n) {
|
1151
|
+
if(n >= mathNodes.length) return;
|
1152
|
+
var mathNode = mathNodes[n];
|
1153
|
+
var mathml = null;
|
1154
|
+
var browser = new com.wiris.js.JsBrowser();
|
1155
|
+
if(browser.getBrowser() == "Explorer" && (browser.getVersion() == "6" || browser.getVersion() == "7") && navigator.appVersion.indexOf("Trident") == -1) {
|
1156
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Is ie7",{ fileName : "JsPluginViewer.hx", lineNumber : 235, className : "com.wiris.js.JsPluginViewer", methodName : "replaceNodes"});
|
1157
|
+
mathml = this.getMathML_IE7(mathNode);
|
1158
|
+
}
|
1159
|
+
var container = js.Lib.document.createElement("span");
|
1160
|
+
mathNode.parentNode.replaceChild(container,mathNode);
|
1161
|
+
if(mathml == null) {
|
1162
|
+
container.appendChild(mathNode);
|
1163
|
+
mathml = container.innerHTML;
|
1164
|
+
container.removeChild(mathNode);
|
1165
|
+
}
|
1166
|
+
var index = mathml.indexOf("<math");
|
1167
|
+
mathml = HxOverrides.substr(mathml,index,mathml.length - index);
|
1168
|
+
this.processMathML(mathml,container);
|
1169
|
+
var self = this;
|
1170
|
+
haxe.Timer.delay(function() {
|
1171
|
+
self.replaceNodes(mathNodes,n + 1);
|
1172
|
+
},1);
|
1173
|
+
}
|
1174
|
+
,isEditable: function(element) {
|
1175
|
+
while(element != null) {
|
1176
|
+
if(element.contentEditable == "true") return true;
|
1177
|
+
element = element.parentNode;
|
1178
|
+
}
|
1179
|
+
return false;
|
1180
|
+
}
|
1181
|
+
,parseElement: function(element) {
|
1182
|
+
if(!this.ready) throw "Document is not loaded.";
|
1183
|
+
var mathNodes = element.getElementsByTagName("math");
|
1184
|
+
var arr = new Array();
|
1185
|
+
var _g1 = 0, _g = mathNodes.length;
|
1186
|
+
while(_g1 < _g) {
|
1187
|
+
var x = _g1++;
|
1188
|
+
if(!this.isEditable(mathNodes[x])) arr.push(mathNodes[x]);
|
1189
|
+
}
|
1190
|
+
this.replaceNodes(arr,0);
|
1191
|
+
}
|
1192
|
+
,parseDocument: function() {
|
1193
|
+
this.parseElement(js.Lib.document);
|
1194
|
+
}
|
1195
|
+
,doLoad: function() {
|
1196
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("doLoad",{ fileName : "JsPluginViewer.hx", lineNumber : 104, className : "com.wiris.js.JsPluginViewer", methodName : "doLoad"});
|
1197
|
+
this.scriptName = "WIRISplugins.js";
|
1198
|
+
var col;
|
1199
|
+
col = js.Lib.document.getElementsByTagName("script");
|
1200
|
+
var _g1 = 0, _g = col.length;
|
1201
|
+
while(_g1 < _g) {
|
1202
|
+
var i = _g1++;
|
1203
|
+
var d;
|
1204
|
+
var src;
|
1205
|
+
d = col[i];
|
1206
|
+
src = d.src;
|
1207
|
+
var j = src.lastIndexOf(this.scriptName);
|
1208
|
+
if(j >= 0) {
|
1209
|
+
this.baseURL = HxOverrides.substr(src,0,j - 1);
|
1210
|
+
var k = src.indexOf("?",j);
|
1211
|
+
if(k >= 0) {
|
1212
|
+
var query = HxOverrides.substr(src,k + 1,null);
|
1213
|
+
this.params = this.queryToParams(query);
|
1214
|
+
}
|
1215
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace(this.baseURL,{ fileName : "JsPluginViewer.hx", lineNumber : 123, className : "com.wiris.js.JsPluginViewer", methodName : "doLoad"});
|
1216
|
+
}
|
1217
|
+
}
|
1218
|
+
this.tech = this.getTechnology();
|
1219
|
+
if(this.tech == "php") {
|
1220
|
+
this.extension = ".php";
|
1221
|
+
this.localpath = "";
|
1222
|
+
this.absoluteURL = "";
|
1223
|
+
} else if(this.tech == "aspx") {
|
1224
|
+
this.extension = ".aspx";
|
1225
|
+
this.localpath = "";
|
1226
|
+
this.absoluteURL = "";
|
1227
|
+
} else if(this.tech == "local-java") {
|
1228
|
+
this.extension = "";
|
1229
|
+
this.localpath = "/../app";
|
1230
|
+
this.absoluteURL = "";
|
1231
|
+
} else if(this.tech == "nodejs") {
|
1232
|
+
this.extension = "";
|
1233
|
+
this.localpath = "/../integration";
|
1234
|
+
this.absoluteURL = "";
|
1235
|
+
} else if(this.tech == "java") {
|
1236
|
+
this.extension = "";
|
1237
|
+
this.localpath = "";
|
1238
|
+
this.absoluteURL = "";
|
1239
|
+
} else if(this.tech == "ruby") {
|
1240
|
+
this.extension = "";
|
1241
|
+
this.absoluteURL = "/wirispluginengine/integration";
|
1242
|
+
}
|
1243
|
+
this.ready = true;
|
1244
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Tech:" + this.tech,{ fileName : "JsPluginViewer.hx", lineNumber : 154, className : "com.wiris.js.JsPluginViewer", methodName : "doLoad"});
|
1245
|
+
if(this.params.exists("viewer")) this.viewer = this.params.get("viewer");
|
1246
|
+
if(this.params.exists("zoom")) this.zoom = Std.parseFloat(this.params.get("zoom"));
|
1247
|
+
if(this.params.exists("dpi")) this.zoom *= Std.parseFloat(this.params.get("dpi")) / 96;
|
1248
|
+
if(this.params.exists("lang")) this.lang = this.params.get("lang"); else this.lang = "en";
|
1249
|
+
if(this.lang == "inherit") this.lang = js.Lib.document.getElementsByTagName("html")[0].lang;
|
1250
|
+
if(this.viewer == "image") this.parseDocument();
|
1251
|
+
if(com.wiris.js.JsPluginViewer.DEBUG) haxe.Log.trace("Language:" + this.lang,{ fileName : "JsPluginViewer.hx", lineNumber : 185, className : "com.wiris.js.JsPluginViewer", methodName : "doLoad"});
|
1252
|
+
com.wiris.js.JsPluginViewer.instance = this;
|
1253
|
+
com.wiris.js.JsPluginViewer.bypassEncapsulation();
|
1254
|
+
}
|
1255
|
+
,tryReady: function() {
|
1256
|
+
this.ready = false;
|
1257
|
+
if(js.Lib.document.readyState) {
|
1258
|
+
this.doLoad();
|
1259
|
+
this.ready = true;
|
1260
|
+
}
|
1261
|
+
if(!this.ready) haxe.Timer.delay($bind(this,this.tryReady),100);
|
1262
|
+
}
|
1263
|
+
,_wrs_conf_imageFormat: null
|
1264
|
+
,ready: null
|
1265
|
+
,javaServicePath: null
|
1266
|
+
,tech: null
|
1267
|
+
,lang: null
|
1268
|
+
,performanceenabled: null
|
1269
|
+
,viewer: null
|
1270
|
+
,zoom: null
|
1271
|
+
,absoluteURL: null
|
1272
|
+
,localpath: null
|
1273
|
+
,extension: null
|
1274
|
+
,mode: null
|
1275
|
+
,params: null
|
1276
|
+
,scriptName: null
|
1277
|
+
,baseURL: null
|
1278
|
+
,__class__: com.wiris.js.JsPluginViewer
|
1279
|
+
}
|
1280
|
+
var haxe = haxe || {}
|
1281
|
+
haxe.Http = $hxClasses["haxe.Http"] = function(url) {
|
1282
|
+
this.url = url;
|
1283
|
+
this.headers = new Hash();
|
1284
|
+
this.params = new Hash();
|
1285
|
+
this.async = true;
|
1286
|
+
};
|
1287
|
+
haxe.Http.__name__ = ["haxe","Http"];
|
1288
|
+
haxe.Http.requestUrl = function(url) {
|
1289
|
+
var h = new haxe.Http(url);
|
1290
|
+
h.async = false;
|
1291
|
+
var r = null;
|
1292
|
+
h.onData = function(d) {
|
1293
|
+
r = d;
|
1294
|
+
};
|
1295
|
+
h.onError = function(e) {
|
1296
|
+
throw e;
|
1297
|
+
};
|
1298
|
+
h.request(false);
|
1299
|
+
return r;
|
1300
|
+
}
|
1301
|
+
haxe.Http.prototype = {
|
1302
|
+
onStatus: function(status) {
|
1303
|
+
}
|
1304
|
+
,onError: function(msg) {
|
1305
|
+
}
|
1306
|
+
,onData: function(data) {
|
1307
|
+
}
|
1308
|
+
,request: function(post) {
|
1309
|
+
var me = this;
|
1310
|
+
var r = new js.XMLHttpRequest();
|
1311
|
+
var onreadystatechange = function() {
|
1312
|
+
if(r.readyState != 4) return;
|
1313
|
+
var s = (function($this) {
|
1314
|
+
var $r;
|
1315
|
+
try {
|
1316
|
+
$r = r.status;
|
1317
|
+
} catch( e ) {
|
1318
|
+
$r = null;
|
1319
|
+
}
|
1320
|
+
return $r;
|
1321
|
+
}(this));
|
1322
|
+
if(s == undefined) s = null;
|
1323
|
+
if(s != null) me.onStatus(s);
|
1324
|
+
if(s != null && s >= 200 && s < 400) me.onData(r.responseText); else switch(s) {
|
1325
|
+
case null: case undefined:
|
1326
|
+
me.onError("Failed to connect or resolve host");
|
1327
|
+
break;
|
1328
|
+
case 12029:
|
1329
|
+
me.onError("Failed to connect to host");
|
1330
|
+
break;
|
1331
|
+
case 12007:
|
1332
|
+
me.onError("Unknown host");
|
1333
|
+
break;
|
1334
|
+
default:
|
1335
|
+
me.onError("Http Error #" + r.status);
|
1336
|
+
}
|
1337
|
+
};
|
1338
|
+
if(this.async) r.onreadystatechange = onreadystatechange;
|
1339
|
+
var uri = this.postData;
|
1340
|
+
if(uri != null) post = true; else {
|
1341
|
+
var $it0 = this.params.keys();
|
1342
|
+
while( $it0.hasNext() ) {
|
1343
|
+
var p = $it0.next();
|
1344
|
+
if(uri == null) uri = ""; else uri += "&";
|
1345
|
+
uri += StringTools.urlEncode(p) + "=" + StringTools.urlEncode(this.params.get(p));
|
1346
|
+
}
|
1347
|
+
}
|
1348
|
+
try {
|
1349
|
+
if(post) r.open("POST",this.url,this.async); else if(uri != null) {
|
1350
|
+
var question = this.url.split("?").length <= 1;
|
1351
|
+
r.open("GET",this.url + (question?"?":"&") + uri,this.async);
|
1352
|
+
uri = null;
|
1353
|
+
} else r.open("GET",this.url,this.async);
|
1354
|
+
} catch( e ) {
|
1355
|
+
this.onError(e.toString());
|
1356
|
+
return;
|
1357
|
+
}
|
1358
|
+
if(this.headers.get("Content-Type") == null && post && this.postData == null) r.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
|
1359
|
+
var $it1 = this.headers.keys();
|
1360
|
+
while( $it1.hasNext() ) {
|
1361
|
+
var h = $it1.next();
|
1362
|
+
r.setRequestHeader(h,this.headers.get(h));
|
1363
|
+
}
|
1364
|
+
r.send(uri);
|
1365
|
+
if(!this.async) onreadystatechange();
|
1366
|
+
}
|
1367
|
+
,setPostData: function(data) {
|
1368
|
+
this.postData = data;
|
1369
|
+
}
|
1370
|
+
,setParameter: function(param,value) {
|
1371
|
+
this.params.set(param,value);
|
1372
|
+
}
|
1373
|
+
,setHeader: function(header,value) {
|
1374
|
+
this.headers.set(header,value);
|
1375
|
+
}
|
1376
|
+
,params: null
|
1377
|
+
,headers: null
|
1378
|
+
,postData: null
|
1379
|
+
,async: null
|
1380
|
+
,url: null
|
1381
|
+
,__class__: haxe.Http
|
1382
|
+
}
|
1383
|
+
haxe.Json = $hxClasses["haxe.Json"] = function() {
|
1384
|
+
};
|
1385
|
+
haxe.Json.__name__ = ["haxe","Json"];
|
1386
|
+
haxe.Json.parse = function(text) {
|
1387
|
+
return new haxe.Json().doParse(text);
|
1388
|
+
}
|
1389
|
+
haxe.Json.stringify = function(value) {
|
1390
|
+
return new haxe.Json().toString(value);
|
1391
|
+
}
|
1392
|
+
haxe.Json.prototype = {
|
1393
|
+
parseString: function() {
|
1394
|
+
var start = this.pos;
|
1395
|
+
var buf = new StringBuf();
|
1396
|
+
while(true) {
|
1397
|
+
var c = this.str.charCodeAt(this.pos++);
|
1398
|
+
if(c == 34) break;
|
1399
|
+
if(c == 92) {
|
1400
|
+
buf.b += HxOverrides.substr(this.str,start,this.pos - start - 1);
|
1401
|
+
c = this.str.charCodeAt(this.pos++);
|
1402
|
+
switch(c) {
|
1403
|
+
case 114:
|
1404
|
+
buf.b += String.fromCharCode(13);
|
1405
|
+
break;
|
1406
|
+
case 110:
|
1407
|
+
buf.b += String.fromCharCode(10);
|
1408
|
+
break;
|
1409
|
+
case 116:
|
1410
|
+
buf.b += String.fromCharCode(9);
|
1411
|
+
break;
|
1412
|
+
case 98:
|
1413
|
+
buf.b += String.fromCharCode(8);
|
1414
|
+
break;
|
1415
|
+
case 102:
|
1416
|
+
buf.b += String.fromCharCode(12);
|
1417
|
+
break;
|
1418
|
+
case 47:case 92:case 34:
|
1419
|
+
buf.b += String.fromCharCode(c);
|
1420
|
+
break;
|
1421
|
+
case 117:
|
1422
|
+
var uc = Std.parseInt("0x" + HxOverrides.substr(this.str,this.pos,4));
|
1423
|
+
this.pos += 4;
|
1424
|
+
buf.b += String.fromCharCode(uc);
|
1425
|
+
break;
|
1426
|
+
default:
|
1427
|
+
throw "Invalid escape sequence \\" + String.fromCharCode(c) + " at position " + (this.pos - 1);
|
1428
|
+
}
|
1429
|
+
start = this.pos;
|
1430
|
+
} else if(c != c) throw "Unclosed string";
|
1431
|
+
}
|
1432
|
+
buf.b += HxOverrides.substr(this.str,start,this.pos - start - 1);
|
1433
|
+
return buf.b;
|
1434
|
+
}
|
1435
|
+
,parseRec: function() {
|
1436
|
+
while(true) {
|
1437
|
+
var c = this.str.charCodeAt(this.pos++);
|
1438
|
+
switch(c) {
|
1439
|
+
case 32:case 13:case 10:case 9:
|
1440
|
+
break;
|
1441
|
+
case 123:
|
1442
|
+
var obj = { }, field = null, comma = null;
|
1443
|
+
while(true) {
|
1444
|
+
var c1 = this.str.charCodeAt(this.pos++);
|
1445
|
+
switch(c1) {
|
1446
|
+
case 32:case 13:case 10:case 9:
|
1447
|
+
break;
|
1448
|
+
case 125:
|
1449
|
+
if(field != null || comma == false) this.invalidChar();
|
1450
|
+
return obj;
|
1451
|
+
case 58:
|
1452
|
+
if(field == null) this.invalidChar();
|
1453
|
+
obj[field] = this.parseRec();
|
1454
|
+
field = null;
|
1455
|
+
comma = true;
|
1456
|
+
break;
|
1457
|
+
case 44:
|
1458
|
+
if(comma) comma = false; else this.invalidChar();
|
1459
|
+
break;
|
1460
|
+
case 34:
|
1461
|
+
if(comma) this.invalidChar();
|
1462
|
+
field = this.parseString();
|
1463
|
+
break;
|
1464
|
+
default:
|
1465
|
+
this.invalidChar();
|
1466
|
+
}
|
1467
|
+
}
|
1468
|
+
break;
|
1469
|
+
case 91:
|
1470
|
+
var arr = [], comma = null;
|
1471
|
+
while(true) {
|
1472
|
+
var c1 = this.str.charCodeAt(this.pos++);
|
1473
|
+
switch(c1) {
|
1474
|
+
case 32:case 13:case 10:case 9:
|
1475
|
+
break;
|
1476
|
+
case 93:
|
1477
|
+
if(comma == false) this.invalidChar();
|
1478
|
+
return arr;
|
1479
|
+
case 44:
|
1480
|
+
if(comma) comma = false; else this.invalidChar();
|
1481
|
+
break;
|
1482
|
+
default:
|
1483
|
+
if(comma) this.invalidChar();
|
1484
|
+
this.pos--;
|
1485
|
+
arr.push(this.parseRec());
|
1486
|
+
comma = true;
|
1487
|
+
}
|
1488
|
+
}
|
1489
|
+
break;
|
1490
|
+
case 116:
|
1491
|
+
var save = this.pos;
|
1492
|
+
if(this.str.charCodeAt(this.pos++) != 114 || this.str.charCodeAt(this.pos++) != 117 || this.str.charCodeAt(this.pos++) != 101) {
|
1493
|
+
this.pos = save;
|
1494
|
+
this.invalidChar();
|
1495
|
+
}
|
1496
|
+
return true;
|
1497
|
+
case 102:
|
1498
|
+
var save = this.pos;
|
1499
|
+
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) {
|
1500
|
+
this.pos = save;
|
1501
|
+
this.invalidChar();
|
1502
|
+
}
|
1503
|
+
return false;
|
1504
|
+
case 110:
|
1505
|
+
var save = this.pos;
|
1506
|
+
if(this.str.charCodeAt(this.pos++) != 117 || this.str.charCodeAt(this.pos++) != 108 || this.str.charCodeAt(this.pos++) != 108) {
|
1507
|
+
this.pos = save;
|
1508
|
+
this.invalidChar();
|
1509
|
+
}
|
1510
|
+
return null;
|
1511
|
+
case 34:
|
1512
|
+
return this.parseString();
|
1513
|
+
case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 45:
|
1514
|
+
this.pos--;
|
1515
|
+
if(!this.reg_float.match(HxOverrides.substr(this.str,this.pos,null))) throw "Invalid float at position " + this.pos;
|
1516
|
+
var v = this.reg_float.matched(0);
|
1517
|
+
this.pos += v.length;
|
1518
|
+
var f = Std.parseFloat(v);
|
1519
|
+
var i = f | 0;
|
1520
|
+
return i == f?i:f;
|
1521
|
+
default:
|
1522
|
+
this.invalidChar();
|
1523
|
+
}
|
1524
|
+
}
|
1525
|
+
}
|
1526
|
+
,nextChar: function() {
|
1527
|
+
return this.str.charCodeAt(this.pos++);
|
1528
|
+
}
|
1529
|
+
,invalidChar: function() {
|
1530
|
+
this.pos--;
|
1531
|
+
throw "Invalid char " + this.str.charCodeAt(this.pos) + " at position " + this.pos;
|
1532
|
+
}
|
1533
|
+
,doParse: function(str) {
|
1534
|
+
this.reg_float = new EReg("^-?(0|[1-9][0-9]*)(\\.[0-9]+)?([eE][+-]?[0-9]+)?","");
|
1535
|
+
this.str = str;
|
1536
|
+
this.pos = 0;
|
1537
|
+
return this.parseRec();
|
1538
|
+
}
|
1539
|
+
,quote: function(s) {
|
1540
|
+
this.buf.b += Std.string("\"");
|
1541
|
+
var i = 0;
|
1542
|
+
while(true) {
|
1543
|
+
var c = s.charCodeAt(i++);
|
1544
|
+
if(c != c) break;
|
1545
|
+
switch(c) {
|
1546
|
+
case 34:
|
1547
|
+
this.buf.b += Std.string("\\\"");
|
1548
|
+
break;
|
1549
|
+
case 92:
|
1550
|
+
this.buf.b += Std.string("\\\\");
|
1551
|
+
break;
|
1552
|
+
case 10:
|
1553
|
+
this.buf.b += Std.string("\\n");
|
1554
|
+
break;
|
1555
|
+
case 13:
|
1556
|
+
this.buf.b += Std.string("\\r");
|
1557
|
+
break;
|
1558
|
+
case 9:
|
1559
|
+
this.buf.b += Std.string("\\t");
|
1560
|
+
break;
|
1561
|
+
case 8:
|
1562
|
+
this.buf.b += Std.string("\\b");
|
1563
|
+
break;
|
1564
|
+
case 12:
|
1565
|
+
this.buf.b += Std.string("\\f");
|
1566
|
+
break;
|
1567
|
+
default:
|
1568
|
+
this.buf.b += String.fromCharCode(c);
|
1569
|
+
}
|
1570
|
+
}
|
1571
|
+
this.buf.b += Std.string("\"");
|
1572
|
+
}
|
1573
|
+
,toStringRec: function(v) {
|
1574
|
+
var $e = (Type["typeof"](v));
|
1575
|
+
switch( $e[1] ) {
|
1576
|
+
case 8:
|
1577
|
+
this.buf.b += Std.string("\"???\"");
|
1578
|
+
break;
|
1579
|
+
case 4:
|
1580
|
+
this.objString(v);
|
1581
|
+
break;
|
1582
|
+
case 1:
|
1583
|
+
case 2:
|
1584
|
+
this.buf.b += Std.string(v);
|
1585
|
+
break;
|
1586
|
+
case 5:
|
1587
|
+
this.buf.b += Std.string("\"<fun>\"");
|
1588
|
+
break;
|
1589
|
+
case 6:
|
1590
|
+
var c = $e[2];
|
1591
|
+
if(c == String) this.quote(v); else if(c == Array) {
|
1592
|
+
var v1 = v;
|
1593
|
+
this.buf.b += Std.string("[");
|
1594
|
+
var len = v1.length;
|
1595
|
+
if(len > 0) {
|
1596
|
+
this.toStringRec(v1[0]);
|
1597
|
+
var i = 1;
|
1598
|
+
while(i < len) {
|
1599
|
+
this.buf.b += Std.string(",");
|
1600
|
+
this.toStringRec(v1[i++]);
|
1601
|
+
}
|
1602
|
+
}
|
1603
|
+
this.buf.b += Std.string("]");
|
1604
|
+
} else if(c == Hash) {
|
1605
|
+
var v1 = v;
|
1606
|
+
var o = { };
|
1607
|
+
var $it0 = v1.keys();
|
1608
|
+
while( $it0.hasNext() ) {
|
1609
|
+
var k = $it0.next();
|
1610
|
+
o[k] = v1.get(k);
|
1611
|
+
}
|
1612
|
+
this.objString(o);
|
1613
|
+
} else this.objString(v);
|
1614
|
+
break;
|
1615
|
+
case 7:
|
1616
|
+
var e = $e[2];
|
1617
|
+
this.buf.b += Std.string(v[1]);
|
1618
|
+
break;
|
1619
|
+
case 3:
|
1620
|
+
this.buf.b += Std.string(v?"true":"false");
|
1621
|
+
break;
|
1622
|
+
case 0:
|
1623
|
+
this.buf.b += Std.string("null");
|
1624
|
+
break;
|
1625
|
+
}
|
1626
|
+
}
|
1627
|
+
,objString: function(v) {
|
1628
|
+
this.fieldsString(v,Reflect.fields(v));
|
1629
|
+
}
|
1630
|
+
,fieldsString: function(v,fields) {
|
1631
|
+
var first = true;
|
1632
|
+
this.buf.b += Std.string("{");
|
1633
|
+
var _g = 0;
|
1634
|
+
while(_g < fields.length) {
|
1635
|
+
var f = fields[_g];
|
1636
|
+
++_g;
|
1637
|
+
var value = Reflect.field(v,f);
|
1638
|
+
if(Reflect.isFunction(value)) continue;
|
1639
|
+
if(first) first = false; else this.buf.b += Std.string(",");
|
1640
|
+
this.quote(f);
|
1641
|
+
this.buf.b += Std.string(":");
|
1642
|
+
this.toStringRec(value);
|
1643
|
+
}
|
1644
|
+
this.buf.b += Std.string("}");
|
1645
|
+
}
|
1646
|
+
,toString: function(v) {
|
1647
|
+
this.buf = new StringBuf();
|
1648
|
+
this.toStringRec(v);
|
1649
|
+
return this.buf.b;
|
1650
|
+
}
|
1651
|
+
,reg_float: null
|
1652
|
+
,pos: null
|
1653
|
+
,str: null
|
1654
|
+
,buf: null
|
1655
|
+
,__class__: haxe.Json
|
1656
|
+
}
|
1657
|
+
haxe.Log = $hxClasses["haxe.Log"] = function() { }
|
1658
|
+
haxe.Log.__name__ = ["haxe","Log"];
|
1659
|
+
haxe.Log.trace = function(v,infos) {
|
1660
|
+
js.Boot.__trace(v,infos);
|
1661
|
+
}
|
1662
|
+
haxe.Log.clear = function() {
|
1663
|
+
js.Boot.__clear_trace();
|
1664
|
+
}
|
1665
|
+
haxe.Md5 = $hxClasses["haxe.Md5"] = function() {
|
1666
|
+
};
|
1667
|
+
haxe.Md5.__name__ = ["haxe","Md5"];
|
1668
|
+
haxe.Md5.encode = function(s) {
|
1669
|
+
return new haxe.Md5().doEncode(s);
|
1670
|
+
}
|
1671
|
+
haxe.Md5.prototype = {
|
1672
|
+
doEncode: function(str) {
|
1673
|
+
var x = this.str2blks(str);
|
1674
|
+
var a = 1732584193;
|
1675
|
+
var b = -271733879;
|
1676
|
+
var c = -1732584194;
|
1677
|
+
var d = 271733878;
|
1678
|
+
var step;
|
1679
|
+
var i = 0;
|
1680
|
+
while(i < x.length) {
|
1681
|
+
var olda = a;
|
1682
|
+
var oldb = b;
|
1683
|
+
var oldc = c;
|
1684
|
+
var oldd = d;
|
1685
|
+
step = 0;
|
1686
|
+
a = this.ff(a,b,c,d,x[i],7,-680876936);
|
1687
|
+
d = this.ff(d,a,b,c,x[i + 1],12,-389564586);
|
1688
|
+
c = this.ff(c,d,a,b,x[i + 2],17,606105819);
|
1689
|
+
b = this.ff(b,c,d,a,x[i + 3],22,-1044525330);
|
1690
|
+
a = this.ff(a,b,c,d,x[i + 4],7,-176418897);
|
1691
|
+
d = this.ff(d,a,b,c,x[i + 5],12,1200080426);
|
1692
|
+
c = this.ff(c,d,a,b,x[i + 6],17,-1473231341);
|
1693
|
+
b = this.ff(b,c,d,a,x[i + 7],22,-45705983);
|
1694
|
+
a = this.ff(a,b,c,d,x[i + 8],7,1770035416);
|
1695
|
+
d = this.ff(d,a,b,c,x[i + 9],12,-1958414417);
|
1696
|
+
c = this.ff(c,d,a,b,x[i + 10],17,-42063);
|
1697
|
+
b = this.ff(b,c,d,a,x[i + 11],22,-1990404162);
|
1698
|
+
a = this.ff(a,b,c,d,x[i + 12],7,1804603682);
|
1699
|
+
d = this.ff(d,a,b,c,x[i + 13],12,-40341101);
|
1700
|
+
c = this.ff(c,d,a,b,x[i + 14],17,-1502002290);
|
1701
|
+
b = this.ff(b,c,d,a,x[i + 15],22,1236535329);
|
1702
|
+
a = this.gg(a,b,c,d,x[i + 1],5,-165796510);
|
1703
|
+
d = this.gg(d,a,b,c,x[i + 6],9,-1069501632);
|
1704
|
+
c = this.gg(c,d,a,b,x[i + 11],14,643717713);
|
1705
|
+
b = this.gg(b,c,d,a,x[i],20,-373897302);
|
1706
|
+
a = this.gg(a,b,c,d,x[i + 5],5,-701558691);
|
1707
|
+
d = this.gg(d,a,b,c,x[i + 10],9,38016083);
|
1708
|
+
c = this.gg(c,d,a,b,x[i + 15],14,-660478335);
|
1709
|
+
b = this.gg(b,c,d,a,x[i + 4],20,-405537848);
|
1710
|
+
a = this.gg(a,b,c,d,x[i + 9],5,568446438);
|
1711
|
+
d = this.gg(d,a,b,c,x[i + 14],9,-1019803690);
|
1712
|
+
c = this.gg(c,d,a,b,x[i + 3],14,-187363961);
|
1713
|
+
b = this.gg(b,c,d,a,x[i + 8],20,1163531501);
|
1714
|
+
a = this.gg(a,b,c,d,x[i + 13],5,-1444681467);
|
1715
|
+
d = this.gg(d,a,b,c,x[i + 2],9,-51403784);
|
1716
|
+
c = this.gg(c,d,a,b,x[i + 7],14,1735328473);
|
1717
|
+
b = this.gg(b,c,d,a,x[i + 12],20,-1926607734);
|
1718
|
+
a = this.hh(a,b,c,d,x[i + 5],4,-378558);
|
1719
|
+
d = this.hh(d,a,b,c,x[i + 8],11,-2022574463);
|
1720
|
+
c = this.hh(c,d,a,b,x[i + 11],16,1839030562);
|
1721
|
+
b = this.hh(b,c,d,a,x[i + 14],23,-35309556);
|
1722
|
+
a = this.hh(a,b,c,d,x[i + 1],4,-1530992060);
|
1723
|
+
d = this.hh(d,a,b,c,x[i + 4],11,1272893353);
|
1724
|
+
c = this.hh(c,d,a,b,x[i + 7],16,-155497632);
|
1725
|
+
b = this.hh(b,c,d,a,x[i + 10],23,-1094730640);
|
1726
|
+
a = this.hh(a,b,c,d,x[i + 13],4,681279174);
|
1727
|
+
d = this.hh(d,a,b,c,x[i],11,-358537222);
|
1728
|
+
c = this.hh(c,d,a,b,x[i + 3],16,-722521979);
|
1729
|
+
b = this.hh(b,c,d,a,x[i + 6],23,76029189);
|
1730
|
+
a = this.hh(a,b,c,d,x[i + 9],4,-640364487);
|
1731
|
+
d = this.hh(d,a,b,c,x[i + 12],11,-421815835);
|
1732
|
+
c = this.hh(c,d,a,b,x[i + 15],16,530742520);
|
1733
|
+
b = this.hh(b,c,d,a,x[i + 2],23,-995338651);
|
1734
|
+
a = this.ii(a,b,c,d,x[i],6,-198630844);
|
1735
|
+
d = this.ii(d,a,b,c,x[i + 7],10,1126891415);
|
1736
|
+
c = this.ii(c,d,a,b,x[i + 14],15,-1416354905);
|
1737
|
+
b = this.ii(b,c,d,a,x[i + 5],21,-57434055);
|
1738
|
+
a = this.ii(a,b,c,d,x[i + 12],6,1700485571);
|
1739
|
+
d = this.ii(d,a,b,c,x[i + 3],10,-1894986606);
|
1740
|
+
c = this.ii(c,d,a,b,x[i + 10],15,-1051523);
|
1741
|
+
b = this.ii(b,c,d,a,x[i + 1],21,-2054922799);
|
1742
|
+
a = this.ii(a,b,c,d,x[i + 8],6,1873313359);
|
1743
|
+
d = this.ii(d,a,b,c,x[i + 15],10,-30611744);
|
1744
|
+
c = this.ii(c,d,a,b,x[i + 6],15,-1560198380);
|
1745
|
+
b = this.ii(b,c,d,a,x[i + 13],21,1309151649);
|
1746
|
+
a = this.ii(a,b,c,d,x[i + 4],6,-145523070);
|
1747
|
+
d = this.ii(d,a,b,c,x[i + 11],10,-1120210379);
|
1748
|
+
c = this.ii(c,d,a,b,x[i + 2],15,718787259);
|
1749
|
+
b = this.ii(b,c,d,a,x[i + 9],21,-343485551);
|
1750
|
+
a = this.addme(a,olda);
|
1751
|
+
b = this.addme(b,oldb);
|
1752
|
+
c = this.addme(c,oldc);
|
1753
|
+
d = this.addme(d,oldd);
|
1754
|
+
i += 16;
|
1755
|
+
}
|
1756
|
+
return this.rhex(a) + this.rhex(b) + this.rhex(c) + this.rhex(d);
|
1757
|
+
}
|
1758
|
+
,ii: function(a,b,c,d,x,s,t) {
|
1759
|
+
return this.cmn(this.bitXOR(c,this.bitOR(b,~d)),a,b,x,s,t);
|
1760
|
+
}
|
1761
|
+
,hh: function(a,b,c,d,x,s,t) {
|
1762
|
+
return this.cmn(this.bitXOR(this.bitXOR(b,c),d),a,b,x,s,t);
|
1763
|
+
}
|
1764
|
+
,gg: function(a,b,c,d,x,s,t) {
|
1765
|
+
return this.cmn(this.bitOR(this.bitAND(b,d),this.bitAND(c,~d)),a,b,x,s,t);
|
1766
|
+
}
|
1767
|
+
,ff: function(a,b,c,d,x,s,t) {
|
1768
|
+
return this.cmn(this.bitOR(this.bitAND(b,c),this.bitAND(~b,d)),a,b,x,s,t);
|
1769
|
+
}
|
1770
|
+
,cmn: function(q,a,b,x,s,t) {
|
1771
|
+
return this.addme(this.rol(this.addme(this.addme(a,q),this.addme(x,t)),s),b);
|
1772
|
+
}
|
1773
|
+
,rol: function(num,cnt) {
|
1774
|
+
return num << cnt | num >>> 32 - cnt;
|
1775
|
+
}
|
1776
|
+
,str2blks: function(str) {
|
1777
|
+
var nblk = (str.length + 8 >> 6) + 1;
|
1778
|
+
var blks = new Array();
|
1779
|
+
var _g1 = 0, _g = nblk * 16;
|
1780
|
+
while(_g1 < _g) {
|
1781
|
+
var i = _g1++;
|
1782
|
+
blks[i] = 0;
|
1783
|
+
}
|
1784
|
+
var i = 0;
|
1785
|
+
while(i < str.length) {
|
1786
|
+
blks[i >> 2] |= HxOverrides.cca(str,i) << (str.length * 8 + i) % 4 * 8;
|
1787
|
+
i++;
|
1788
|
+
}
|
1789
|
+
blks[i >> 2] |= 128 << (str.length * 8 + i) % 4 * 8;
|
1790
|
+
var l = str.length * 8;
|
1791
|
+
var k = nblk * 16 - 2;
|
1792
|
+
blks[k] = l & 255;
|
1793
|
+
blks[k] |= (l >>> 8 & 255) << 8;
|
1794
|
+
blks[k] |= (l >>> 16 & 255) << 16;
|
1795
|
+
blks[k] |= (l >>> 24 & 255) << 24;
|
1796
|
+
return blks;
|
1797
|
+
}
|
1798
|
+
,rhex: function(num) {
|
1799
|
+
var str = "";
|
1800
|
+
var hex_chr = "0123456789abcdef";
|
1801
|
+
var _g = 0;
|
1802
|
+
while(_g < 4) {
|
1803
|
+
var j = _g++;
|
1804
|
+
str += hex_chr.charAt(num >> j * 8 + 4 & 15) + hex_chr.charAt(num >> j * 8 & 15);
|
1805
|
+
}
|
1806
|
+
return str;
|
1807
|
+
}
|
1808
|
+
,addme: function(x,y) {
|
1809
|
+
var lsw = (x & 65535) + (y & 65535);
|
1810
|
+
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
1811
|
+
return msw << 16 | lsw & 65535;
|
1812
|
+
}
|
1813
|
+
,bitAND: function(a,b) {
|
1814
|
+
var lsb = a & 1 & (b & 1);
|
1815
|
+
var msb31 = a >>> 1 & b >>> 1;
|
1816
|
+
return msb31 << 1 | lsb;
|
1817
|
+
}
|
1818
|
+
,bitXOR: function(a,b) {
|
1819
|
+
var lsb = a & 1 ^ b & 1;
|
1820
|
+
var msb31 = a >>> 1 ^ b >>> 1;
|
1821
|
+
return msb31 << 1 | lsb;
|
1822
|
+
}
|
1823
|
+
,bitOR: function(a,b) {
|
1824
|
+
var lsb = a & 1 | b & 1;
|
1825
|
+
var msb31 = a >>> 1 | b >>> 1;
|
1826
|
+
return msb31 << 1 | lsb;
|
1827
|
+
}
|
1828
|
+
,__class__: haxe.Md5
|
1829
|
+
}
|
1830
|
+
haxe.Serializer = $hxClasses["haxe.Serializer"] = function() {
|
1831
|
+
this.buf = new StringBuf();
|
1832
|
+
this.cache = new Array();
|
1833
|
+
this.useCache = haxe.Serializer.USE_CACHE;
|
1834
|
+
this.useEnumIndex = haxe.Serializer.USE_ENUM_INDEX;
|
1835
|
+
this.shash = new Hash();
|
1836
|
+
this.scount = 0;
|
1837
|
+
};
|
1838
|
+
haxe.Serializer.__name__ = ["haxe","Serializer"];
|
1839
|
+
haxe.Serializer.run = function(v) {
|
1840
|
+
var s = new haxe.Serializer();
|
1841
|
+
s.serialize(v);
|
1842
|
+
return s.toString();
|
1843
|
+
}
|
1844
|
+
haxe.Serializer.prototype = {
|
1845
|
+
serializeException: function(e) {
|
1846
|
+
this.buf.b += Std.string("x");
|
1847
|
+
this.serialize(e);
|
1848
|
+
}
|
1849
|
+
,serialize: function(v) {
|
1850
|
+
var $e = (Type["typeof"](v));
|
1851
|
+
switch( $e[1] ) {
|
1852
|
+
case 0:
|
1853
|
+
this.buf.b += Std.string("n");
|
1854
|
+
break;
|
1855
|
+
case 1:
|
1856
|
+
if(v == 0) {
|
1857
|
+
this.buf.b += Std.string("z");
|
1858
|
+
return;
|
1859
|
+
}
|
1860
|
+
this.buf.b += Std.string("i");
|
1861
|
+
this.buf.b += Std.string(v);
|
1862
|
+
break;
|
1863
|
+
case 2:
|
1864
|
+
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 {
|
1865
|
+
this.buf.b += Std.string("d");
|
1866
|
+
this.buf.b += Std.string(v);
|
1867
|
+
}
|
1868
|
+
break;
|
1869
|
+
case 3:
|
1870
|
+
this.buf.b += Std.string(v?"t":"f");
|
1871
|
+
break;
|
1872
|
+
case 6:
|
1873
|
+
var c = $e[2];
|
1874
|
+
if(c == String) {
|
1875
|
+
this.serializeString(v);
|
1876
|
+
return;
|
1877
|
+
}
|
1878
|
+
if(this.useCache && this.serializeRef(v)) return;
|
1879
|
+
switch(c) {
|
1880
|
+
case Array:
|
1881
|
+
var ucount = 0;
|
1882
|
+
this.buf.b += Std.string("a");
|
1883
|
+
var l = v.length;
|
1884
|
+
var _g = 0;
|
1885
|
+
while(_g < l) {
|
1886
|
+
var i = _g++;
|
1887
|
+
if(v[i] == null) ucount++; else {
|
1888
|
+
if(ucount > 0) {
|
1889
|
+
if(ucount == 1) this.buf.b += Std.string("n"); else {
|
1890
|
+
this.buf.b += Std.string("u");
|
1891
|
+
this.buf.b += Std.string(ucount);
|
1892
|
+
}
|
1893
|
+
ucount = 0;
|
1894
|
+
}
|
1895
|
+
this.serialize(v[i]);
|
1896
|
+
}
|
1897
|
+
}
|
1898
|
+
if(ucount > 0) {
|
1899
|
+
if(ucount == 1) this.buf.b += Std.string("n"); else {
|
1900
|
+
this.buf.b += Std.string("u");
|
1901
|
+
this.buf.b += Std.string(ucount);
|
1902
|
+
}
|
1903
|
+
}
|
1904
|
+
this.buf.b += Std.string("h");
|
1905
|
+
break;
|
1906
|
+
case List:
|
1907
|
+
this.buf.b += Std.string("l");
|
1908
|
+
var v1 = v;
|
1909
|
+
var $it0 = v1.iterator();
|
1910
|
+
while( $it0.hasNext() ) {
|
1911
|
+
var i = $it0.next();
|
1912
|
+
this.serialize(i);
|
1913
|
+
}
|
1914
|
+
this.buf.b += Std.string("h");
|
1915
|
+
break;
|
1916
|
+
case Date:
|
1917
|
+
var d = v;
|
1918
|
+
this.buf.b += Std.string("v");
|
1919
|
+
this.buf.b += Std.string(HxOverrides.dateStr(d));
|
1920
|
+
break;
|
1921
|
+
case Hash:
|
1922
|
+
this.buf.b += Std.string("b");
|
1923
|
+
var v1 = v;
|
1924
|
+
var $it1 = v1.keys();
|
1925
|
+
while( $it1.hasNext() ) {
|
1926
|
+
var k = $it1.next();
|
1927
|
+
this.serializeString(k);
|
1928
|
+
this.serialize(v1.get(k));
|
1929
|
+
}
|
1930
|
+
this.buf.b += Std.string("h");
|
1931
|
+
break;
|
1932
|
+
case IntHash:
|
1933
|
+
this.buf.b += Std.string("q");
|
1934
|
+
var v1 = v;
|
1935
|
+
var $it2 = v1.keys();
|
1936
|
+
while( $it2.hasNext() ) {
|
1937
|
+
var k = $it2.next();
|
1938
|
+
this.buf.b += Std.string(":");
|
1939
|
+
this.buf.b += Std.string(k);
|
1940
|
+
this.serialize(v1.get(k));
|
1941
|
+
}
|
1942
|
+
this.buf.b += Std.string("h");
|
1943
|
+
break;
|
1944
|
+
case haxe.io.Bytes:
|
1945
|
+
var v1 = v;
|
1946
|
+
var i = 0;
|
1947
|
+
var max = v1.length - 2;
|
1948
|
+
var charsBuf = new StringBuf();
|
1949
|
+
var b64 = haxe.Serializer.BASE64;
|
1950
|
+
while(i < max) {
|
1951
|
+
var b1 = v1.b[i++];
|
1952
|
+
var b2 = v1.b[i++];
|
1953
|
+
var b3 = v1.b[i++];
|
1954
|
+
charsBuf.b += Std.string(b64.charAt(b1 >> 2));
|
1955
|
+
charsBuf.b += Std.string(b64.charAt((b1 << 4 | b2 >> 4) & 63));
|
1956
|
+
charsBuf.b += Std.string(b64.charAt((b2 << 2 | b3 >> 6) & 63));
|
1957
|
+
charsBuf.b += Std.string(b64.charAt(b3 & 63));
|
1958
|
+
}
|
1959
|
+
if(i == max) {
|
1960
|
+
var b1 = v1.b[i++];
|
1961
|
+
var b2 = v1.b[i++];
|
1962
|
+
charsBuf.b += Std.string(b64.charAt(b1 >> 2));
|
1963
|
+
charsBuf.b += Std.string(b64.charAt((b1 << 4 | b2 >> 4) & 63));
|
1964
|
+
charsBuf.b += Std.string(b64.charAt(b2 << 2 & 63));
|
1965
|
+
} else if(i == max + 1) {
|
1966
|
+
var b1 = v1.b[i++];
|
1967
|
+
charsBuf.b += Std.string(b64.charAt(b1 >> 2));
|
1968
|
+
charsBuf.b += Std.string(b64.charAt(b1 << 4 & 63));
|
1969
|
+
}
|
1970
|
+
var chars = charsBuf.b;
|
1971
|
+
this.buf.b += Std.string("s");
|
1972
|
+
this.buf.b += Std.string(chars.length);
|
1973
|
+
this.buf.b += Std.string(":");
|
1974
|
+
this.buf.b += Std.string(chars);
|
1975
|
+
break;
|
1976
|
+
default:
|
1977
|
+
this.cache.pop();
|
1978
|
+
if(v.hxSerialize != null) {
|
1979
|
+
this.buf.b += Std.string("C");
|
1980
|
+
this.serializeString(Type.getClassName(c));
|
1981
|
+
this.cache.push(v);
|
1982
|
+
v.hxSerialize(this);
|
1983
|
+
this.buf.b += Std.string("g");
|
1984
|
+
} else {
|
1985
|
+
this.buf.b += Std.string("c");
|
1986
|
+
this.serializeString(Type.getClassName(c));
|
1987
|
+
this.cache.push(v);
|
1988
|
+
this.serializeFields(v);
|
1989
|
+
}
|
1990
|
+
}
|
1991
|
+
break;
|
1992
|
+
case 4:
|
1993
|
+
if(this.useCache && this.serializeRef(v)) return;
|
1994
|
+
this.buf.b += Std.string("o");
|
1995
|
+
this.serializeFields(v);
|
1996
|
+
break;
|
1997
|
+
case 7:
|
1998
|
+
var e = $e[2];
|
1999
|
+
if(this.useCache && this.serializeRef(v)) return;
|
2000
|
+
this.cache.pop();
|
2001
|
+
this.buf.b += Std.string(this.useEnumIndex?"j":"w");
|
2002
|
+
this.serializeString(Type.getEnumName(e));
|
2003
|
+
if(this.useEnumIndex) {
|
2004
|
+
this.buf.b += Std.string(":");
|
2005
|
+
this.buf.b += Std.string(v[1]);
|
2006
|
+
} else this.serializeString(v[0]);
|
2007
|
+
this.buf.b += Std.string(":");
|
2008
|
+
var l = v.length;
|
2009
|
+
this.buf.b += Std.string(l - 2);
|
2010
|
+
var _g = 2;
|
2011
|
+
while(_g < l) {
|
2012
|
+
var i = _g++;
|
2013
|
+
this.serialize(v[i]);
|
2014
|
+
}
|
2015
|
+
this.cache.push(v);
|
2016
|
+
break;
|
2017
|
+
case 5:
|
2018
|
+
throw "Cannot serialize function";
|
2019
|
+
break;
|
2020
|
+
default:
|
2021
|
+
throw "Cannot serialize " + Std.string(v);
|
2022
|
+
}
|
2023
|
+
}
|
2024
|
+
,serializeFields: function(v) {
|
2025
|
+
var _g = 0, _g1 = Reflect.fields(v);
|
2026
|
+
while(_g < _g1.length) {
|
2027
|
+
var f = _g1[_g];
|
2028
|
+
++_g;
|
2029
|
+
this.serializeString(f);
|
2030
|
+
this.serialize(Reflect.field(v,f));
|
2031
|
+
}
|
2032
|
+
this.buf.b += Std.string("g");
|
2033
|
+
}
|
2034
|
+
,serializeRef: function(v) {
|
2035
|
+
var vt = typeof(v);
|
2036
|
+
var _g1 = 0, _g = this.cache.length;
|
2037
|
+
while(_g1 < _g) {
|
2038
|
+
var i = _g1++;
|
2039
|
+
var ci = this.cache[i];
|
2040
|
+
if(typeof(ci) == vt && ci == v) {
|
2041
|
+
this.buf.b += Std.string("r");
|
2042
|
+
this.buf.b += Std.string(i);
|
2043
|
+
return true;
|
2044
|
+
}
|
2045
|
+
}
|
2046
|
+
this.cache.push(v);
|
2047
|
+
return false;
|
2048
|
+
}
|
2049
|
+
,serializeString: function(s) {
|
2050
|
+
var x = this.shash.get(s);
|
2051
|
+
if(x != null) {
|
2052
|
+
this.buf.b += Std.string("R");
|
2053
|
+
this.buf.b += Std.string(x);
|
2054
|
+
return;
|
2055
|
+
}
|
2056
|
+
this.shash.set(s,this.scount++);
|
2057
|
+
this.buf.b += Std.string("y");
|
2058
|
+
s = StringTools.urlEncode(s);
|
2059
|
+
this.buf.b += Std.string(s.length);
|
2060
|
+
this.buf.b += Std.string(":");
|
2061
|
+
this.buf.b += Std.string(s);
|
2062
|
+
}
|
2063
|
+
,toString: function() {
|
2064
|
+
return this.buf.b;
|
2065
|
+
}
|
2066
|
+
,useEnumIndex: null
|
2067
|
+
,useCache: null
|
2068
|
+
,scount: null
|
2069
|
+
,shash: null
|
2070
|
+
,cache: null
|
2071
|
+
,buf: null
|
2072
|
+
,__class__: haxe.Serializer
|
2073
|
+
}
|
2074
|
+
haxe.Timer = $hxClasses["haxe.Timer"] = function(time_ms) {
|
2075
|
+
var me = this;
|
2076
|
+
this.id = window.setInterval(function() {
|
2077
|
+
me.run();
|
2078
|
+
},time_ms);
|
2079
|
+
};
|
2080
|
+
haxe.Timer.__name__ = ["haxe","Timer"];
|
2081
|
+
haxe.Timer.delay = function(f,time_ms) {
|
2082
|
+
var t = new haxe.Timer(time_ms);
|
2083
|
+
t.run = function() {
|
2084
|
+
t.stop();
|
2085
|
+
f();
|
2086
|
+
};
|
2087
|
+
return t;
|
2088
|
+
}
|
2089
|
+
haxe.Timer.measure = function(f,pos) {
|
2090
|
+
var t0 = haxe.Timer.stamp();
|
2091
|
+
var r = f();
|
2092
|
+
haxe.Log.trace(haxe.Timer.stamp() - t0 + "s",pos);
|
2093
|
+
return r;
|
2094
|
+
}
|
2095
|
+
haxe.Timer.stamp = function() {
|
2096
|
+
return new Date().getTime() / 1000;
|
2097
|
+
}
|
2098
|
+
haxe.Timer.prototype = {
|
2099
|
+
run: function() {
|
2100
|
+
}
|
2101
|
+
,stop: function() {
|
2102
|
+
if(this.id == null) return;
|
2103
|
+
window.clearInterval(this.id);
|
2104
|
+
this.id = null;
|
2105
|
+
}
|
2106
|
+
,id: null
|
2107
|
+
,__class__: haxe.Timer
|
2108
|
+
}
|
2109
|
+
haxe.Unserializer = $hxClasses["haxe.Unserializer"] = function(buf) {
|
2110
|
+
this.buf = buf;
|
2111
|
+
this.length = buf.length;
|
2112
|
+
this.pos = 0;
|
2113
|
+
this.scache = new Array();
|
2114
|
+
this.cache = new Array();
|
2115
|
+
var r = haxe.Unserializer.DEFAULT_RESOLVER;
|
2116
|
+
if(r == null) {
|
2117
|
+
r = Type;
|
2118
|
+
haxe.Unserializer.DEFAULT_RESOLVER = r;
|
2119
|
+
}
|
2120
|
+
this.setResolver(r);
|
2121
|
+
};
|
2122
|
+
haxe.Unserializer.__name__ = ["haxe","Unserializer"];
|
2123
|
+
haxe.Unserializer.initCodes = function() {
|
2124
|
+
var codes = new Array();
|
2125
|
+
var _g1 = 0, _g = haxe.Unserializer.BASE64.length;
|
2126
|
+
while(_g1 < _g) {
|
2127
|
+
var i = _g1++;
|
2128
|
+
codes[haxe.Unserializer.BASE64.charCodeAt(i)] = i;
|
2129
|
+
}
|
2130
|
+
return codes;
|
2131
|
+
}
|
2132
|
+
haxe.Unserializer.run = function(v) {
|
2133
|
+
return new haxe.Unserializer(v).unserialize();
|
2134
|
+
}
|
2135
|
+
haxe.Unserializer.prototype = {
|
2136
|
+
unserialize: function() {
|
2137
|
+
switch(this.buf.charCodeAt(this.pos++)) {
|
2138
|
+
case 110:
|
2139
|
+
return null;
|
2140
|
+
case 116:
|
2141
|
+
return true;
|
2142
|
+
case 102:
|
2143
|
+
return false;
|
2144
|
+
case 122:
|
2145
|
+
return 0;
|
2146
|
+
case 105:
|
2147
|
+
return this.readDigits();
|
2148
|
+
case 100:
|
2149
|
+
var p1 = this.pos;
|
2150
|
+
while(true) {
|
2151
|
+
var c = this.buf.charCodeAt(this.pos);
|
2152
|
+
if(c >= 43 && c < 58 || c == 101 || c == 69) this.pos++; else break;
|
2153
|
+
}
|
2154
|
+
return Std.parseFloat(HxOverrides.substr(this.buf,p1,this.pos - p1));
|
2155
|
+
case 121:
|
2156
|
+
var len = this.readDigits();
|
2157
|
+
if(this.buf.charCodeAt(this.pos++) != 58 || this.length - this.pos < len) throw "Invalid string length";
|
2158
|
+
var s = HxOverrides.substr(this.buf,this.pos,len);
|
2159
|
+
this.pos += len;
|
2160
|
+
s = StringTools.urlDecode(s);
|
2161
|
+
this.scache.push(s);
|
2162
|
+
return s;
|
2163
|
+
case 107:
|
2164
|
+
return Math.NaN;
|
2165
|
+
case 109:
|
2166
|
+
return Math.NEGATIVE_INFINITY;
|
2167
|
+
case 112:
|
2168
|
+
return Math.POSITIVE_INFINITY;
|
2169
|
+
case 97:
|
2170
|
+
var buf = this.buf;
|
2171
|
+
var a = new Array();
|
2172
|
+
this.cache.push(a);
|
2173
|
+
while(true) {
|
2174
|
+
var c = this.buf.charCodeAt(this.pos);
|
2175
|
+
if(c == 104) {
|
2176
|
+
this.pos++;
|
2177
|
+
break;
|
2178
|
+
}
|
2179
|
+
if(c == 117) {
|
2180
|
+
this.pos++;
|
2181
|
+
var n = this.readDigits();
|
2182
|
+
a[a.length + n - 1] = null;
|
2183
|
+
} else a.push(this.unserialize());
|
2184
|
+
}
|
2185
|
+
return a;
|
2186
|
+
case 111:
|
2187
|
+
var o = { };
|
2188
|
+
this.cache.push(o);
|
2189
|
+
this.unserializeObject(o);
|
2190
|
+
return o;
|
2191
|
+
case 114:
|
2192
|
+
var n = this.readDigits();
|
2193
|
+
if(n < 0 || n >= this.cache.length) throw "Invalid reference";
|
2194
|
+
return this.cache[n];
|
2195
|
+
case 82:
|
2196
|
+
var n = this.readDigits();
|
2197
|
+
if(n < 0 || n >= this.scache.length) throw "Invalid string reference";
|
2198
|
+
return this.scache[n];
|
2199
|
+
case 120:
|
2200
|
+
throw this.unserialize();
|
2201
|
+
break;
|
2202
|
+
case 99:
|
2203
|
+
var name = this.unserialize();
|
2204
|
+
var cl = this.resolver.resolveClass(name);
|
2205
|
+
if(cl == null) throw "Class not found " + name;
|
2206
|
+
var o = Type.createEmptyInstance(cl);
|
2207
|
+
this.cache.push(o);
|
2208
|
+
this.unserializeObject(o);
|
2209
|
+
return o;
|
2210
|
+
case 119:
|
2211
|
+
var name = this.unserialize();
|
2212
|
+
var edecl = this.resolver.resolveEnum(name);
|
2213
|
+
if(edecl == null) throw "Enum not found " + name;
|
2214
|
+
var e = this.unserializeEnum(edecl,this.unserialize());
|
2215
|
+
this.cache.push(e);
|
2216
|
+
return e;
|
2217
|
+
case 106:
|
2218
|
+
var name = this.unserialize();
|
2219
|
+
var edecl = this.resolver.resolveEnum(name);
|
2220
|
+
if(edecl == null) throw "Enum not found " + name;
|
2221
|
+
this.pos++;
|
2222
|
+
var index = this.readDigits();
|
2223
|
+
var tag = Type.getEnumConstructs(edecl)[index];
|
2224
|
+
if(tag == null) throw "Unknown enum index " + name + "@" + index;
|
2225
|
+
var e = this.unserializeEnum(edecl,tag);
|
2226
|
+
this.cache.push(e);
|
2227
|
+
return e;
|
2228
|
+
case 108:
|
2229
|
+
var l = new List();
|
2230
|
+
this.cache.push(l);
|
2231
|
+
var buf = this.buf;
|
2232
|
+
while(this.buf.charCodeAt(this.pos) != 104) l.add(this.unserialize());
|
2233
|
+
this.pos++;
|
2234
|
+
return l;
|
2235
|
+
case 98:
|
2236
|
+
var h = new Hash();
|
2237
|
+
this.cache.push(h);
|
2238
|
+
var buf = this.buf;
|
2239
|
+
while(this.buf.charCodeAt(this.pos) != 104) {
|
2240
|
+
var s = this.unserialize();
|
2241
|
+
h.set(s,this.unserialize());
|
2242
|
+
}
|
2243
|
+
this.pos++;
|
2244
|
+
return h;
|
2245
|
+
case 113:
|
2246
|
+
var h = new IntHash();
|
2247
|
+
this.cache.push(h);
|
2248
|
+
var buf = this.buf;
|
2249
|
+
var c = this.buf.charCodeAt(this.pos++);
|
2250
|
+
while(c == 58) {
|
2251
|
+
var i = this.readDigits();
|
2252
|
+
h.set(i,this.unserialize());
|
2253
|
+
c = this.buf.charCodeAt(this.pos++);
|
2254
|
+
}
|
2255
|
+
if(c != 104) throw "Invalid IntHash format";
|
2256
|
+
return h;
|
2257
|
+
case 118:
|
2258
|
+
var d = HxOverrides.strDate(HxOverrides.substr(this.buf,this.pos,19));
|
2259
|
+
this.cache.push(d);
|
2260
|
+
this.pos += 19;
|
2261
|
+
return d;
|
2262
|
+
case 115:
|
2263
|
+
var len = this.readDigits();
|
2264
|
+
var buf = this.buf;
|
2265
|
+
if(this.buf.charCodeAt(this.pos++) != 58 || this.length - this.pos < len) throw "Invalid bytes length";
|
2266
|
+
var codes = haxe.Unserializer.CODES;
|
2267
|
+
if(codes == null) {
|
2268
|
+
codes = haxe.Unserializer.initCodes();
|
2269
|
+
haxe.Unserializer.CODES = codes;
|
2270
|
+
}
|
2271
|
+
var i = this.pos;
|
2272
|
+
var rest = len & 3;
|
2273
|
+
var size = (len >> 2) * 3 + (rest >= 2?rest - 1:0);
|
2274
|
+
var max = i + (len - rest);
|
2275
|
+
var bytes = haxe.io.Bytes.alloc(size);
|
2276
|
+
var bpos = 0;
|
2277
|
+
while(i < max) {
|
2278
|
+
var c1 = codes[buf.charCodeAt(i++)];
|
2279
|
+
var c2 = codes[buf.charCodeAt(i++)];
|
2280
|
+
bytes.b[bpos++] = (c1 << 2 | c2 >> 4) & 255;
|
2281
|
+
var c3 = codes[buf.charCodeAt(i++)];
|
2282
|
+
bytes.b[bpos++] = (c2 << 4 | c3 >> 2) & 255;
|
2283
|
+
var c4 = codes[buf.charCodeAt(i++)];
|
2284
|
+
bytes.b[bpos++] = (c3 << 6 | c4) & 255;
|
2285
|
+
}
|
2286
|
+
if(rest >= 2) {
|
2287
|
+
var c1 = codes[buf.charCodeAt(i++)];
|
2288
|
+
var c2 = codes[buf.charCodeAt(i++)];
|
2289
|
+
bytes.b[bpos++] = (c1 << 2 | c2 >> 4) & 255;
|
2290
|
+
if(rest == 3) {
|
2291
|
+
var c3 = codes[buf.charCodeAt(i++)];
|
2292
|
+
bytes.b[bpos++] = (c2 << 4 | c3 >> 2) & 255;
|
2293
|
+
}
|
2294
|
+
}
|
2295
|
+
this.pos += len;
|
2296
|
+
this.cache.push(bytes);
|
2297
|
+
return bytes;
|
2298
|
+
case 67:
|
2299
|
+
var name = this.unserialize();
|
2300
|
+
var cl = this.resolver.resolveClass(name);
|
2301
|
+
if(cl == null) throw "Class not found " + name;
|
2302
|
+
var o = Type.createEmptyInstance(cl);
|
2303
|
+
this.cache.push(o);
|
2304
|
+
o.hxUnserialize(this);
|
2305
|
+
if(this.buf.charCodeAt(this.pos++) != 103) throw "Invalid custom data";
|
2306
|
+
return o;
|
2307
|
+
default:
|
2308
|
+
}
|
2309
|
+
this.pos--;
|
2310
|
+
throw "Invalid char " + this.buf.charAt(this.pos) + " at position " + this.pos;
|
2311
|
+
}
|
2312
|
+
,unserializeEnum: function(edecl,tag) {
|
2313
|
+
if(this.buf.charCodeAt(this.pos++) != 58) throw "Invalid enum format";
|
2314
|
+
var nargs = this.readDigits();
|
2315
|
+
if(nargs == 0) return Type.createEnum(edecl,tag);
|
2316
|
+
var args = new Array();
|
2317
|
+
while(nargs-- > 0) args.push(this.unserialize());
|
2318
|
+
return Type.createEnum(edecl,tag,args);
|
2319
|
+
}
|
2320
|
+
,unserializeObject: function(o) {
|
2321
|
+
while(true) {
|
2322
|
+
if(this.pos >= this.length) throw "Invalid object";
|
2323
|
+
if(this.buf.charCodeAt(this.pos) == 103) break;
|
2324
|
+
var k = this.unserialize();
|
2325
|
+
if(!js.Boot.__instanceof(k,String)) throw "Invalid object key";
|
2326
|
+
var v = this.unserialize();
|
2327
|
+
o[k] = v;
|
2328
|
+
}
|
2329
|
+
this.pos++;
|
2330
|
+
}
|
2331
|
+
,readDigits: function() {
|
2332
|
+
var k = 0;
|
2333
|
+
var s = false;
|
2334
|
+
var fpos = this.pos;
|
2335
|
+
while(true) {
|
2336
|
+
var c = this.buf.charCodeAt(this.pos);
|
2337
|
+
if(c != c) break;
|
2338
|
+
if(c == 45) {
|
2339
|
+
if(this.pos != fpos) break;
|
2340
|
+
s = true;
|
2341
|
+
this.pos++;
|
2342
|
+
continue;
|
2343
|
+
}
|
2344
|
+
if(c < 48 || c > 57) break;
|
2345
|
+
k = k * 10 + (c - 48);
|
2346
|
+
this.pos++;
|
2347
|
+
}
|
2348
|
+
if(s) k *= -1;
|
2349
|
+
return k;
|
2350
|
+
}
|
2351
|
+
,get: function(p) {
|
2352
|
+
return this.buf.charCodeAt(p);
|
2353
|
+
}
|
2354
|
+
,getResolver: function() {
|
2355
|
+
return this.resolver;
|
2356
|
+
}
|
2357
|
+
,setResolver: function(r) {
|
2358
|
+
if(r == null) this.resolver = { resolveClass : function(_) {
|
2359
|
+
return null;
|
2360
|
+
}, resolveEnum : function(_) {
|
2361
|
+
return null;
|
2362
|
+
}}; else this.resolver = r;
|
2363
|
+
}
|
2364
|
+
,resolver: null
|
2365
|
+
,scache: null
|
2366
|
+
,cache: null
|
2367
|
+
,length: null
|
2368
|
+
,pos: null
|
2369
|
+
,buf: null
|
2370
|
+
,__class__: haxe.Unserializer
|
2371
|
+
}
|
2372
|
+
if(!haxe.io) haxe.io = {}
|
2373
|
+
haxe.io.Bytes = $hxClasses["haxe.io.Bytes"] = function(length,b) {
|
2374
|
+
this.length = length;
|
2375
|
+
this.b = b;
|
2376
|
+
};
|
2377
|
+
haxe.io.Bytes.__name__ = ["haxe","io","Bytes"];
|
2378
|
+
haxe.io.Bytes.alloc = function(length) {
|
2379
|
+
var a = new Array();
|
2380
|
+
var _g = 0;
|
2381
|
+
while(_g < length) {
|
2382
|
+
var i = _g++;
|
2383
|
+
a.push(0);
|
2384
|
+
}
|
2385
|
+
return new haxe.io.Bytes(length,a);
|
2386
|
+
}
|
2387
|
+
haxe.io.Bytes.ofString = function(s) {
|
2388
|
+
var a = new Array();
|
2389
|
+
var _g1 = 0, _g = s.length;
|
2390
|
+
while(_g1 < _g) {
|
2391
|
+
var i = _g1++;
|
2392
|
+
var c = s.charCodeAt(i);
|
2393
|
+
if(c <= 127) a.push(c); else if(c <= 2047) {
|
2394
|
+
a.push(192 | c >> 6);
|
2395
|
+
a.push(128 | c & 63);
|
2396
|
+
} else if(c <= 65535) {
|
2397
|
+
a.push(224 | c >> 12);
|
2398
|
+
a.push(128 | c >> 6 & 63);
|
2399
|
+
a.push(128 | c & 63);
|
2400
|
+
} else {
|
2401
|
+
a.push(240 | c >> 18);
|
2402
|
+
a.push(128 | c >> 12 & 63);
|
2403
|
+
a.push(128 | c >> 6 & 63);
|
2404
|
+
a.push(128 | c & 63);
|
2405
|
+
}
|
2406
|
+
}
|
2407
|
+
return new haxe.io.Bytes(a.length,a);
|
2408
|
+
}
|
2409
|
+
haxe.io.Bytes.ofData = function(b) {
|
2410
|
+
return new haxe.io.Bytes(b.length,b);
|
2411
|
+
}
|
2412
|
+
haxe.io.Bytes.prototype = {
|
2413
|
+
getData: function() {
|
2414
|
+
return this.b;
|
2415
|
+
}
|
2416
|
+
,toHex: function() {
|
2417
|
+
var s = new StringBuf();
|
2418
|
+
var chars = [];
|
2419
|
+
var str = "0123456789abcdef";
|
2420
|
+
var _g1 = 0, _g = str.length;
|
2421
|
+
while(_g1 < _g) {
|
2422
|
+
var i = _g1++;
|
2423
|
+
chars.push(HxOverrides.cca(str,i));
|
2424
|
+
}
|
2425
|
+
var _g1 = 0, _g = this.length;
|
2426
|
+
while(_g1 < _g) {
|
2427
|
+
var i = _g1++;
|
2428
|
+
var c = this.b[i];
|
2429
|
+
s.b += String.fromCharCode(chars[c >> 4]);
|
2430
|
+
s.b += String.fromCharCode(chars[c & 15]);
|
2431
|
+
}
|
2432
|
+
return s.b;
|
2433
|
+
}
|
2434
|
+
,toString: function() {
|
2435
|
+
return this.readString(0,this.length);
|
2436
|
+
}
|
2437
|
+
,readString: function(pos,len) {
|
2438
|
+
if(pos < 0 || len < 0 || pos + len > this.length) throw haxe.io.Error.OutsideBounds;
|
2439
|
+
var s = "";
|
2440
|
+
var b = this.b;
|
2441
|
+
var fcc = String.fromCharCode;
|
2442
|
+
var i = pos;
|
2443
|
+
var max = pos + len;
|
2444
|
+
while(i < max) {
|
2445
|
+
var c = b[i++];
|
2446
|
+
if(c < 128) {
|
2447
|
+
if(c == 0) break;
|
2448
|
+
s += fcc(c);
|
2449
|
+
} else if(c < 224) s += fcc((c & 63) << 6 | b[i++] & 127); else if(c < 240) {
|
2450
|
+
var c2 = b[i++];
|
2451
|
+
s += fcc((c & 31) << 12 | (c2 & 127) << 6 | b[i++] & 127);
|
2452
|
+
} else {
|
2453
|
+
var c2 = b[i++];
|
2454
|
+
var c3 = b[i++];
|
2455
|
+
s += fcc((c & 15) << 18 | (c2 & 127) << 12 | c3 << 6 & 127 | b[i++] & 127);
|
2456
|
+
}
|
2457
|
+
}
|
2458
|
+
return s;
|
2459
|
+
}
|
2460
|
+
,compare: function(other) {
|
2461
|
+
var b1 = this.b;
|
2462
|
+
var b2 = other.b;
|
2463
|
+
var len = this.length < other.length?this.length:other.length;
|
2464
|
+
var _g = 0;
|
2465
|
+
while(_g < len) {
|
2466
|
+
var i = _g++;
|
2467
|
+
if(b1[i] != b2[i]) return b1[i] - b2[i];
|
2468
|
+
}
|
2469
|
+
return this.length - other.length;
|
2470
|
+
}
|
2471
|
+
,sub: function(pos,len) {
|
2472
|
+
if(pos < 0 || len < 0 || pos + len > this.length) throw haxe.io.Error.OutsideBounds;
|
2473
|
+
return new haxe.io.Bytes(len,this.b.slice(pos,pos + len));
|
2474
|
+
}
|
2475
|
+
,blit: function(pos,src,srcpos,len) {
|
2476
|
+
if(pos < 0 || srcpos < 0 || len < 0 || pos + len > this.length || srcpos + len > src.length) throw haxe.io.Error.OutsideBounds;
|
2477
|
+
var b1 = this.b;
|
2478
|
+
var b2 = src.b;
|
2479
|
+
if(b1 == b2 && pos > srcpos) {
|
2480
|
+
var i = len;
|
2481
|
+
while(i > 0) {
|
2482
|
+
i--;
|
2483
|
+
b1[i + pos] = b2[i + srcpos];
|
2484
|
+
}
|
2485
|
+
return;
|
2486
|
+
}
|
2487
|
+
var _g = 0;
|
2488
|
+
while(_g < len) {
|
2489
|
+
var i = _g++;
|
2490
|
+
b1[i + pos] = b2[i + srcpos];
|
2491
|
+
}
|
2492
|
+
}
|
2493
|
+
,set: function(pos,v) {
|
2494
|
+
this.b[pos] = v & 255;
|
2495
|
+
}
|
2496
|
+
,get: function(pos) {
|
2497
|
+
return this.b[pos];
|
2498
|
+
}
|
2499
|
+
,b: null
|
2500
|
+
,length: null
|
2501
|
+
,__class__: haxe.io.Bytes
|
2502
|
+
}
|
2503
|
+
haxe.io.Error = $hxClasses["haxe.io.Error"] = { __ename__ : ["haxe","io","Error"], __constructs__ : ["Blocked","Overflow","OutsideBounds","Custom"] }
|
2504
|
+
haxe.io.Error.Blocked = ["Blocked",0];
|
2505
|
+
haxe.io.Error.Blocked.toString = $estr;
|
2506
|
+
haxe.io.Error.Blocked.__enum__ = haxe.io.Error;
|
2507
|
+
haxe.io.Error.Overflow = ["Overflow",1];
|
2508
|
+
haxe.io.Error.Overflow.toString = $estr;
|
2509
|
+
haxe.io.Error.Overflow.__enum__ = haxe.io.Error;
|
2510
|
+
haxe.io.Error.OutsideBounds = ["OutsideBounds",2];
|
2511
|
+
haxe.io.Error.OutsideBounds.toString = $estr;
|
2512
|
+
haxe.io.Error.OutsideBounds.__enum__ = haxe.io.Error;
|
2513
|
+
haxe.io.Error.Custom = function(e) { var $x = ["Custom",3,e]; $x.__enum__ = haxe.io.Error; $x.toString = $estr; return $x; }
|
2514
|
+
if(!haxe.remoting) haxe.remoting = {}
|
2515
|
+
haxe.remoting.Connection = $hxClasses["haxe.remoting.Connection"] = function() { }
|
2516
|
+
haxe.remoting.Connection.__name__ = ["haxe","remoting","Connection"];
|
2517
|
+
haxe.remoting.Connection.prototype = {
|
2518
|
+
call: null
|
2519
|
+
,resolve: null
|
2520
|
+
,__class__: haxe.remoting.Connection
|
2521
|
+
}
|
2522
|
+
haxe.remoting.Context = $hxClasses["haxe.remoting.Context"] = function() {
|
2523
|
+
this.objects = new Hash();
|
2524
|
+
};
|
2525
|
+
haxe.remoting.Context.__name__ = ["haxe","remoting","Context"];
|
2526
|
+
haxe.remoting.Context.share = function(name,obj) {
|
2527
|
+
var ctx = new haxe.remoting.Context();
|
2528
|
+
ctx.addObject(name,obj);
|
2529
|
+
return ctx;
|
2530
|
+
}
|
2531
|
+
haxe.remoting.Context.prototype = {
|
2532
|
+
call: function(path,params) {
|
2533
|
+
if(path.length < 2) throw "Invalid path '" + path.join(".") + "'";
|
2534
|
+
var inf = this.objects.get(path[0]);
|
2535
|
+
if(inf == null) throw "No such object " + path[0];
|
2536
|
+
var o = inf.obj;
|
2537
|
+
var m = Reflect.field(o,path[1]);
|
2538
|
+
if(path.length > 2) {
|
2539
|
+
if(!inf.rec) throw "Can't access " + path.join(".");
|
2540
|
+
var _g1 = 2, _g = path.length;
|
2541
|
+
while(_g1 < _g) {
|
2542
|
+
var i = _g1++;
|
2543
|
+
o = m;
|
2544
|
+
m = Reflect.field(o,path[i]);
|
2545
|
+
}
|
2546
|
+
}
|
2547
|
+
if(!Reflect.isFunction(m)) throw "No such method " + path.join(".");
|
2548
|
+
return m.apply(o,params);
|
2549
|
+
}
|
2550
|
+
,addObject: function(name,obj,recursive) {
|
2551
|
+
this.objects.set(name,{ obj : obj, rec : recursive});
|
2552
|
+
}
|
2553
|
+
,objects: null
|
2554
|
+
,__class__: haxe.remoting.Context
|
2555
|
+
}
|
2556
|
+
haxe.remoting.HttpConnection = $hxClasses["haxe.remoting.HttpConnection"] = function(url,path) {
|
2557
|
+
this.__url = url;
|
2558
|
+
this.__path = path;
|
2559
|
+
};
|
2560
|
+
haxe.remoting.HttpConnection.__name__ = ["haxe","remoting","HttpConnection"];
|
2561
|
+
haxe.remoting.HttpConnection.__interfaces__ = [haxe.remoting.Connection];
|
2562
|
+
haxe.remoting.HttpConnection.urlConnect = function(url) {
|
2563
|
+
return new haxe.remoting.HttpConnection(url,[]);
|
2564
|
+
}
|
2565
|
+
haxe.remoting.HttpConnection.processRequest = function(requestData,ctx) {
|
2566
|
+
try {
|
2567
|
+
var u = new haxe.Unserializer(requestData);
|
2568
|
+
var path = u.unserialize();
|
2569
|
+
var args = u.unserialize();
|
2570
|
+
var data = ctx.call(path,args);
|
2571
|
+
var s = new haxe.Serializer();
|
2572
|
+
s.serialize(data);
|
2573
|
+
return "hxr" + s.toString();
|
2574
|
+
} catch( e ) {
|
2575
|
+
var s = new haxe.Serializer();
|
2576
|
+
s.serializeException(e);
|
2577
|
+
return "hxr" + s.toString();
|
2578
|
+
}
|
2579
|
+
}
|
2580
|
+
haxe.remoting.HttpConnection.prototype = {
|
2581
|
+
call: function(params) {
|
2582
|
+
var data = null;
|
2583
|
+
var h = new haxe.Http(this.__url);
|
2584
|
+
h.async = false;
|
2585
|
+
var s = new haxe.Serializer();
|
2586
|
+
s.serialize(this.__path);
|
2587
|
+
s.serialize(params);
|
2588
|
+
h.setHeader("X-Haxe-Remoting","1");
|
2589
|
+
h.setParameter("__x",s.toString());
|
2590
|
+
h.onData = function(d) {
|
2591
|
+
data = d;
|
2592
|
+
};
|
2593
|
+
h.onError = function(e) {
|
2594
|
+
throw e;
|
2595
|
+
};
|
2596
|
+
h.request(true);
|
2597
|
+
if(HxOverrides.substr(data,0,3) != "hxr") throw "Invalid response : '" + data + "'";
|
2598
|
+
data = HxOverrides.substr(data,3,null);
|
2599
|
+
return new haxe.Unserializer(data).unserialize();
|
2600
|
+
}
|
2601
|
+
,resolve: function(name) {
|
2602
|
+
var c = new haxe.remoting.HttpConnection(this.__url,this.__path.slice());
|
2603
|
+
c.__path.push(name);
|
2604
|
+
return c;
|
2605
|
+
}
|
2606
|
+
,__path: null
|
2607
|
+
,__url: null
|
2608
|
+
,__class__: haxe.remoting.HttpConnection
|
2609
|
+
}
|
2610
|
+
var js = js || {}
|
2611
|
+
js.Boot = $hxClasses["js.Boot"] = function() { }
|
2612
|
+
js.Boot.__name__ = ["js","Boot"];
|
2613
|
+
js.Boot.__unhtml = function(s) {
|
2614
|
+
return s.split("&").join("&").split("<").join("<").split(">").join(">");
|
2615
|
+
}
|
2616
|
+
js.Boot.__trace = function(v,i) {
|
2617
|
+
var msg = i != null?i.fileName + ":" + i.lineNumber + ": ":"";
|
2618
|
+
msg += js.Boot.__string_rec(v,"");
|
2619
|
+
var d;
|
2620
|
+
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);
|
2621
|
+
}
|
2622
|
+
js.Boot.__clear_trace = function() {
|
2623
|
+
var d = document.getElementById("haxe:trace");
|
2624
|
+
if(d != null) d.innerHTML = "";
|
2625
|
+
}
|
2626
|
+
js.Boot.isClass = function(o) {
|
2627
|
+
return o.__name__;
|
2628
|
+
}
|
2629
|
+
js.Boot.isEnum = function(e) {
|
2630
|
+
return e.__ename__;
|
2631
|
+
}
|
2632
|
+
js.Boot.getClass = function(o) {
|
2633
|
+
return o.__class__;
|
2634
|
+
}
|
2635
|
+
js.Boot.__string_rec = function(o,s) {
|
2636
|
+
if(o == null) return "null";
|
2637
|
+
if(s.length >= 5) return "<...>";
|
2638
|
+
var t = typeof(o);
|
2639
|
+
if(t == "function" && (o.__name__ || o.__ename__)) t = "object";
|
2640
|
+
switch(t) {
|
2641
|
+
case "object":
|
2642
|
+
if(o instanceof Array) {
|
2643
|
+
if(o.__enum__) {
|
2644
|
+
if(o.length == 2) return o[0];
|
2645
|
+
var str = o[0] + "(";
|
2646
|
+
s += "\t";
|
2647
|
+
var _g1 = 2, _g = o.length;
|
2648
|
+
while(_g1 < _g) {
|
2649
|
+
var i = _g1++;
|
2650
|
+
if(i != 2) str += "," + js.Boot.__string_rec(o[i],s); else str += js.Boot.__string_rec(o[i],s);
|
2651
|
+
}
|
2652
|
+
return str + ")";
|
2653
|
+
}
|
2654
|
+
var l = o.length;
|
2655
|
+
var i;
|
2656
|
+
var str = "[";
|
2657
|
+
s += "\t";
|
2658
|
+
var _g = 0;
|
2659
|
+
while(_g < l) {
|
2660
|
+
var i1 = _g++;
|
2661
|
+
str += (i1 > 0?",":"") + js.Boot.__string_rec(o[i1],s);
|
2662
|
+
}
|
2663
|
+
str += "]";
|
2664
|
+
return str;
|
2665
|
+
}
|
2666
|
+
var tostr;
|
2667
|
+
try {
|
2668
|
+
tostr = o.toString;
|
2669
|
+
} catch( e ) {
|
2670
|
+
return "???";
|
2671
|
+
}
|
2672
|
+
if(tostr != null && tostr != Object.toString) {
|
2673
|
+
var s2 = o.toString();
|
2674
|
+
if(s2 != "[object Object]") return s2;
|
2675
|
+
}
|
2676
|
+
var k = null;
|
2677
|
+
var str = "{\n";
|
2678
|
+
s += "\t";
|
2679
|
+
var hasp = o.hasOwnProperty != null;
|
2680
|
+
for( var k in o ) { ;
|
2681
|
+
if(hasp && !o.hasOwnProperty(k)) {
|
2682
|
+
continue;
|
2683
|
+
}
|
2684
|
+
if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") {
|
2685
|
+
continue;
|
2686
|
+
}
|
2687
|
+
if(str.length != 2) str += ", \n";
|
2688
|
+
str += s + k + " : " + js.Boot.__string_rec(o[k],s);
|
2689
|
+
}
|
2690
|
+
s = s.substring(1);
|
2691
|
+
str += "\n" + s + "}";
|
2692
|
+
return str;
|
2693
|
+
case "function":
|
2694
|
+
return "<function>";
|
2695
|
+
case "string":
|
2696
|
+
return o;
|
2697
|
+
default:
|
2698
|
+
return String(o);
|
2699
|
+
}
|
2700
|
+
}
|
2701
|
+
js.Boot.__interfLoop = function(cc,cl) {
|
2702
|
+
if(cc == null) return false;
|
2703
|
+
if(cc == cl) return true;
|
2704
|
+
var intf = cc.__interfaces__;
|
2705
|
+
if(intf != null) {
|
2706
|
+
var _g1 = 0, _g = intf.length;
|
2707
|
+
while(_g1 < _g) {
|
2708
|
+
var i = _g1++;
|
2709
|
+
var i1 = intf[i];
|
2710
|
+
if(i1 == cl || js.Boot.__interfLoop(i1,cl)) return true;
|
2711
|
+
}
|
2712
|
+
}
|
2713
|
+
return js.Boot.__interfLoop(cc.__super__,cl);
|
2714
|
+
}
|
2715
|
+
js.Boot.__instanceof = function(o,cl) {
|
2716
|
+
try {
|
2717
|
+
if(o instanceof cl) {
|
2718
|
+
if(cl == Array) return o.__enum__ == null;
|
2719
|
+
return true;
|
2720
|
+
}
|
2721
|
+
if(js.Boot.__interfLoop(o.__class__,cl)) return true;
|
2722
|
+
} catch( e ) {
|
2723
|
+
if(cl == null) return false;
|
2724
|
+
}
|
2725
|
+
switch(cl) {
|
2726
|
+
case Int:
|
2727
|
+
return Math.ceil(o%2147483648.0) === o;
|
2728
|
+
case Float:
|
2729
|
+
return typeof(o) == "number";
|
2730
|
+
case Bool:
|
2731
|
+
return o === true || o === false;
|
2732
|
+
case String:
|
2733
|
+
return typeof(o) == "string";
|
2734
|
+
case Dynamic:
|
2735
|
+
return true;
|
2736
|
+
default:
|
2737
|
+
if(o == null) return false;
|
2738
|
+
if(cl == Class && o.__name__ != null) return true; else null;
|
2739
|
+
if(cl == Enum && o.__ename__ != null) return true; else null;
|
2740
|
+
return o.__enum__ == cl;
|
2741
|
+
}
|
2742
|
+
}
|
2743
|
+
js.Boot.__cast = function(o,t) {
|
2744
|
+
if(js.Boot.__instanceof(o,t)) return o; else throw "Cannot cast " + Std.string(o) + " to " + Std.string(t);
|
2745
|
+
}
|
2746
|
+
js.Lib = $hxClasses["js.Lib"] = function() { }
|
2747
|
+
js.Lib.__name__ = ["js","Lib"];
|
2748
|
+
js.Lib.document = null;
|
2749
|
+
js.Lib.window = null;
|
2750
|
+
js.Lib.debug = function() {
|
2751
|
+
debugger;
|
2752
|
+
}
|
2753
|
+
js.Lib.alert = function(v) {
|
2754
|
+
alert(js.Boot.__string_rec(v,""));
|
2755
|
+
}
|
2756
|
+
js.Lib.eval = function(code) {
|
2757
|
+
return eval(code);
|
2758
|
+
}
|
2759
|
+
js.Lib.setErrorHandler = function(f) {
|
2760
|
+
js.Lib.onerror = f;
|
2761
|
+
}
|
2762
|
+
var $_;
|
2763
|
+
function $bind(o,m) { var f = function(){ return f.method.apply(f.scope, arguments); }; f.scope = o; f.method = m; return f; };
|
2764
|
+
if(Array.prototype.indexOf) HxOverrides.remove = function(a,o) {
|
2765
|
+
var i = a.indexOf(o);
|
2766
|
+
if(i == -1) return false;
|
2767
|
+
a.splice(i,1);
|
2768
|
+
return true;
|
2769
|
+
}; else null;
|
2770
|
+
Math.__name__ = ["Math"];
|
2771
|
+
Math.NaN = Number.NaN;
|
2772
|
+
Math.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
|
2773
|
+
Math.POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
2774
|
+
$hxClasses.Math = Math;
|
2775
|
+
Math.isFinite = function(i) {
|
2776
|
+
return isFinite(i);
|
2777
|
+
};
|
2778
|
+
Math.isNaN = function(i) {
|
2779
|
+
return isNaN(i);
|
2780
|
+
};
|
2781
|
+
String.prototype.__class__ = $hxClasses.String = String;
|
2782
|
+
String.__name__ = ["String"];
|
2783
|
+
Array.prototype.__class__ = $hxClasses.Array = Array;
|
2784
|
+
Array.__name__ = ["Array"];
|
2785
|
+
Date.prototype.__class__ = $hxClasses.Date = Date;
|
2786
|
+
Date.__name__ = ["Date"];
|
2787
|
+
var Int = $hxClasses.Int = { __name__ : ["Int"]};
|
2788
|
+
var Dynamic = $hxClasses.Dynamic = { __name__ : ["Dynamic"]};
|
2789
|
+
var Float = $hxClasses.Float = Number;
|
2790
|
+
Float.__name__ = ["Float"];
|
2791
|
+
var Bool = $hxClasses.Bool = Boolean;
|
2792
|
+
Bool.__ename__ = ["Bool"];
|
2793
|
+
var Class = $hxClasses.Class = { __name__ : ["Class"]};
|
2794
|
+
var Enum = { };
|
2795
|
+
var Void = $hxClasses.Void = { __ename__ : ["Void"]};
|
2796
|
+
if(typeof(JSON) != "undefined") haxe.Json = JSON;
|
2797
|
+
if(typeof document != "undefined") js.Lib.document = document;
|
2798
|
+
if(typeof window != "undefined") {
|
2799
|
+
js.Lib.window = window;
|
2800
|
+
js.Lib.window.onerror = function(msg,url,line) {
|
2801
|
+
var f = js.Lib.onerror;
|
2802
|
+
if(f == null) return false;
|
2803
|
+
return f(msg,[url + ":" + line]);
|
2804
|
+
};
|
2805
|
+
}
|
2806
|
+
js.XMLHttpRequest = window.XMLHttpRequest?XMLHttpRequest:window.ActiveXObject?function() {
|
2807
|
+
try {
|
2808
|
+
return new ActiveXObject("Msxml2.XMLHTTP");
|
2809
|
+
} catch( e ) {
|
2810
|
+
try {
|
2811
|
+
return new ActiveXObject("Microsoft.XMLHTTP");
|
2812
|
+
} catch( e1 ) {
|
2813
|
+
throw "Unable to create XMLHttpRequest object.";
|
2814
|
+
}
|
2815
|
+
}
|
2816
|
+
}:(function($this) {
|
2817
|
+
var $r;
|
2818
|
+
throw "Unable to create XMLHttpRequest object.";
|
2819
|
+
return $r;
|
2820
|
+
}(this));
|
2821
|
+
com.wiris.js.JsPluginViewer.USE_CREATE_IMAGE = 1;
|
2822
|
+
com.wiris.js.JsPluginViewer.DEBUG = false;
|
2823
|
+
com.wiris.js.JsPluginViewer.TECH = "ruby";
|
2824
|
+
haxe.Serializer.USE_CACHE = false;
|
2825
|
+
haxe.Serializer.USE_ENUM_INDEX = false;
|
2826
|
+
haxe.Serializer.BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:";
|
2827
|
+
haxe.Unserializer.DEFAULT_RESOLVER = Type;
|
2828
|
+
haxe.Unserializer.BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:";
|
2829
|
+
haxe.Unserializer.CODES = null;
|
2830
|
+
haxe.remoting.HttpConnection.TIMEOUT = 10;
|
2831
|
+
js.Lib.onerror = null;
|
2832
|
+
com.wiris.js.JsPluginViewer.main();
|
2833
|
+
delete Array.prototype.__class__; }());
|