envjs19 0.3.8.20101029121421
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,62 @@
|
|
1
|
+
/*
|
2
|
+
* history.js
|
3
|
+
*/
|
4
|
+
|
5
|
+
var $currentHistoryIndex = 0;
|
6
|
+
var $history = [];
|
7
|
+
|
8
|
+
// Browser History
|
9
|
+
$w.__defineGetter__("history", function(){
|
10
|
+
return {
|
11
|
+
get length(){ return $history.length; },
|
12
|
+
back : function(count){
|
13
|
+
if(count){
|
14
|
+
go(-count);
|
15
|
+
}else{go(-1);}
|
16
|
+
},
|
17
|
+
forward : function(count){
|
18
|
+
if(count){
|
19
|
+
go(count);
|
20
|
+
}else{go(1);}
|
21
|
+
},
|
22
|
+
go : function(target){
|
23
|
+
if(typeof target == "number"){
|
24
|
+
target = $currentHistoryIndex+target;
|
25
|
+
if(target > -1 && target < $history.length){
|
26
|
+
if($history[target].location == "hash"){
|
27
|
+
$w.location.hash = $history[target].value;
|
28
|
+
}else{
|
29
|
+
$w.location = $history[target].value;
|
30
|
+
}
|
31
|
+
$currentHistoryIndex = target;
|
32
|
+
//remove the last item added to the history
|
33
|
+
//since we are moving inside the history
|
34
|
+
$history.pop();
|
35
|
+
}
|
36
|
+
}else{
|
37
|
+
//TODO: walk throu the history and find the 'best match'
|
38
|
+
}
|
39
|
+
}
|
40
|
+
};
|
41
|
+
});
|
42
|
+
|
43
|
+
//Here locationPart is the particutlar method/attribute
|
44
|
+
// of the location object that was modified. This allows us
|
45
|
+
// to modify the correct portion of the location object
|
46
|
+
// when we navigate the history
|
47
|
+
var __setHistory__ = function( value, locationPart){
|
48
|
+
if ( value == "about:blank" ) {
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
$debug("adding value to history: " +value);
|
52
|
+
$currentHistoryIndex++;
|
53
|
+
$history.push({
|
54
|
+
location: locationPart||"href",
|
55
|
+
value: value
|
56
|
+
});
|
57
|
+
};
|
58
|
+
|
59
|
+
// Local Variables:
|
60
|
+
// espresso-indent-level:4
|
61
|
+
// c-basic-offset:4
|
62
|
+
// End:
|
@@ -0,0 +1,156 @@
|
|
1
|
+
/*
|
2
|
+
* location.js
|
3
|
+
* - requires env
|
4
|
+
*/
|
5
|
+
$debug("Initializing Window Location.");
|
6
|
+
//the current location
|
7
|
+
var $location = '';
|
8
|
+
$env.__url = function(url){
|
9
|
+
$location = url;
|
10
|
+
};
|
11
|
+
|
12
|
+
$w.__defineSetter__("location", function(url){
|
13
|
+
if (url[0] === "#") {
|
14
|
+
window.location.hash = url;
|
15
|
+
// print("return anchor only: "+window.location.href);
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
if (false) {
|
19
|
+
var now = window.location.href.replace(/^file:\/\//,"").replace(/#.*/,"");
|
20
|
+
var to = $master.first_script_window && $master.first_script_window.location.href;
|
21
|
+
// var to = $env.location(url,window.location.href != "about:blank" ? window.location.href: undefined);
|
22
|
+
// I'm not sure why this code is here ... looking at the FSW
|
23
|
+
// print("nu",now,url,to);
|
24
|
+
to = to || $env.location(url,window.location.href);
|
25
|
+
// print("nu",now,url,to);
|
26
|
+
if (to && to.indexOf(now)===0 && to[now.length]==="#") {
|
27
|
+
// print("return diff anchor only");
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
if (url && url.indexOf(now)===0 && url[now.length]==="#") {
|
31
|
+
// print("return diff anchor only");
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
// print($location, window.location.href === $location, $location.indexOf("#")>0);
|
35
|
+
if (url === window.location.href && $location.indexOf("#")>0) {
|
36
|
+
// print('returning same with anchor');
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
// print("ft",window.location.href,$location,url);
|
40
|
+
}
|
41
|
+
// debug("l",url,$w.location);
|
42
|
+
if( !$location || ( $location == "about:blank" && url !== "about:blank" ) ) {
|
43
|
+
// $w.__loadAWindowsDocument__(url);
|
44
|
+
$env.load(url);
|
45
|
+
} else {
|
46
|
+
$env.unload($w);
|
47
|
+
var proxy = $w.window;
|
48
|
+
// print("re",url);
|
49
|
+
$env.reload(proxy, url);
|
50
|
+
}
|
51
|
+
});
|
52
|
+
|
53
|
+
$w.__defineGetter__("location", function(url){
|
54
|
+
var hash = new RegExp('(\\#.*)'),
|
55
|
+
hostname = new RegExp('\/\/([^\:\/]+)'),
|
56
|
+
pathname = new RegExp('(\/[^\\?\\#]*)'),
|
57
|
+
port = new RegExp('\:(\\d+)\/'),
|
58
|
+
protocol = new RegExp('(^\\w*\:)'),
|
59
|
+
search = new RegExp('(\\?[^\\#]*)');
|
60
|
+
return {
|
61
|
+
get hash(){
|
62
|
+
var m = hash.exec(this.href);
|
63
|
+
return m&&m.length>1?m[1]:"";
|
64
|
+
},
|
65
|
+
set hash(_hash){
|
66
|
+
//setting the hash is the only property of the location object
|
67
|
+
//that doesn't cause the window to reload
|
68
|
+
var prot = this.protocol;
|
69
|
+
// FIXME this is a hack until the new url stuff is integrated
|
70
|
+
if (prot === "file:") {
|
71
|
+
prot = "file:///";
|
72
|
+
} else {
|
73
|
+
// huh?
|
74
|
+
prot = prot + "//";
|
75
|
+
}
|
76
|
+
_hash = _hash.indexOf('#')===0?_hash:"#"+_hash;
|
77
|
+
$location = prot + this.host + this.pathname +
|
78
|
+
this.search + _hash;
|
79
|
+
__setHistory__(_hash, "hash");
|
80
|
+
},
|
81
|
+
get host(){
|
82
|
+
return this.hostname + ((this.port !== "")?":"+this.port:"");
|
83
|
+
},
|
84
|
+
set host(_host){
|
85
|
+
$w.location = this.protocol + _host + this.pathname +
|
86
|
+
this.search + this.hash;
|
87
|
+
},
|
88
|
+
get hostname(){
|
89
|
+
var m = hostname.exec(this.href);
|
90
|
+
return m&&m.length>1?m[1]:"";
|
91
|
+
},
|
92
|
+
set hostname(_hostname){
|
93
|
+
$w.location = this.protocol + _hostname + ((this.port==="")?"":(":"+this.port)) +
|
94
|
+
this.pathname + this.search + this.hash;
|
95
|
+
},
|
96
|
+
get href(){
|
97
|
+
//This is the only env specific function
|
98
|
+
return $location;
|
99
|
+
},
|
100
|
+
set href(url){
|
101
|
+
$w.location = url;
|
102
|
+
},
|
103
|
+
get pathname(){
|
104
|
+
var m = this.href;
|
105
|
+
m = pathname.exec(m.substring(m.indexOf(this.hostname)));
|
106
|
+
return m&&m.length>1?m[1]:"/";
|
107
|
+
},
|
108
|
+
set pathname(_pathname){
|
109
|
+
$w.location = this.protocol + this.host + _pathname +
|
110
|
+
this.search + this.hash;
|
111
|
+
},
|
112
|
+
get port(){
|
113
|
+
var m = port.exec(this.href);
|
114
|
+
return m&&m.length>1?m[1]:"";
|
115
|
+
},
|
116
|
+
set port(_port){
|
117
|
+
$w.location = this.protocol + this.hostname + ":"+_port + this.pathname +
|
118
|
+
this.search + this.hash;
|
119
|
+
},
|
120
|
+
get protocol(){
|
121
|
+
return this.href && protocol.exec(this.href)[0];
|
122
|
+
},
|
123
|
+
set protocol(_protocol){
|
124
|
+
$w.location = _protocol + this.host + this.pathname +
|
125
|
+
this.search + this.hash;
|
126
|
+
},
|
127
|
+
get search(){
|
128
|
+
var m = search.exec(this.href);
|
129
|
+
return m&&m.length>1?m[1]:"";
|
130
|
+
},
|
131
|
+
set search(_search){
|
132
|
+
$w.location = this.protocol + this.host + this.pathname +
|
133
|
+
_search + this.hash;
|
134
|
+
},
|
135
|
+
toString: function(){
|
136
|
+
return this.href;
|
137
|
+
},
|
138
|
+
reload: function(force){
|
139
|
+
// ignore 'force': we don't implement a cache
|
140
|
+
var thisWindow = $w;
|
141
|
+
$env.unload(thisWindow);
|
142
|
+
try { thisWindow = thisWindow.$thisWindowsProxyObject || thisWindow; }catch (e){}
|
143
|
+
$env.reload($window, thisWindow.location.href);
|
144
|
+
},
|
145
|
+
replace: function(url){
|
146
|
+
$location = url;
|
147
|
+
$w.location.reload();
|
148
|
+
}
|
149
|
+
};
|
150
|
+
});
|
151
|
+
|
152
|
+
// Local Variables:
|
153
|
+
// espresso-indent-level:4
|
154
|
+
// c-basic-offset:4
|
155
|
+
// tab-width:4
|
156
|
+
// End:
|
@@ -0,0 +1,48 @@
|
|
1
|
+
/*
|
2
|
+
* navigator.js
|
3
|
+
* - requires env
|
4
|
+
*/
|
5
|
+
$debug("Initializing Window Navigator.");
|
6
|
+
|
7
|
+
var $appCodeName = $env.appCodeName;//eg "Mozilla"
|
8
|
+
var $appName = $env.appName;//eg "Gecko/20070309 Firefox/2.0.0.3"
|
9
|
+
|
10
|
+
// Browser Navigator
|
11
|
+
$w.__defineGetter__("navigator", function(){
|
12
|
+
return {
|
13
|
+
get appCodeName(){
|
14
|
+
return $appCodeName;
|
15
|
+
},
|
16
|
+
get appName(){
|
17
|
+
return $appName;
|
18
|
+
},
|
19
|
+
get appVersion(){
|
20
|
+
return $version +" ("+
|
21
|
+
$w.navigator.platform +"; "+
|
22
|
+
"U; "+//?
|
23
|
+
$env.os_name+" "+$env.os_arch+" "+$env.os_version+"; "+
|
24
|
+
$env.lang+"; "+
|
25
|
+
"rv:"+$revision+
|
26
|
+
")";
|
27
|
+
},
|
28
|
+
get cookieEnabled(){
|
29
|
+
return true;
|
30
|
+
},
|
31
|
+
get mimeTypes(){
|
32
|
+
return [];
|
33
|
+
},
|
34
|
+
get platform(){
|
35
|
+
return $env.platform;
|
36
|
+
},
|
37
|
+
get plugins(){
|
38
|
+
return [];
|
39
|
+
},
|
40
|
+
get userAgent(){
|
41
|
+
return $w.navigator.appCodeName + "/" + $w.navigator.appVersion + " " + $w.navigator.appName;
|
42
|
+
},
|
43
|
+
javaEnabled : function(){
|
44
|
+
return $env.javaEnabled;
|
45
|
+
}
|
46
|
+
};
|
47
|
+
});
|
48
|
+
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/*
|
2
|
+
* screen.js
|
3
|
+
*/
|
4
|
+
$debug("Initializing Window Screen.");
|
5
|
+
|
6
|
+
var $availHeight = 600,
|
7
|
+
$availWidth = 800,
|
8
|
+
$colorDepth = 16,
|
9
|
+
$height = 600,
|
10
|
+
$width = 800;
|
11
|
+
|
12
|
+
$w.__defineGetter__("screen", function(){
|
13
|
+
return {
|
14
|
+
get availHeight(){return $availHeight;},
|
15
|
+
get availWidth(){return $availWidth;},
|
16
|
+
get colorDepth(){return $colorDepth;},
|
17
|
+
get height(){return $height;},
|
18
|
+
get width(){return $width;}
|
19
|
+
};
|
20
|
+
});
|
21
|
+
|
22
|
+
|
23
|
+
$w.moveBy = function(dx,dy){
|
24
|
+
//TODO
|
25
|
+
};
|
26
|
+
|
27
|
+
$w.moveTo = function(x,y) {
|
28
|
+
//TODO
|
29
|
+
};
|
30
|
+
|
31
|
+
/*$w.print = function(){
|
32
|
+
//TODO
|
33
|
+
};*/
|
34
|
+
|
35
|
+
$w.resizeBy = function(dw, dh){
|
36
|
+
$w.resizeTo($width+dw,$height+dh);
|
37
|
+
};
|
38
|
+
|
39
|
+
$w.resizeTo = function(width, height){
|
40
|
+
$width = (width <= $availWidth) ? width : $availWidth;
|
41
|
+
$height = (height <= $availHeight) ? height : $availHeight;
|
42
|
+
};
|
43
|
+
|
44
|
+
|
45
|
+
$w.scroll = function(x,y){
|
46
|
+
//TODO
|
47
|
+
};
|
48
|
+
$w.scrollBy = function(dx, dy){
|
49
|
+
//TODO
|
50
|
+
};
|
51
|
+
$w.scrollTo = function(x,y){
|
52
|
+
//TODO
|
53
|
+
};
|
data/src/window/timer.js
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
/*
|
2
|
+
* eventLoop.js
|
3
|
+
*/
|
4
|
+
|
5
|
+
$debug("Initializing Window EventLoop.");
|
6
|
+
|
7
|
+
$w.setTimeout = function(fn, time){
|
8
|
+
return $master.eventLoop.setTimeout($inner,fn,time);
|
9
|
+
};
|
10
|
+
|
11
|
+
$w.setInterval = function(fn, time){
|
12
|
+
return $master.eventLoop.setInterval($inner,fn,time);
|
13
|
+
};
|
14
|
+
|
15
|
+
$w.clearInterval = $w.clearTimeout = function(num){
|
16
|
+
return $master.eventLoop.clear(num);
|
17
|
+
};
|
18
|
+
|
19
|
+
$w.$wait = $env.wait = $env.wait || function(wait) {
|
20
|
+
return $master.eventLoop.wait(wait);
|
21
|
+
};
|
@@ -0,0 +1,284 @@
|
|
1
|
+
/*
|
2
|
+
* window.js
|
3
|
+
* - this file will be wrapped in a closure providing the window object as $w
|
4
|
+
*/
|
5
|
+
// a logger or empty function available to all modules.
|
6
|
+
var $log = $env.log,
|
7
|
+
$debug = $env.debug,
|
8
|
+
$info = $env.info,
|
9
|
+
$warn = $env.warn,
|
10
|
+
$error = $env.error;
|
11
|
+
|
12
|
+
//The version of this application
|
13
|
+
var $version = "0.1";
|
14
|
+
//This should be hooked to git or svn or whatever
|
15
|
+
var $revision = "0.0.0.0";
|
16
|
+
|
17
|
+
//These descriptions of window properties are taken loosely David Flanagan's
|
18
|
+
//'JavaScript - The Definitive Guide' (O'Reilly)
|
19
|
+
|
20
|
+
/**> $cookies - see cookie.js <*/
|
21
|
+
// read only boolean specifies whether the window has been closed
|
22
|
+
var $closed = false;
|
23
|
+
|
24
|
+
// a read/write string that specifies the default message that appears in the status line
|
25
|
+
var $defaultStatus = "Done";
|
26
|
+
|
27
|
+
// a read-only reference to the Document object belonging to this window
|
28
|
+
/**> $document - See document.js <*/
|
29
|
+
|
30
|
+
//IE only, refers to the most recent event object - this maybe be removed after review
|
31
|
+
var $event = null;
|
32
|
+
|
33
|
+
//A read-only array of window objects
|
34
|
+
//var $frames = []; // TODO: since window.frames can be accessed like a
|
35
|
+
// hash, will need an object to really implement
|
36
|
+
|
37
|
+
// a read-only reference to the History object
|
38
|
+
/**> $history - see location.js <**/
|
39
|
+
|
40
|
+
// read-only properties that specify the height and width, in pixels
|
41
|
+
var $innerHeight = 600, $innerWidth = 800;
|
42
|
+
|
43
|
+
// a read-only reference to the Location object. the location object does expose read/write properties
|
44
|
+
/**> $location - see location.js <**/
|
45
|
+
|
46
|
+
// The name of window/frame. Set directly, when using open(), or in frameset.
|
47
|
+
// May be used when specifying the target attribute of links
|
48
|
+
var $name;
|
49
|
+
|
50
|
+
// a read-only reference to the Navigator object
|
51
|
+
/**> $navigator - see navigator.js <**/
|
52
|
+
|
53
|
+
// a read/write reference to the Window object that contained the script that called open() to
|
54
|
+
//open this browser window. This property is valid only for top-level window objects.
|
55
|
+
|
56
|
+
var $opener = $openingWindow = options.opener;
|
57
|
+
|
58
|
+
// Read-only properties that specify the total height and width, in pixels, of the browser window.
|
59
|
+
// These dimensions include the height and width of the menu bar, toolbars, scrollbars, window
|
60
|
+
// borders and so on. These properties are not supported by IE and IE offers no alternative
|
61
|
+
// properties;
|
62
|
+
var $outerHeight = $innerHeight, $outerWidth = $innerWidth;
|
63
|
+
|
64
|
+
// Read-only properties that specify the number of pixels that the current document has been scrolled
|
65
|
+
//to the right and down. These are not supported by IE.
|
66
|
+
var $pageXOffset = 0, $pageYOffset = 0;
|
67
|
+
|
68
|
+
|
69
|
+
// A read-only reference to the Window object that contains this window
|
70
|
+
// or frame. If the window is a top-level window, parent refers to
|
71
|
+
// the window itself. If this window is a frame, this property refers
|
72
|
+
// to the window or frame that conatins it.
|
73
|
+
var $parent = options.parent || window;
|
74
|
+
try {
|
75
|
+
if ($parentWindow.$thisWindowsProxyObject)
|
76
|
+
$parent = $parentWindow.$thisWindowsProxyObject;
|
77
|
+
} catch(e){}
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
// a read-only refernce to the Screen object that specifies information about the screen:
|
82
|
+
// the number of available pixels and the number of available colors.
|
83
|
+
/**> $screen - see screen.js <**/
|
84
|
+
// read only properties that specify the coordinates of the upper-left corner of the screen.
|
85
|
+
var $screenX = 0, $screenY = 0;
|
86
|
+
var $screenLeft = $screenX, $screenTop = $screenY;
|
87
|
+
|
88
|
+
// a read/write string that specifies the current contents of the status line.
|
89
|
+
var $status = '';
|
90
|
+
|
91
|
+
// a read-only reference to the top-level window that contains this window. If this
|
92
|
+
// window is a top-level window it is simply a refernce to itself. If this window
|
93
|
+
// is a frame, the top property refers to the top-level window that contains the frame.
|
94
|
+
var $top = $parent && $parent.top || this;
|
95
|
+
|
96
|
+
// the window property is identical to the self property and to this obj
|
97
|
+
var $window = $w;
|
98
|
+
try {
|
99
|
+
if ($w.$thisWindowsProxyObject)
|
100
|
+
$window = $w.$thisWindowsProxyObject;
|
101
|
+
} catch(e){}
|
102
|
+
options.proxy && ( $window = options.proxy );
|
103
|
+
|
104
|
+
$debug("Initializing Window.");
|
105
|
+
__extend__($w,{
|
106
|
+
get closed(){return $closed;},
|
107
|
+
get defaultStatus(){return $defaultStatus;},
|
108
|
+
set defaultStatus(_defaultStatus){$defaultStatus = _defaultStatus;},
|
109
|
+
//get document(){return $document;}, - see document.js
|
110
|
+
get event(){return $event;},
|
111
|
+
|
112
|
+
get frames(){return undefined;}, // TODO: not yet any code to maintain list
|
113
|
+
get length(){return undefined;}, // should be frames.length, but.... TODO
|
114
|
+
|
115
|
+
//get history(){return $history;}, - see history.js
|
116
|
+
get innerHeight(){return $innerHeight;},
|
117
|
+
get innerWidth(){return $innerWidth;},
|
118
|
+
get clientHeight(){return $innerHeight;},
|
119
|
+
get clientWidth(){return $innerWidth;},
|
120
|
+
//get location(){return $location;}, see location.js
|
121
|
+
get name(){return $name;},
|
122
|
+
set name(newName){ $name = newName; },
|
123
|
+
//get navigator(){return $navigator;}, see navigator.js
|
124
|
+
get opener(){return $opener;},
|
125
|
+
get outerHeight(){return $outerHeight;},
|
126
|
+
get outerWidth(){return $outerWidth;},
|
127
|
+
get pageXOffest(){return $pageXOffset;},
|
128
|
+
get pageYOffset(){return $pageYOffset;},
|
129
|
+
get parent(){return $parent;},
|
130
|
+
//get screen(){return $screen;}, see screen.js
|
131
|
+
get screenLeft(){return $screenLeft;},
|
132
|
+
get screenTop(){return $screenTop;},
|
133
|
+
get screenX(){return $screenX;},
|
134
|
+
get screenY(){return $screenY;},
|
135
|
+
get self(){return $window;},
|
136
|
+
get status(){return $status;},
|
137
|
+
set status(_status){$status = _status;},
|
138
|
+
get top(){return $top || $window;},
|
139
|
+
get window(){return $window;},
|
140
|
+
|
141
|
+
// DOM0
|
142
|
+
|
143
|
+
Image: function() {
|
144
|
+
return document.createElement("img");
|
145
|
+
}
|
146
|
+
/*,
|
147
|
+
toString : function(){
|
148
|
+
return '[object Window]';
|
149
|
+
} FIX SMP */
|
150
|
+
});
|
151
|
+
|
152
|
+
$w.open = function(url, name, features, replace){
|
153
|
+
if (features)
|
154
|
+
$env.warn("'features' argument for 'window.open()' not yet implemented");
|
155
|
+
if (replace)
|
156
|
+
$env.warn("'replace' argument for 'window.open()' not yet implemented");
|
157
|
+
|
158
|
+
var undef;
|
159
|
+
if(url === undef || url === "") {
|
160
|
+
url = "about:blank";
|
161
|
+
}
|
162
|
+
|
163
|
+
var newWindow = $env.newwindow(this, null, url);
|
164
|
+
newWindow.$name = name;
|
165
|
+
return newWindow;
|
166
|
+
};
|
167
|
+
|
168
|
+
$w.close = function(){
|
169
|
+
$env.unload($w);
|
170
|
+
$closed = true;
|
171
|
+
};
|
172
|
+
|
173
|
+
$env.unload = function(windowToUnload){
|
174
|
+
try {
|
175
|
+
var event = windowToUnload.document.createEvent();
|
176
|
+
event.initEvent("unload");
|
177
|
+
windowToUnload.document.getElementsByTagName('body')[0].
|
178
|
+
dispatchEvent(event, false);
|
179
|
+
}
|
180
|
+
catch (e){} // maybe no/bad document loaded, ignore
|
181
|
+
|
182
|
+
var event = windowToUnload.document.createEvent();
|
183
|
+
event.initEvent("unload");
|
184
|
+
windowToUnload.dispatchEvent(event, false);
|
185
|
+
};
|
186
|
+
|
187
|
+
|
188
|
+
$env.load = function(url,xhr_options){
|
189
|
+
$location = $env.location(url);
|
190
|
+
__setHistory__($location);
|
191
|
+
try{
|
192
|
+
$w.document.load($location,xhr_options);
|
193
|
+
}catch(e){
|
194
|
+
$warn("Exception while loading window: "+e);
|
195
|
+
throw e;
|
196
|
+
}
|
197
|
+
};
|
198
|
+
|
199
|
+
|
200
|
+
/* Time related functions - see timer.js
|
201
|
+
* - clearTimeout
|
202
|
+
* - clearInterval
|
203
|
+
* - setTimeout
|
204
|
+
* - setInterval
|
205
|
+
*/
|
206
|
+
|
207
|
+
/*
|
208
|
+
* Events related functions - see event.js
|
209
|
+
* - addEventListener
|
210
|
+
* - attachEvent
|
211
|
+
* - detachEvent
|
212
|
+
* - removeEventListener
|
213
|
+
*
|
214
|
+
* These functions are identical to the Element equivalents.
|
215
|
+
*/
|
216
|
+
|
217
|
+
/*
|
218
|
+
* UIEvents related functions - see uievent.js
|
219
|
+
* - blur
|
220
|
+
* - focus
|
221
|
+
*
|
222
|
+
* These functions are identical to the Element equivalents.
|
223
|
+
*/
|
224
|
+
|
225
|
+
/* Dialog related functions - see dialog.js
|
226
|
+
* - alert
|
227
|
+
* - confirm
|
228
|
+
* - prompt
|
229
|
+
*/
|
230
|
+
|
231
|
+
/* Screen related functions - see screen.js
|
232
|
+
* - moveBy
|
233
|
+
* - moveTo
|
234
|
+
* - print
|
235
|
+
* - resizeBy
|
236
|
+
* - resizeTo
|
237
|
+
* - scrollBy
|
238
|
+
* - scrollTo
|
239
|
+
*/
|
240
|
+
|
241
|
+
/* CSS related functions - see css.js
|
242
|
+
* - getComputedStyle
|
243
|
+
*/
|
244
|
+
|
245
|
+
/*
|
246
|
+
* Shared utility methods
|
247
|
+
*/
|
248
|
+
// Helper method for extending one object with another.
|
249
|
+
function __extend__(a,b) {
|
250
|
+
for ( var i in b ) {
|
251
|
+
var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i);
|
252
|
+
if ( g || s ) {
|
253
|
+
if ( g ) a.__defineGetter__(i, g);
|
254
|
+
if ( s ) a.__defineSetter__(i, s);
|
255
|
+
} else
|
256
|
+
a[i] = b[i];
|
257
|
+
} return a;
|
258
|
+
};
|
259
|
+
|
260
|
+
|
261
|
+
// from ariel flesler http://flesler.blogspot.com/2008/11/fast-trim-function-for-javascript.html
|
262
|
+
// this might be a good utility function to provide in the env.core
|
263
|
+
// as in might be useful to the parser and other areas as well
|
264
|
+
function trim( str ){
|
265
|
+
return (str || "").replace( /^\s+|\s+$/g, "" );
|
266
|
+
|
267
|
+
};
|
268
|
+
/*function trim( str ){
|
269
|
+
var start = -1,
|
270
|
+
end = str.length;
|
271
|
+
/*jsl:ignore*
|
272
|
+
while( str.charCodeAt(--end) < 33 );
|
273
|
+
while( str.charCodeAt(++start) < 33 );
|
274
|
+
/*jsl:end*
|
275
|
+
return str.slice( start, end + 1 );
|
276
|
+
};*/
|
277
|
+
|
278
|
+
//from jQuery
|
279
|
+
function __setArray__( target, array ) {
|
280
|
+
// Resetting the length to 0, then using the native Array push
|
281
|
+
// is a super-fast way to populate an object with array-like properties
|
282
|
+
target.length = 0;
|
283
|
+
Array.prototype.push.apply( target, array );
|
284
|
+
};
|