envjs19 0.3.8.20101029121421
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.
- data/.jslintrbrc +30 -0
- data/.project +17 -0
- data/CHANGELOG.rdoc +57 -0
- data/DTD/xhtml-lat1.ent +196 -0
- data/DTD/xhtml-special.ent +80 -0
- data/DTD/xhtml-symbol.ent +237 -0
- data/DTD/xhtml.soc +14 -0
- data/DTD/xhtml1-frameset.dtd +1235 -0
- data/DTD/xhtml1-strict.dtd +978 -0
- data/DTD/xhtml1-transitional.dtd +1201 -0
- data/DTD/xhtml1.dcl +192 -0
- data/Makefile +7 -0
- data/Manifest.txt +280 -0
- data/README.rdoc +65 -0
- data/Rakefile +196 -0
- data/Wakefile +11 -0
- data/bin/envjsrb +257 -0
- data/build.properties +9 -0
- data/build.xml +247 -0
- data/gm/jquery.js +6002 -0
- data/gm/mainx.js +2648 -0
- data/gm/sensx.js +135 -0
- data/gm/t.js +6 -0
- data/gm/x.html +76 -0
- data/htmlparser/BrowserTreeBuilder.java +456 -0
- data/htmlparser/README +34 -0
- data/htmlparser/build.sh +38 -0
- data/jsl/jsl +0 -0
- data/jsl/jsl.default.conf +129 -0
- data/jsl/jsl.exe +0 -0
- data/lib/envjs.rb +35 -0
- data/lib/envjs/event_loop.js +206 -0
- data/lib/envjs/net.rb +3 -0
- data/lib/envjs/net/cgi.rb +94 -0
- data/lib/envjs/net/file.rb +69 -0
- data/lib/envjs/options.rb +11 -0
- data/lib/envjs/runtime.rb +346 -0
- data/lib/envjs/tempfile.rb +24 -0
- data/licenses/GPL-LICENSE.txt +278 -0
- data/licenses/MIT-LICENSE.txt +20 -0
- data/src/base64.js +80 -0
- data/src/build.js +6 -0
- data/src/cruft/bad.html +24 -0
- data/src/cruft/dom.js +606 -0
- data/src/cruft/element.js +297 -0
- data/src/cruft/good.html +30 -0
- data/src/cruft/good.js +32 -0
- data/src/cruft/internal.js +81 -0
- data/src/cruft/parser.js +458 -0
- data/src/css/properties.js +293 -0
- data/src/css/rule.js +22 -0
- data/src/css/sizzle.js +717 -0
- data/src/css/stylesheet.js +52 -0
- data/src/dom/attr.js +55 -0
- data/src/dom/cdatasection.js +31 -0
- data/src/dom/characterdata.js +119 -0
- data/src/dom/comment.js +30 -0
- data/src/dom/doctype.js +9 -0
- data/src/dom/document.js +1023 -0
- data/src/dom/dom.js +134 -0
- data/src/dom/element.js +217 -0
- data/src/dom/entities.js +273 -0
- data/src/dom/exception.js +28 -0
- data/src/dom/fragment.js +37 -0
- data/src/dom/implementation.js +140 -0
- data/src/dom/instruction.js +51 -0
- data/src/dom/namednodemap.js +374 -0
- data/src/dom/namespace.js +50 -0
- data/src/dom/node.js +618 -0
- data/src/dom/nodelist.js +195 -0
- data/src/dom/parser.js +1207 -0
- data/src/dom/text.js +73 -0
- data/src/event/event.js +47 -0
- data/src/event/mouseevent.js +4 -0
- data/src/event/uievent.js +8 -0
- data/src/html/a.js +110 -0
- data/src/html/anchor.js +80 -0
- data/src/html/area.js +57 -0
- data/src/html/base.js +26 -0
- data/src/html/blockquote-q.js +19 -0
- data/src/html/body.js +19 -0
- data/src/html/button.js +21 -0
- data/src/html/canvas.js +14 -0
- data/src/html/col-colgroup.js +49 -0
- data/src/html/collection.js +72 -0
- data/src/html/cookie.js +153 -0
- data/src/html/del-ins.js +25 -0
- data/src/html/div.js +28 -0
- data/src/html/document.js +364 -0
- data/src/html/element.js +382 -0
- data/src/html/fieldset.js +19 -0
- data/src/html/form.js +484 -0
- data/src/html/frame.js +89 -0
- data/src/html/frameset.js +25 -0
- data/src/html/head.js +44 -0
- data/src/html/html.js +0 -0
- data/src/html/htmlparser.js +340 -0
- data/src/html/iframe.js +26 -0
- data/src/html/image.js +0 -0
- data/src/html/img.js +62 -0
- data/src/html/input-elements.js +307 -0
- data/src/html/input.js +65 -0
- data/src/html/label.js +26 -0
- data/src/html/legend.js +19 -0
- data/src/html/link.js +82 -0
- data/src/html/map.js +22 -0
- data/src/html/meta.js +37 -0
- data/src/html/object.js +89 -0
- data/src/html/optgroup.js +25 -0
- data/src/html/option.js +103 -0
- data/src/html/param.js +38 -0
- data/src/html/script.js +122 -0
- data/src/html/select.js +132 -0
- data/src/html/style.js +31 -0
- data/src/html/table.js +199 -0
- data/src/html/tbody-thead-tfoot.js +92 -0
- data/src/html/td-th.js +18 -0
- data/src/html/textarea.js +31 -0
- data/src/html/title.js +20 -0
- data/src/html/tr.js +114 -0
- data/src/intro.js +141 -0
- data/src/outro.js +70 -0
- data/src/parser/html5.detailed.js +10762 -0
- data/src/parser/html5.min.js +503 -0
- data/src/parser/html5.pretty.js +10815 -0
- data/src/parser/intro.js +42 -0
- data/src/parser/outro.js +9 -0
- data/src/platform/core.js +323 -0
- data/src/platform/johnson.js +484 -0
- data/src/platform/rhino.js +327 -0
- data/src/platform/static/intro.js +41 -0
- data/src/platform/static/outro.js +30 -0
- data/src/profile/aop.js +238 -0
- data/src/profile/profile.js +402 -0
- data/src/serializer/xml.js +21 -0
- data/src/svg/animatedstring.js +25 -0
- data/src/svg/document.js +25 -0
- data/src/svg/element.js +22 -0
- data/src/svg/locatable.js +17 -0
- data/src/svg/rect.js +18 -0
- data/src/svg/rectelement.js +24 -0
- data/src/svg/stylable.js +49 -0
- data/src/svg/svgelement.js +22 -0
- data/src/svg/transformable.js +15 -0
- data/src/window/css.js +15 -0
- data/src/window/dialog.js +16 -0
- data/src/window/document.js +28 -0
- data/src/window/event.js +265 -0
- data/src/window/history.js +62 -0
- data/src/window/location.js +156 -0
- data/src/window/navigator.js +48 -0
- data/src/window/screen.js +53 -0
- data/src/window/timer.js +21 -0
- data/src/window/window.js +284 -0
- data/src/window/xhr.js +135 -0
- data/src/xpath/expression.js +49 -0
- data/src/xpath/implementation.js +2505 -0
- data/src/xpath/result.js +67 -0
- data/src/xpath/util.js +551 -0
- data/src/xpath/xmltoken.js +149 -0
- data/src/xslt/COPYING +34 -0
- data/src/xslt/ajaxslt-0.8.1/AUTHORS +1 -0
- data/src/xslt/ajaxslt-0.8.1/ChangeLog +136 -0
- data/src/xslt/ajaxslt-0.8.1/Makefile +49 -0
- data/src/xslt/ajaxslt-0.8.1/README +102 -0
- data/src/xslt/ajaxslt-0.8.1/TODO +15 -0
- data/src/xslt/ajaxslt-0.8.1/dom.js +566 -0
- data/src/xslt/ajaxslt-0.8.1/dom_unittest.html +24 -0
- data/src/xslt/ajaxslt-0.8.1/dom_unittest.js +131 -0
- data/src/xslt/ajaxslt-0.8.1/simplelog.js +79 -0
- data/src/xslt/ajaxslt-0.8.1/test/xpath.html +18 -0
- data/src/xslt/ajaxslt-0.8.1/test/xpath_script.js +45 -0
- data/src/xslt/ajaxslt-0.8.1/test/xslt.html +58 -0
- data/src/xslt/ajaxslt-0.8.1/test/xslt_script.js +33 -0
- data/src/xslt/ajaxslt-0.8.1/unittestsuite.html +26 -0
- data/src/xslt/ajaxslt-0.8.1/xmltoken.js +149 -0
- data/src/xslt/ajaxslt-0.8.1/xmltoken_unittest.html +18 -0
- data/src/xslt/ajaxslt-0.8.1/xmltoken_unittest.js +811 -0
- data/src/xslt/ajaxslt-0.8.1/xpath_unittest.html +39 -0
- data/src/xslt/ajaxslt-0.8.1/xpath_unittest.js +557 -0
- data/src/xslt/ajaxslt-0.8.1/xpathdebug.js +234 -0
- data/src/xslt/ajaxslt-0.8.1/xslt_unittest.html +138 -0
- data/src/xslt/ajaxslt-0.8.1/xslt_unittest.js +68 -0
- data/src/xslt/implementation.js +625 -0
- data/src/xslt/processor.js +37 -0
- data/src/xslt/util.js +449 -0
- data/test/base64.js +80 -0
- data/test/call-load-test.js +15 -0
- data/test/data.js +45 -0
- data/test/debug.js +53 -0
- data/test/firebug/errorIcon.png +0 -0
- data/test/firebug/firebug.css +209 -0
- data/test/firebug/firebug.html +23 -0
- data/test/firebug/firebug.js +672 -0
- data/test/firebug/firebugx.js +10 -0
- data/test/firebug/infoIcon.png +0 -0
- data/test/firebug/warningIcon.png +0 -0
- data/test/fixtures/html/events.html +171 -0
- data/test/fixtures/html/iframe1.html +46 -0
- data/test/fixtures/html/iframe1a.html +46 -0
- data/test/fixtures/html/iframe2.html +45 -0
- data/test/fixtures/html/iframe3.html +28 -0
- data/test/fixtures/html/iframeN.html +57 -0
- data/test/fixtures/html/malformed.html +181 -0
- data/test/fixtures/html/scope.html +81 -0
- data/test/fixtures/html/trivial.html +19 -0
- data/test/fixtures/html/with_js.html +26 -0
- data/test/fixtures/images/icon-blue.png +0 -0
- data/test/fixtures/js/external_script.js +1 -0
- data/test/fixtures/js/script.js +1 -0
- data/test/fixtures/js/script_error.js +2 -0
- data/test/foo.html +8 -0
- data/test/foo.js +40 -0
- data/test/html/events.html +171 -0
- data/test/html/iframe1.html +46 -0
- data/test/html/iframe1a.html +46 -0
- data/test/html/iframe2.html +45 -0
- data/test/html/iframe3.html +30 -0
- data/test/html/iframeN.html +57 -0
- data/test/html/malformed.html +181 -0
- data/test/html/scope.html +87 -0
- data/test/html/script.js +1 -0
- data/test/html/trivial.html +19 -0
- data/test/html/with_js.html +26 -0
- data/test/index.html +328 -0
- data/test/java-prototype.js +9 -0
- data/test/jquery.js +6002 -0
- data/test/primary-tests.js +26 -0
- data/test/prototype-test.js +13 -0
- data/test/qunit.js +61 -0
- data/test/qunit/qunit/qunit.css +17 -0
- data/test/qunit/qunit/qunit.js +997 -0
- data/test/scope.html +19 -0
- data/test/scope.rb +24 -0
- data/test/smp/dmathieu/index.html +8 -0
- data/test/specs/dist/env.spec.js +1534 -0
- data/test/specs/envjs.spec.css +46 -0
- data/test/specs/parser/html.js +31 -0
- data/test/specs/parser/spec.html +40 -0
- data/test/specs/parser/xml.js +31 -0
- data/test/specs/qunit.bdd.js +210 -0
- data/test/specs/qunit.css +17 -0
- data/test/specs/qunit.js +997 -0
- data/test/specs/template/spec-0.js +31 -0
- data/test/specs/template/spec-1.js +31 -0
- data/test/specs/template/spec.html +40 -0
- data/test/specs/window/css.js +23 -0
- data/test/specs/window/dialog.js +25 -0
- data/test/specs/window/document.js +23 -0
- data/test/specs/window/event.js +25 -0
- data/test/specs/window/history.js +34 -0
- data/test/specs/window/location.js +34 -0
- data/test/specs/window/navigator.js +71 -0
- data/test/specs/window/screen.js +42 -0
- data/test/specs/window/spec.html +48 -0
- data/test/specs/window/timer.js +26 -0
- data/test/specs/window/window.js +53 -0
- data/test/specs/xhr/spec.html +47 -0
- data/test/specs/xhr/xhr.js +31 -0
- data/test/test.js +10 -0
- data/test/unit/dom.js +44 -0
- data/test/unit/elementmembers.js +92 -0
- data/test/unit/events.js +195 -0
- data/test/unit/fixtures/external_script.js +1 -0
- data/test/unit/form.js +40 -0
- data/test/unit/iframe.js +234 -0
- data/test/unit/insertion.js +23 -0
- data/test/unit/multi-window.js +212 -0
- data/test/unit/nu.validator.js +34 -0
- data/test/unit/onload.js +90 -0
- data/test/unit/parser.js +122 -0
- data/test/unit/prototypecompat.js +22 -0
- data/test/unit/proxy.js +6 -0
- data/test/unit/scope.js +209 -0
- data/test/unit/timer.js +115 -0
- data/test/unit/window.js +57 -0
- data/test/x.js +1 -0
- data/test/y.js +1 -0
- metadata +367 -0
data/gm/sensx.js
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
window.google = window.google || {};
|
2
|
+
google.maps = google.maps || {};
|
3
|
+
(function () {
|
4
|
+
|
5
|
+
function getScript(src) {
|
6
|
+
document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>');
|
7
|
+
}
|
8
|
+
|
9
|
+
google.maps.Load = function (apiLoad) {
|
10
|
+
apiLoad([, [
|
11
|
+
[
|
12
|
+
["http://mt0.google.com/vt/v=ap.119\u0026hl=en-US\u0026", "http://mt1.google.com/vt/v=ap.119\u0026hl=en-US\u0026"], , "ap.119"],
|
13
|
+
[
|
14
|
+
["http://khm0.google.com/kh/v=57\u0026hl=en-US\u0026", "http://khm1.google.com/kh/v=57\u0026hl=en-US\u0026"], , "57", , ],
|
15
|
+
[
|
16
|
+
["http://mt0.google.com/vt/v=apt.119\u0026hl=en-US\u0026", "http://mt1.google.com/vt/v=apt.119\u0026hl=en-US\u0026"], , "apt.119", "imgtp=png32\u0026"],
|
17
|
+
[
|
18
|
+
["http://mt0.google.com/vt/v=app.119\u0026hl=en-US\u0026", "http://mt1.google.com/vt/v=app.119\u0026hl=en-US\u0026"], , "app.119"], "fzwq1GFIQiP5cNRPOUZ4M6mfdbQT9hD-lAP3jA", [
|
19
|
+
[, 0, 7, 7, [
|
20
|
+
[
|
21
|
+
[330000000, 1246050000],
|
22
|
+
[386200000, 1293600000]
|
23
|
+
],
|
24
|
+
[
|
25
|
+
[366500000, 1297000000],
|
26
|
+
[386200000, 1320034790]
|
27
|
+
]
|
28
|
+
],
|
29
|
+
["http://mt0.gmaptiles.co.kr/mt/v=kr1.12\u0026hl=en-US\u0026", "http://mt1.gmaptiles.co.kr/mt/v=kr1.12\u0026hl=en-US\u0026"], , , , "http://www.gmaptiles.co.kr/mapprint"],
|
30
|
+
[, 0, 8, 9, [
|
31
|
+
[
|
32
|
+
[330000000, 1246050000],
|
33
|
+
[386200000, 1279600000]
|
34
|
+
],
|
35
|
+
[
|
36
|
+
[345000000, 1279600000],
|
37
|
+
[386200000, 1286700000]
|
38
|
+
],
|
39
|
+
[
|
40
|
+
[348900000, 1286700000],
|
41
|
+
[386200000, 1293600000]
|
42
|
+
],
|
43
|
+
[
|
44
|
+
[354690000, 1293600000],
|
45
|
+
[386200000, 1320034790]
|
46
|
+
]
|
47
|
+
],
|
48
|
+
["http://mt0.gmaptiles.co.kr/mt/v=kr1.12\u0026hl=en-US\u0026", "http://mt1.gmaptiles.co.kr/mt/v=kr1.12\u0026hl=en-US\u0026"], , , , "http://www.gmaptiles.co.kr/mapprint"],
|
49
|
+
[, 0, 10, 19, [
|
50
|
+
[
|
51
|
+
[329890840, 1246055600],
|
52
|
+
[386930130, 1284960940]
|
53
|
+
],
|
54
|
+
[
|
55
|
+
[344646740, 1284960940],
|
56
|
+
[386930130, 1288476560]
|
57
|
+
],
|
58
|
+
[
|
59
|
+
[350277470, 1288476560],
|
60
|
+
[386930130, 1310531620]
|
61
|
+
],
|
62
|
+
[
|
63
|
+
[370277730, 1310531620],
|
64
|
+
[386930130, 1320034790]
|
65
|
+
]
|
66
|
+
],
|
67
|
+
["http://mt0.gmaptiles.co.kr/mt/v=kr1.12\u0026hl=en-US\u0026", "http://mt1.gmaptiles.co.kr/mt/v=kr1.12\u0026hl=en-US\u0026"], , , , "http://www.gmaptiles.co.kr/mapprint"],
|
68
|
+
[, 3, 7, 7, [
|
69
|
+
[
|
70
|
+
[330000000, 1246050000],
|
71
|
+
[386200000, 1293600000]
|
72
|
+
],
|
73
|
+
[
|
74
|
+
[366500000, 1297000000],
|
75
|
+
[386200000, 1320034790]
|
76
|
+
]
|
77
|
+
],
|
78
|
+
["http://mt0.gmaptiles.co.kr/mt/v=kr1p.12\u0026hl=en-US\u0026", "http://mt1.gmaptiles.co.kr/mt/v=kr1p.12\u0026hl=en-US\u0026"]
|
79
|
+
],
|
80
|
+
[, 3, 8, 9, [
|
81
|
+
[
|
82
|
+
[330000000, 1246050000],
|
83
|
+
[386200000, 1279600000]
|
84
|
+
],
|
85
|
+
[
|
86
|
+
[345000000, 1279600000],
|
87
|
+
[386200000, 1286700000]
|
88
|
+
],
|
89
|
+
[
|
90
|
+
[348900000, 1286700000],
|
91
|
+
[386200000, 1293600000]
|
92
|
+
],
|
93
|
+
[
|
94
|
+
[354690000, 1293600000],
|
95
|
+
[386200000, 1320034790]
|
96
|
+
]
|
97
|
+
],
|
98
|
+
["http://mt0.gmaptiles.co.kr/mt/v=kr1p.12\u0026hl=en-US\u0026", "http://mt1.gmaptiles.co.kr/mt/v=kr1p.12\u0026hl=en-US\u0026"]
|
99
|
+
],
|
100
|
+
[, 3, 10, , [
|
101
|
+
[
|
102
|
+
[329890840, 1246055600],
|
103
|
+
[386930130, 1284960940]
|
104
|
+
],
|
105
|
+
[
|
106
|
+
[344646740, 1284960940],
|
107
|
+
[386930130, 1288476560]
|
108
|
+
],
|
109
|
+
[
|
110
|
+
[350277470, 1288476560],
|
111
|
+
[386930130, 1310531620]
|
112
|
+
],
|
113
|
+
[
|
114
|
+
[370277730, 1310531620],
|
115
|
+
[386930130, 1320034790]
|
116
|
+
]
|
117
|
+
],
|
118
|
+
["http://mt0.gmaptiles.co.kr/mt/v=kr1p.12\u0026hl=en-US\u0026", "http://mt1.gmaptiles.co.kr/mt/v=kr1p.12\u0026hl=en-US\u0026"]
|
119
|
+
]
|
120
|
+
],
|
121
|
+
[
|
122
|
+
["http://cbk0.google.com/cbk/", "http://cbk1.google.com/cbk/"], , ""],
|
123
|
+
[
|
124
|
+
["http://khmdb0.google.com/kh/v=25\u0026hl=en-US\u0026", "http://khmdb1.google.com/kh/v=25\u0026hl=en-US\u0026"], , "25"],
|
125
|
+
[
|
126
|
+
["http://mt0.google.com/mapslt/hl=en-US\u0026", "http://mt1.google.com/mapslt/hl=en-US\u0026"], , ""]
|
127
|
+
],
|
128
|
+
["en-US", "US", , , , "http://maps.google.com", "http://maps.gstatic.com/intl/en_us/mapfiles/", "http://gg.google.com"],
|
129
|
+
["http://maps.gstatic.com/intl/en_us/mapfiles/api-3/0/32"],
|
130
|
+
[3396856183], 1], loadScriptTime);
|
131
|
+
|
132
|
+
};
|
133
|
+
var loadScriptTime = (new Date).getTime();
|
134
|
+
getScript("mainx.js");
|
135
|
+
})();
|
data/gm/t.js
ADDED
data/gm/x.html
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
</head>
|
4
|
+
<body>
|
5
|
+
|
6
|
+
<script type="text/javascript" src="http://www.json.org/json2.js"></script>
|
7
|
+
<!-- <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> -->
|
8
|
+
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
9
|
+
<!--<script type="text/javascript" src="sensx.js"></script>-->
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var geocoder;
|
13
|
+
var directionsService;
|
14
|
+
|
15
|
+
geocoder = new google.maps.Geocoder();
|
16
|
+
print("?",geocoder);
|
17
|
+
directionsService = new google.maps.DirectionsService();
|
18
|
+
|
19
|
+
function codeAddress() {
|
20
|
+
print("CA",geocoder,"?");
|
21
|
+
var address = document.getElementById("address").value;
|
22
|
+
if (geocoder) {
|
23
|
+
print("0",address,geocoder.geocode);
|
24
|
+
geocoder.geocode( { 'address': address}, function(results, status) {
|
25
|
+
print("CA ++++++++++++++++",JSON.stringify(results),status);
|
26
|
+
if (status == google.maps.GeocoderStatus.OK) {
|
27
|
+
document.getElementById("geocode").value = JSON.stringify(results, null, 2);
|
28
|
+
} else {
|
29
|
+
alert("Geocode was not successful for the following reason: " + status);
|
30
|
+
}
|
31
|
+
});
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
function calcRoute() {
|
36
|
+
print("CR");
|
37
|
+
var start = document.getElementById("start").value;
|
38
|
+
var end = document.getElementById("end").value;
|
39
|
+
var request = {
|
40
|
+
origin:start,
|
41
|
+
destination:end,
|
42
|
+
travelMode: google.maps.DirectionsTravelMode.DRIVING
|
43
|
+
};
|
44
|
+
directionsService.route(request, function(result, status) {
|
45
|
+
if (status == google.maps.DirectionsStatus.OK) {
|
46
|
+
document.getElementById("directions").value = JSON.stringify(result, null, 2);
|
47
|
+
} else {
|
48
|
+
alert("Routing was not successful for the following reason: " + status);
|
49
|
+
}
|
50
|
+
});
|
51
|
+
}
|
52
|
+
</script>
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
Hi
|
59
|
+
<div>
|
60
|
+
<input id="address" type="textbox" value="200 Fifth Ave New York, NY">
|
61
|
+
<input id="addr" type="button" value="Geocode" onclick="codeAddress()">
|
62
|
+
<br />
|
63
|
+
<textarea id="geocode" cols="100" rows="50"></textarea>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<br />
|
67
|
+
<div>
|
68
|
+
<input id="start" type="textbox" value="200 Fifth Ave New York, NY">
|
69
|
+
<input id="end" type="textbox" value="LGA">
|
70
|
+
<input id="route" type="button" value="Calc Route" onclick="calcRoute()">
|
71
|
+
<br />
|
72
|
+
<textarea id="directions" cols="100" rows="50"></textarea>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
</body>
|
76
|
+
</html>
|
@@ -0,0 +1,456 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2007 Henri Sivonen
|
3
|
+
* Copyright (c) 2008-2009 Mozilla Foundation
|
4
|
+
*
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a
|
6
|
+
* copy of this software and associated documentation files (the "Software"),
|
7
|
+
* to deal in the Software without restriction, including without limitation
|
8
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
9
|
+
* and/or sell copies of the Software, and to permit persons to whom the
|
10
|
+
* Software is furnished to do so, subject to the following conditions:
|
11
|
+
*
|
12
|
+
* The above copyright notice and this permission notice shall be included in
|
13
|
+
* all copies or substantial portions of the Software.
|
14
|
+
*
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21
|
+
* DEALINGS IN THE SOFTWARE.
|
22
|
+
*/
|
23
|
+
|
24
|
+
package nu.validator.htmlparser.gwt;
|
25
|
+
|
26
|
+
import java.util.LinkedList;
|
27
|
+
|
28
|
+
import nu.validator.htmlparser.common.DocumentMode;
|
29
|
+
import nu.validator.htmlparser.impl.CoalescingTreeBuilder;
|
30
|
+
import nu.validator.htmlparser.impl.HtmlAttributes;
|
31
|
+
|
32
|
+
import org.xml.sax.SAXException;
|
33
|
+
|
34
|
+
import com.google.gwt.core.client.JavaScriptException;
|
35
|
+
import com.google.gwt.core.client.JavaScriptObject;
|
36
|
+
|
37
|
+
class BrowserTreeBuilder extends CoalescingTreeBuilder<JavaScriptObject> {
|
38
|
+
|
39
|
+
private JavaScriptObject document;
|
40
|
+
|
41
|
+
private JavaScriptObject script;
|
42
|
+
|
43
|
+
private JavaScriptObject placeholder;
|
44
|
+
|
45
|
+
private boolean readyToRun;
|
46
|
+
|
47
|
+
private final LinkedList<ScriptHolder> scriptStack = new LinkedList<ScriptHolder>();
|
48
|
+
|
49
|
+
private class ScriptHolder {
|
50
|
+
private final JavaScriptObject script;
|
51
|
+
|
52
|
+
private final JavaScriptObject placeholder;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* @param script
|
56
|
+
* @param placeholder
|
57
|
+
*/
|
58
|
+
public ScriptHolder(JavaScriptObject script,
|
59
|
+
JavaScriptObject placeholder) {
|
60
|
+
this.script = script;
|
61
|
+
this.placeholder = placeholder;
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Returns the script.
|
66
|
+
*
|
67
|
+
* @return the script
|
68
|
+
*/
|
69
|
+
public JavaScriptObject getScript() {
|
70
|
+
return script;
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Returns the placeholder.
|
75
|
+
*
|
76
|
+
* @return the placeholder
|
77
|
+
*/
|
78
|
+
public JavaScriptObject getPlaceholder() {
|
79
|
+
return placeholder;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
protected BrowserTreeBuilder(JavaScriptObject document) {
|
84
|
+
super();
|
85
|
+
this.document = document;
|
86
|
+
installExplorerCreateElementNS(document);
|
87
|
+
}
|
88
|
+
|
89
|
+
private static native boolean installExplorerCreateElementNS(
|
90
|
+
JavaScriptObject doc) /*-{
|
91
|
+
if (!doc.createElementNS) {
|
92
|
+
doc.createElementNS = function (uri, local) {
|
93
|
+
if ("http://www.w3.org/1999/xhtml" == uri) {
|
94
|
+
return doc.createElement(local);
|
95
|
+
} else if ("http://www.w3.org/1998/Math/MathML" == uri) {
|
96
|
+
if (!doc.mathplayerinitialized) {
|
97
|
+
var obj = document.createElement("object");
|
98
|
+
obj.setAttribute("id", "mathplayer");
|
99
|
+
obj.setAttribute("classid", "clsid:32F66A20-7614-11D4-BD11-00104BD3F987");
|
100
|
+
document.getElementsByTagName("head")[0].appendChild(obj);
|
101
|
+
document.namespaces.add("m", "http://www.w3.org/1998/Math/MathML", "#mathplayer");
|
102
|
+
doc.mathplayerinitialized = true;
|
103
|
+
}
|
104
|
+
return doc.createElement("m:" + local);
|
105
|
+
} else if ("http://www.w3.org/2000/svg" == uri) {
|
106
|
+
if (!doc.renesisinitialized) {
|
107
|
+
var obj = document.createElement("object");
|
108
|
+
obj.setAttribute("id", "renesis");
|
109
|
+
obj.setAttribute("classid", "clsid:AC159093-1683-4BA2-9DCF-0C350141D7F2");
|
110
|
+
document.getElementsByTagName("head")[0].appendChild(obj);
|
111
|
+
document.namespaces.add("s", "http://www.w3.org/2000/svg", "#renesis");
|
112
|
+
doc.renesisinitialized = true;
|
113
|
+
}
|
114
|
+
return doc.createElement("s:" + local);
|
115
|
+
} else {
|
116
|
+
// throw
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}-*/;
|
121
|
+
|
122
|
+
private static native boolean hasAttributeNS(JavaScriptObject element,
|
123
|
+
String uri, String localName) /*-{
|
124
|
+
return element.hasAttributeNS(uri, localName);
|
125
|
+
}-*/;
|
126
|
+
|
127
|
+
private static native void setAttributeNS(JavaScriptObject element,
|
128
|
+
String uri, String localName, String value) /*-{
|
129
|
+
element.setAttributeNS(uri, localName, value);
|
130
|
+
}-*/;
|
131
|
+
|
132
|
+
@Override protected void addAttributesToElement(JavaScriptObject element,
|
133
|
+
HtmlAttributes attributes) throws SAXException {
|
134
|
+
try {
|
135
|
+
for (int i = 0; i < attributes.getLength(); i++) {
|
136
|
+
String localName = attributes.getLocalName(i);
|
137
|
+
String uri = attributes.getURI(i);
|
138
|
+
if (!hasAttributeNS(element, uri, localName)) {
|
139
|
+
setAttributeNS(element, uri, localName,
|
140
|
+
attributes.getValue(i));
|
141
|
+
}
|
142
|
+
}
|
143
|
+
} catch (JavaScriptException e) {
|
144
|
+
fatal(e);
|
145
|
+
}
|
146
|
+
}
|
147
|
+
|
148
|
+
private static native void appendChild(JavaScriptObject parent,
|
149
|
+
JavaScriptObject child) /*-{
|
150
|
+
parent.appendChild(child);
|
151
|
+
}-*/;
|
152
|
+
|
153
|
+
private static native JavaScriptObject createTextNode(JavaScriptObject doc,
|
154
|
+
String text) /*-{
|
155
|
+
return doc.createTextNode(text);
|
156
|
+
}-*/;
|
157
|
+
|
158
|
+
@Override protected void appendCharacters(JavaScriptObject parent,
|
159
|
+
String text) throws SAXException {
|
160
|
+
try {
|
161
|
+
if (parent == placeholder) {
|
162
|
+
appendChild(script, createTextNode(document, text));
|
163
|
+
|
164
|
+
}
|
165
|
+
appendChild(parent, createTextNode(document, text));
|
166
|
+
} catch (JavaScriptException e) {
|
167
|
+
fatal(e);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
private static native boolean hasChildNodes(JavaScriptObject element) /*-{
|
172
|
+
return element.hasChildNodes();
|
173
|
+
}-*/;
|
174
|
+
|
175
|
+
private static native JavaScriptObject getFirstChild(
|
176
|
+
JavaScriptObject element) /*-{
|
177
|
+
return element.firstChild;
|
178
|
+
}-*/;
|
179
|
+
|
180
|
+
@Override protected void appendChildrenToNewParent(
|
181
|
+
JavaScriptObject oldParent, JavaScriptObject newParent)
|
182
|
+
throws SAXException {
|
183
|
+
try {
|
184
|
+
while (hasChildNodes(oldParent)) {
|
185
|
+
appendChild(newParent, getFirstChild(oldParent));
|
186
|
+
}
|
187
|
+
} catch (JavaScriptException e) {
|
188
|
+
fatal(e);
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
private static native JavaScriptObject createComment(JavaScriptObject doc,
|
193
|
+
String text) /*-{
|
194
|
+
return doc.createComment(text);
|
195
|
+
}-*/;
|
196
|
+
|
197
|
+
@Override protected void appendComment(JavaScriptObject parent,
|
198
|
+
String comment) throws SAXException {
|
199
|
+
try {
|
200
|
+
if (parent == placeholder) {
|
201
|
+
appendChild(script, createComment(document, comment));
|
202
|
+
}
|
203
|
+
appendChild(parent, createComment(document, comment));
|
204
|
+
} catch (JavaScriptException e) {
|
205
|
+
fatal(e);
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
@Override protected void appendCommentToDocument(String comment)
|
210
|
+
throws SAXException {
|
211
|
+
try {
|
212
|
+
appendChild(document, createComment(document, comment));
|
213
|
+
} catch (JavaScriptException e) {
|
214
|
+
fatal(e);
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
private static native JavaScriptObject createElementNS(
|
219
|
+
JavaScriptObject doc, String ns, String local) /*-{
|
220
|
+
return doc.createElementNS(ns, local);
|
221
|
+
}-*/;
|
222
|
+
|
223
|
+
@Override protected JavaScriptObject createElement(String ns, String name,
|
224
|
+
HtmlAttributes attributes) throws SAXException {
|
225
|
+
try {
|
226
|
+
JavaScriptObject rv = createElementNS(document, ns, name);
|
227
|
+
for (int i = 0; i < attributes.getLength(); i++) {
|
228
|
+
setAttributeNS(rv, attributes.getURI(i),
|
229
|
+
attributes.getLocalName(i), attributes.getValue(i));
|
230
|
+
}
|
231
|
+
|
232
|
+
if ("script" == name) {
|
233
|
+
if (placeholder != null) {
|
234
|
+
scriptStack.addLast(new ScriptHolder(script, placeholder));
|
235
|
+
}
|
236
|
+
script = rv;
|
237
|
+
placeholder = createElementNS(document,
|
238
|
+
"http://n.validator.nu/placeholder/", "script");
|
239
|
+
rv = placeholder;
|
240
|
+
for (int i = 0; i < attributes.getLength(); i++) {
|
241
|
+
setAttributeNS(rv, attributes.getURI(i),
|
242
|
+
attributes.getLocalName(i), attributes.getValue(i));
|
243
|
+
}
|
244
|
+
}
|
245
|
+
|
246
|
+
return rv;
|
247
|
+
} catch (JavaScriptException e) {
|
248
|
+
fatal(e);
|
249
|
+
throw new RuntimeException("Unreachable");
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
253
|
+
@Override protected JavaScriptObject createHtmlElementSetAsRoot(
|
254
|
+
HtmlAttributes attributes) throws SAXException {
|
255
|
+
try {
|
256
|
+
JavaScriptObject rv = createElementNS(document,
|
257
|
+
"http://www.w3.org/1999/xhtml", "html");
|
258
|
+
for (int i = 0; i < attributes.getLength(); i++) {
|
259
|
+
setAttributeNS(rv, attributes.getURI(i),
|
260
|
+
attributes.getLocalName(i), attributes.getValue(i));
|
261
|
+
}
|
262
|
+
appendChild(document, rv);
|
263
|
+
return rv;
|
264
|
+
} catch (JavaScriptException e) {
|
265
|
+
fatal(e);
|
266
|
+
throw new RuntimeException("Unreachable");
|
267
|
+
}
|
268
|
+
}
|
269
|
+
|
270
|
+
private static native JavaScriptObject getParentNode(
|
271
|
+
JavaScriptObject element) /*-{
|
272
|
+
return element.parentNode;
|
273
|
+
}-*/;
|
274
|
+
|
275
|
+
@Override protected void appendElement(JavaScriptObject child,
|
276
|
+
JavaScriptObject newParent) throws SAXException {
|
277
|
+
try {
|
278
|
+
if (newParent == placeholder) {
|
279
|
+
appendChild(script, cloneNodeDeep(child));
|
280
|
+
}
|
281
|
+
appendChild(newParent, child);
|
282
|
+
} catch (JavaScriptException e) {
|
283
|
+
fatal(e);
|
284
|
+
}
|
285
|
+
}
|
286
|
+
|
287
|
+
@Override protected boolean hasChildren(JavaScriptObject element)
|
288
|
+
throws SAXException {
|
289
|
+
try {
|
290
|
+
return hasChildNodes(element);
|
291
|
+
} catch (JavaScriptException e) {
|
292
|
+
fatal(e);
|
293
|
+
throw new RuntimeException("Unreachable");
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
private static native void insertBeforeNative(JavaScriptObject parent,
|
298
|
+
JavaScriptObject child, JavaScriptObject sibling) /*-{
|
299
|
+
parent.insertBefore(child, sibling);
|
300
|
+
}-*/;
|
301
|
+
|
302
|
+
private static native int getNodeType(JavaScriptObject node) /*-{
|
303
|
+
return node.nodeType;
|
304
|
+
}-*/;
|
305
|
+
|
306
|
+
private static native JavaScriptObject cloneNodeDeep(JavaScriptObject node) /*-{
|
307
|
+
return node.cloneNode(true);
|
308
|
+
}-*/;
|
309
|
+
|
310
|
+
/**
|
311
|
+
* Returns the document.
|
312
|
+
*
|
313
|
+
* @return the document
|
314
|
+
*/
|
315
|
+
JavaScriptObject getDocument() {
|
316
|
+
JavaScriptObject rv = document;
|
317
|
+
document = null;
|
318
|
+
return rv;
|
319
|
+
}
|
320
|
+
|
321
|
+
private static native JavaScriptObject createDocumentFragment(
|
322
|
+
JavaScriptObject doc) /*-{
|
323
|
+
return doc.createDocumentFragment();
|
324
|
+
}-*/;
|
325
|
+
|
326
|
+
JavaScriptObject getDocumentFragment() {
|
327
|
+
JavaScriptObject rv = createDocumentFragment(document);
|
328
|
+
JavaScriptObject rootElt = getFirstChild(document);
|
329
|
+
while (hasChildNodes(rootElt)) {
|
330
|
+
appendChild(rv, getFirstChild(rootElt));
|
331
|
+
}
|
332
|
+
document = null;
|
333
|
+
return rv;
|
334
|
+
}
|
335
|
+
|
336
|
+
/**
|
337
|
+
* @see nu.validator.htmlparser.impl.TreeBuilder#createJavaScriptObject(String,
|
338
|
+
* java.lang.String, org.xml.sax.Attributes, java.lang.Object)
|
339
|
+
*/
|
340
|
+
@Override protected JavaScriptObject createElement(String ns, String name,
|
341
|
+
HtmlAttributes attributes, JavaScriptObject form)
|
342
|
+
throws SAXException {
|
343
|
+
try {
|
344
|
+
JavaScriptObject rv = createElement(ns, name, attributes);
|
345
|
+
// rv.setUserData("nu.validator.form-pointer", form, null);
|
346
|
+
return rv;
|
347
|
+
} catch (JavaScriptException e) {
|
348
|
+
fatal(e);
|
349
|
+
return null;
|
350
|
+
}
|
351
|
+
}
|
352
|
+
|
353
|
+
/**
|
354
|
+
* @see nu.validator.htmlparser.impl.TreeBuilder#start()
|
355
|
+
*/
|
356
|
+
@Override protected void start(boolean fragment) throws SAXException {
|
357
|
+
script = null;
|
358
|
+
placeholder = null;
|
359
|
+
readyToRun = false;
|
360
|
+
}
|
361
|
+
|
362
|
+
protected void documentMode(DocumentMode mode, String publicIdentifier,
|
363
|
+
String systemIdentifier, boolean html4SpecificAdditionalErrorChecks)
|
364
|
+
throws SAXException {
|
365
|
+
// document.setUserData("nu.validator.document-mode", mode, null);
|
366
|
+
}
|
367
|
+
|
368
|
+
/**
|
369
|
+
* @see nu.validator.htmlparser.impl.TreeBuilder#elementPopped(java.lang.String,
|
370
|
+
* java.lang.String, java.lang.Object)
|
371
|
+
*/
|
372
|
+
@Override protected void elementPopped(String ns, String name,
|
373
|
+
JavaScriptObject node) throws SAXException {
|
374
|
+
if (node == placeholder) {
|
375
|
+
readyToRun = true;
|
376
|
+
requestSuspension();
|
377
|
+
}
|
378
|
+
//This is called to allow us to hook into
|
379
|
+
//the 'sax end element event'
|
380
|
+
elementPoppedNative(ns, name, node);
|
381
|
+
}
|
382
|
+
|
383
|
+
private static native void elementPoppedNative(String ns, String name,
|
384
|
+
JavaScriptObject node) /*-{
|
385
|
+
__elementPopped__(ns, name, node);
|
386
|
+
}-*/;
|
387
|
+
|
388
|
+
private static native void replace(JavaScriptObject oldNode,
|
389
|
+
JavaScriptObject newNode) /*-{
|
390
|
+
oldNode.parentNode.replaceChild(newNode, oldNode);
|
391
|
+
__elementPopped__('', newNode.nodeName, newNode);
|
392
|
+
}-*/;
|
393
|
+
|
394
|
+
void maybeRunScript() {
|
395
|
+
if (readyToRun) {
|
396
|
+
readyToRun = false;
|
397
|
+
replace(placeholder, script);
|
398
|
+
if (scriptStack.isEmpty()) {
|
399
|
+
script = null;
|
400
|
+
placeholder = null;
|
401
|
+
} else {
|
402
|
+
ScriptHolder scriptHolder = scriptStack.removeLast();
|
403
|
+
script = scriptHolder.getScript();
|
404
|
+
placeholder = scriptHolder.getPlaceholder();
|
405
|
+
}
|
406
|
+
}
|
407
|
+
}
|
408
|
+
|
409
|
+
@Override protected void insertFosterParentedCharacters(String text,
|
410
|
+
JavaScriptObject table, JavaScriptObject stackParent)
|
411
|
+
throws SAXException {
|
412
|
+
try {
|
413
|
+
JavaScriptObject child = createTextNode(document, text);
|
414
|
+
JavaScriptObject parent = getParentNode(table);
|
415
|
+
if (parent != null && getNodeType(parent) == 1) {
|
416
|
+
insertBeforeNative(parent, child, table);
|
417
|
+
} else {
|
418
|
+
appendChild(stackParent, child);
|
419
|
+
}
|
420
|
+
} catch (JavaScriptException e) {
|
421
|
+
fatal(e);
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
425
|
+
@Override protected void insertFosterParentedChild(JavaScriptObject child,
|
426
|
+
JavaScriptObject table, JavaScriptObject stackParent)
|
427
|
+
throws SAXException {
|
428
|
+
JavaScriptObject parent = getParentNode(table);
|
429
|
+
try {
|
430
|
+
if (parent != null && getNodeType(parent) == 1) {
|
431
|
+
insertBeforeNative(parent, child, table);
|
432
|
+
} else {
|
433
|
+
appendChild(stackParent, child);
|
434
|
+
}
|
435
|
+
} catch (JavaScriptException e) {
|
436
|
+
fatal(e);
|
437
|
+
}
|
438
|
+
}
|
439
|
+
|
440
|
+
private static native void removeChild(JavaScriptObject parent,
|
441
|
+
JavaScriptObject child) /*-{
|
442
|
+
parent.removeChild(child);
|
443
|
+
}-*/;
|
444
|
+
|
445
|
+
@Override protected void detachFromParent(JavaScriptObject element)
|
446
|
+
throws SAXException {
|
447
|
+
try {
|
448
|
+
JavaScriptObject parent = getParentNode(element);
|
449
|
+
if (parent != null) {
|
450
|
+
removeChild(parent, element);
|
451
|
+
}
|
452
|
+
} catch (JavaScriptException e) {
|
453
|
+
fatal(e);
|
454
|
+
}
|
455
|
+
}
|
456
|
+
}
|