]>
Commit | Line | Data |
---|---|---|
2f01fe57 AD |
1 | /* |
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved. | |
3 | Available via Academic Free License >= 2.1 OR the modified BSD license. | |
4 | see: http://dojotoolkit.org/license for details | |
5 | */ | |
6 | ||
7 | ||
8 | if(dojo.config["baseUrl"]){ | |
9 | dojo.baseUrl=dojo.config["baseUrl"]; | |
10 | }else{ | |
11 | dojo.baseUrl="./"; | |
12 | } | |
13 | dojo.locale=dojo.locale||String(java.util.Locale.getDefault().toString().replace("_","-").toLowerCase()); | |
14 | dojo._name="rhino"; | |
15 | dojo.isRhino=true; | |
16 | if(typeof print=="function"){ | |
17 | console.debug=print; | |
18 | } | |
19 | if(!("byId" in dojo)){ | |
20 | dojo.byId=function(id,_1){ | |
21 | if(id&&(typeof id=="string"||id instanceof String)){ | |
22 | if(!_1){ | |
23 | _1=document; | |
24 | } | |
25 | return _1.getElementById(id); | |
26 | } | |
27 | return id; | |
28 | }; | |
29 | } | |
30 | dojo._isLocalUrl=function(_2){ | |
31 | var _3=(new java.io.File(_2)).exists(); | |
32 | if(!_3){ | |
33 | var _4; | |
34 | try{ | |
35 | _4=(new java.net.URL(_2)).openStream(); | |
36 | _4.close(); | |
37 | } | |
38 | finally{ | |
39 | if(_4&&_4.close){ | |
40 | _4.close(); | |
41 | } | |
42 | } | |
43 | } | |
44 | return _3; | |
45 | }; | |
46 | dojo._loadUri=function(_5,cb){ | |
47 | try{ | |
48 | var _6; | |
49 | try{ | |
50 | _6=dojo._isLocalUrl(_5); | |
51 | } | |
52 | catch(e){ | |
53 | return false; | |
54 | } | |
55 | if(cb){ | |
56 | var _7=(_6?readText:readUri)(_5,"UTF-8"); | |
57 | if(!eval("''").length){ | |
58 | _7=String(_7).replace(/[\u200E\u200F\u202A-\u202E]/g,function(_8){ | |
59 | return "\\u"+_8.charCodeAt(0).toString(16); | |
60 | }); | |
61 | } | |
62 | cb(eval("("+_7+")")); | |
63 | }else{ | |
64 | load(_5); | |
65 | } | |
66 | return true; | |
67 | } | |
68 | catch(e){ | |
69 | return false; | |
70 | } | |
71 | }; | |
72 | dojo.exit=function(_9){ | |
73 | quit(_9); | |
74 | }; | |
75 | function readText(_a,_b){ | |
76 | _b=_b||"utf-8"; | |
77 | var jf=new java.io.File(_a); | |
78 | var is=new java.io.FileInputStream(jf); | |
79 | return dj_readInputStream(is,_b); | |
80 | }; | |
81 | function readUri(_c,_d){ | |
82 | var _e=(new java.net.URL(_c)).openConnection(); | |
83 | _d=_d||_e.getContentEncoding()||"utf-8"; | |
84 | var is=_e.getInputStream(); | |
85 | return dj_readInputStream(is,_d); | |
86 | }; | |
87 | function dj_readInputStream(is,_f){ | |
88 | var _10=new java.io.BufferedReader(new java.io.InputStreamReader(is,_f)); | |
89 | try{ | |
90 | var sb=new java.lang.StringBuffer(); | |
91 | var _11=""; | |
92 | while((_11=_10.readLine())!==null){ | |
93 | sb.append(_11); | |
94 | sb.append(java.lang.System.getProperty("line.separator")); | |
95 | } | |
96 | return sb.toString(); | |
97 | } | |
98 | finally{ | |
99 | _10.close(); | |
100 | } | |
101 | }; | |
102 | dojo._getText=function(uri,_12){ | |
103 | try{ | |
104 | var _13=dojo._isLocalUrl(uri); | |
105 | var _14=(_13?readText:readUri)(uri,"UTF-8"); | |
106 | if(_14!==null){ | |
107 | _14+=""; | |
108 | } | |
109 | return _14; | |
110 | } | |
111 | catch(e){ | |
112 | if(_12){ | |
113 | return null; | |
114 | }else{ | |
115 | throw e; | |
116 | } | |
117 | } | |
118 | }; | |
119 | dojo.doc=typeof document!="undefined"?document:null; | |
120 | dojo.body=function(){ | |
121 | return document.body; | |
122 | }; | |
123 | if(typeof setTimeout=="undefined"||typeof clearTimeout=="undefined"){ | |
124 | dojo._timeouts=[]; | |
125 | clearTimeout=function(idx){ | |
126 | if(!dojo._timeouts[idx]){ | |
127 | return; | |
128 | } | |
129 | dojo._timeouts[idx].stop(); | |
130 | }; | |
131 | setTimeout=function(_15,_16){ | |
132 | var def={sleepTime:_16,hasSlept:false,run:function(){ | |
133 | if(!this.hasSlept){ | |
134 | this.hasSlept=true; | |
135 | java.lang.Thread.currentThread().sleep(this.sleepTime); | |
136 | } | |
137 | try{ | |
138 | _15(); | |
139 | } | |
140 | catch(e){ | |
141 | } | |
142 | }}; | |
143 | var _17=new java.lang.Runnable(def); | |
144 | var _18=new java.lang.Thread(_17); | |
145 | _18.start(); | |
146 | return dojo._timeouts.push(_18)-1; | |
147 | }; | |
148 | } | |
149 | if(dojo.config["modulePaths"]){ | |
150 | for(var param in dojo.config["modulePaths"]){ | |
151 | dojo.registerModulePath(param,dojo.config["modulePaths"][param]); | |
152 | } | |
153 | } |