juice 0.1.3 → 0.1.4
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/{History.txt → History.txt } +0 -0
- data/Manifest.txt +37 -0
- data/{PostInstall.txt → PostInstall.txt } +0 -0
- data/{README.rdoc → README.rdoc } +0 -0
- data/StarterApplication/Framework/Juice.Alert.js +59 -0
- data/StarterApplication/Framework/Juice.Application.js +33 -0
- data/StarterApplication/Framework/Juice.Button.js +25 -0
- data/StarterApplication/Framework/Juice.Confirm.js +42 -0
- data/StarterApplication/Framework/Juice.Cookie.js +50 -0
- data/StarterApplication/Framework/Juice.DOM.js +223 -0
- data/StarterApplication/Framework/Juice.Event.js +57 -0
- data/StarterApplication/Framework/Juice.Image.js +38 -0
- data/StarterApplication/Framework/Juice.JSONPConnection.js +42 -0
- data/StarterApplication/Framework/Juice.Layout.js +29 -0
- data/StarterApplication/Framework/Juice.Window.js +73 -0
- data/StarterApplication/Framework/Juice.i18n.js +46 -0
- data/StarterApplication/Framework/Juice.js +324 -0
- data/StarterApplication/Framework/Resources/Themes/Default.css +85 -0
- data/StarterApplication/Framework/Resources/Themes/Default/images/Thumbs.db +0 -0
- data/StarterApplication/Framework/Resources/Themes/Default/images/button-sprite.png +0 -0
- data/StarterApplication/Framework/Resources/Themes/Default/images/spinner.gif +0 -0
- data/StarterApplication/Framework/Resources/images/Thumbs.db +0 -0
- data/StarterApplication/Framework/Resources/images/spinner.gif +0 -0
- data/StarterApplication/LICENSE +20 -0
- data/StarterApplication/README +6 -0
- data/StarterApplication/appController.js +18 -0
- data/StarterApplication/index.html +26 -0
- data/StarterApplication/juice.app +5 -0
- data/bin/juice +78 -0
- data/lib/{JSquish.rb → JSquish.rb } +0 -0
- data/lib/{juice.rb → juice.rb } +1 -1
- data/script/{console → console } +0 -0
- data/script/{console.cmd → console.cmd } +0 -0
- data/script/{destroy → destroy } +0 -0
- data/script/{destroy.cmd → destroy.cmd } +0 -0
- data/script/{generate → generate } +0 -0
- data/script/{generate.cmd → generate.cmd } +0 -0
- metadata +41 -20
- data/Manifest.txt +0 -14
- data/Rakefile +0 -20
File without changes
|
data/Manifest.txt
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
PostInstall.txt
|
4
|
+
README.rdoc
|
5
|
+
bin/juice
|
6
|
+
lib/juice.rb
|
7
|
+
lib/JSquish.rb
|
8
|
+
script/generate.cmd
|
9
|
+
script/generate
|
10
|
+
script/destroy.cmd
|
11
|
+
script/destroy
|
12
|
+
script/console.cmd
|
13
|
+
script/console
|
14
|
+
StarterApplication/README
|
15
|
+
StarterApplication/LICENSE
|
16
|
+
StarterApplication/juice.app
|
17
|
+
StarterApplication/index.html
|
18
|
+
StarterApplication/Framework/Resources/Themes/Default.css
|
19
|
+
StarterApplication/Framework/Resources/Themes/Default/images/Thumbs.db
|
20
|
+
StarterApplication/Framework/Resources/Themes/Default/images/spinner.gif
|
21
|
+
StarterApplication/Framework/Resources/Themes/Default/images/button-sprite.png
|
22
|
+
StarterApplication/Framework/Resources/images/Thumbs.db
|
23
|
+
StarterApplication/Framework/Resources/images/spinner.gif
|
24
|
+
StarterApplication/Framework/Juice.Window.js
|
25
|
+
StarterApplication/Framework/Juice.Layout.js
|
26
|
+
StarterApplication/Framework/Juice.JSONPConnection.js
|
27
|
+
StarterApplication/Framework/Juice.js
|
28
|
+
StarterApplication/Framework/Juice.Image.js
|
29
|
+
StarterApplication/Framework/Juice.i18n.js
|
30
|
+
StarterApplication/Framework/Juice.Event.js
|
31
|
+
StarterApplication/Framework/Juice.DOM.js
|
32
|
+
StarterApplication/Framework/Juice.Cookie.js
|
33
|
+
StarterApplication/Framework/Juice.Confirm.js
|
34
|
+
StarterApplication/Framework/Juice.Button.js
|
35
|
+
StarterApplication/Framework/Juice.Application.js
|
36
|
+
StarterApplication/Framework/Juice.Alert.js
|
37
|
+
StarterApplication/appController.js
|
File without changes
|
File without changes
|
@@ -0,0 +1,59 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009 Justin Baker
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
*/
|
23
|
+
|
24
|
+
Juice.Alert = Juice.Class.create();
|
25
|
+
Juice.Alert.prototype = {
|
26
|
+
initialize: function(options){
|
27
|
+
this.name = (10).toRandomString();
|
28
|
+
this.options = options || {};
|
29
|
+
this.options.text = this.options.text || "Empty";
|
30
|
+
var div = document.createElement("div"), insideDiv = document.createElement("div");
|
31
|
+
this.element = div;
|
32
|
+
div.setAttribute('id',this.name);
|
33
|
+
div.setAttribute('class',Juice._classes._alert);
|
34
|
+
if(this.options.title){
|
35
|
+
var h1 = document.createElement('h1');
|
36
|
+
h1.innerHTML = this.options.title;
|
37
|
+
div.appendChild(h1);
|
38
|
+
}
|
39
|
+
div.appendChild(insideDiv);
|
40
|
+
insideDiv.innerHTML = this.options.text;
|
41
|
+
var body = Juice.Layout.body;
|
42
|
+
body.appendChild(div);
|
43
|
+
var half_height = (Juice.Layout.fullHeight/2)-(div.getHeight()/2);
|
44
|
+
var half_width = (Juice.Layout.fullWidth/2)-(div.getWidth()/2);
|
45
|
+
|
46
|
+
div.setStyle({
|
47
|
+
top: half_height+'px',
|
48
|
+
left:half_width+"px",
|
49
|
+
display:'block'
|
50
|
+
});
|
51
|
+
},
|
52
|
+
remove: function(){
|
53
|
+
this.element.remove();
|
54
|
+
},
|
55
|
+
addButton: function(content,fn){
|
56
|
+
var button = new Juice.Button(content,fn);
|
57
|
+
this.element.appendChild(button.contentView());
|
58
|
+
}
|
59
|
+
};
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009 Justin Baker
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
*/
|
23
|
+
Juice.Application = Juice.Class.create();
|
24
|
+
Juice.Application.prototype = {
|
25
|
+
initialize: function(){
|
26
|
+
return this;
|
27
|
+
},
|
28
|
+
addSubview: function(view){
|
29
|
+
var body = Juice.Layout.body;
|
30
|
+
body.appendChild(view);
|
31
|
+
}
|
32
|
+
};
|
33
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Juice.Button = Juice.Class.create();
|
2
|
+
Juice.Button.prototype={
|
3
|
+
initialize: function(content,fn){
|
4
|
+
this.name = (10).toRandomString();
|
5
|
+
this.content = content || "Click"
|
6
|
+
var button = document.createElement("button");
|
7
|
+
button.writeAttributes({
|
8
|
+
"class": Juice._classes.button,
|
9
|
+
id:this.name
|
10
|
+
});
|
11
|
+
if(fn){
|
12
|
+
button.observe("click",function(event){
|
13
|
+
fn.call();
|
14
|
+
});
|
15
|
+
}
|
16
|
+
button.innerHTML = this.content;
|
17
|
+
this.button = button;
|
18
|
+
},
|
19
|
+
remove: function(){
|
20
|
+
Juice.$(this.name).remove();
|
21
|
+
},
|
22
|
+
contentView: function(){
|
23
|
+
return this.button;
|
24
|
+
}
|
25
|
+
};
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009 Justin Baker
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
*/
|
23
|
+
|
24
|
+
Juice.Confirm = Juice.Class.create();
|
25
|
+
Juice.Confirm.prototype = {
|
26
|
+
initialize: function(options){
|
27
|
+
options.title = 'Confirm';
|
28
|
+
var alert = new Juice.Alert(options);
|
29
|
+
alert.addButton('Okay',function(){
|
30
|
+
alert.remove();
|
31
|
+
options.callback(true);
|
32
|
+
});
|
33
|
+
alert.addButton('Cancel',function(){
|
34
|
+
alert.remove();
|
35
|
+
options.callback(false);
|
36
|
+
});
|
37
|
+
|
38
|
+
},
|
39
|
+
remove: function(){
|
40
|
+
this.element.remove();
|
41
|
+
}
|
42
|
+
};
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009 Justin Baker
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
*/
|
23
|
+
Juice.Cookie = Juice.Class.create();
|
24
|
+
Juice.Cookie.prototype = {
|
25
|
+
initialize:function(name,value,days) {
|
26
|
+
this.name = name;
|
27
|
+
this.value = value;
|
28
|
+
if (days) {
|
29
|
+
var date = new Date();
|
30
|
+
date.setTime(date.getTime()+(days*24*60*60*1000));
|
31
|
+
var expires = "; expires="+date.toGMTString();
|
32
|
+
}
|
33
|
+
else var expires = "";
|
34
|
+
document.cookie = this.name+"="+this.value+expires+"; path=/";
|
35
|
+
},
|
36
|
+
read:function() {
|
37
|
+
var nameEQ = this.name + "=";
|
38
|
+
var ca = document.cookie.split(';');
|
39
|
+
for(var i=0;i < ca.length;i++) {
|
40
|
+
var c = ca[i];
|
41
|
+
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
42
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
|
43
|
+
}
|
44
|
+
return null;
|
45
|
+
},
|
46
|
+
erase:function() {
|
47
|
+
new Juice.Cookie(this.name,"",-1);
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
@@ -0,0 +1,223 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2009 Justin Baker
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
*/
|
23
|
+
(function(){
|
24
|
+
var core_functions = {
|
25
|
+
getHeight: function(element){
|
26
|
+
var el = element || this;
|
27
|
+
var height = el.getStyle("height");
|
28
|
+
if(height=='auto'){
|
29
|
+
height = el.offsetHeight;
|
30
|
+
}
|
31
|
+
else{
|
32
|
+
height = parseInt(height);
|
33
|
+
}
|
34
|
+
var pt = parseInt(el.getStyle("padding-top"));
|
35
|
+
var pb = parseInt(el.getStyle("padding-bottom"));
|
36
|
+
var bt = el.getStyle("border-top-width");
|
37
|
+
var bb = el.getStyle("border-bottom-width");
|
38
|
+
switch(bt){
|
39
|
+
case 'thin':
|
40
|
+
bt=2;
|
41
|
+
break;
|
42
|
+
case 'medium':
|
43
|
+
bt=4;
|
44
|
+
break;
|
45
|
+
case 'thick':
|
46
|
+
bt=6;
|
47
|
+
break;
|
48
|
+
default:
|
49
|
+
bt = parseInt(bt);
|
50
|
+
}
|
51
|
+
switch(bb){
|
52
|
+
case 'thin':
|
53
|
+
bb=2;
|
54
|
+
break;
|
55
|
+
case 'medium':
|
56
|
+
bb=4;
|
57
|
+
break;
|
58
|
+
case 'thick':
|
59
|
+
bb=6;
|
60
|
+
break;
|
61
|
+
default:
|
62
|
+
bb = parseInt(bb);
|
63
|
+
}
|
64
|
+
return height+pt+pb+bt+bb;
|
65
|
+
},
|
66
|
+
getWidth: function(element){
|
67
|
+
var el = element || this;
|
68
|
+
var width = el.getStyle("width");
|
69
|
+
if(width=='auto'){
|
70
|
+
width = el.offsetWidth;
|
71
|
+
}
|
72
|
+
else{
|
73
|
+
width = parseInt(width);
|
74
|
+
}
|
75
|
+
var pl = parseInt(el.getStyle("padding-left"));
|
76
|
+
var pr = parseInt(el.getStyle("padding-right"));
|
77
|
+
var bl = parseInt(el.getStyle("border-left-width"));
|
78
|
+
var br = parseInt(el.getStyle("border-right-width"));
|
79
|
+
switch(bl){
|
80
|
+
case 'thin':
|
81
|
+
bl=2;
|
82
|
+
break;
|
83
|
+
case 'medium':
|
84
|
+
bl=4;
|
85
|
+
break;
|
86
|
+
case 'thick':
|
87
|
+
bl=6;
|
88
|
+
break;
|
89
|
+
default:
|
90
|
+
bl = parseInt(bl);
|
91
|
+
}
|
92
|
+
switch(br){
|
93
|
+
case 'thin':
|
94
|
+
br=2;
|
95
|
+
break;
|
96
|
+
case 'medium':
|
97
|
+
br=4;
|
98
|
+
break;
|
99
|
+
case 'thick':
|
100
|
+
br=6;
|
101
|
+
break;
|
102
|
+
default:
|
103
|
+
br = parseInt(br);
|
104
|
+
}
|
105
|
+
return width+pl+pr+bl+br;
|
106
|
+
},
|
107
|
+
observe: function(name,fn){
|
108
|
+
var event = new Juice.Event(this,name,fn);
|
109
|
+
event.create();
|
110
|
+
return this;
|
111
|
+
},
|
112
|
+
getStyle: function(strCssRule){
|
113
|
+
var strValue;
|
114
|
+
if(document.defaultView && document.defaultView.getComputedStyle){
|
115
|
+
strValue = document.defaultView.getComputedStyle(this, "").getPropertyValue(strCssRule);
|
116
|
+
}
|
117
|
+
else if(this.currentStyle){
|
118
|
+
strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
|
119
|
+
return p1.toUpperCase();
|
120
|
+
});
|
121
|
+
strValue = this.currentStyle[strCssRule];
|
122
|
+
}
|
123
|
+
return strValue;
|
124
|
+
},
|
125
|
+
remove: function(){
|
126
|
+
this.parentNode.removeChild(this);
|
127
|
+
},
|
128
|
+
visible: function() {
|
129
|
+
return this.style.display != 'none';
|
130
|
+
},
|
131
|
+
toggle: function() {
|
132
|
+
core_functions[this.visible() ? 'hide' : 'show'](this);
|
133
|
+
return this;
|
134
|
+
},
|
135
|
+
hide: function() {
|
136
|
+
this.style.display = 'none';
|
137
|
+
return this;
|
138
|
+
},
|
139
|
+
show: function() {
|
140
|
+
this.style.display = '';
|
141
|
+
return this;
|
142
|
+
},
|
143
|
+
setStyle:function(styles){
|
144
|
+
for(var prop in styles){
|
145
|
+
this.style[prop] = styles[prop];
|
146
|
+
}
|
147
|
+
},
|
148
|
+
writeAttributes:function(attr){
|
149
|
+
for(var prop in attr){
|
150
|
+
this.setAttribute(prop,attr[prop])
|
151
|
+
}
|
152
|
+
},
|
153
|
+
getChildren: function(){
|
154
|
+
var results=[], elements = this.childNodes;
|
155
|
+
for(var element in elements){
|
156
|
+
if(elements[element].nodeType==1){
|
157
|
+
results.push(elements[element]);
|
158
|
+
}
|
159
|
+
};
|
160
|
+
return Juice.Object.toArray(results);
|
161
|
+
},
|
162
|
+
descendents:function(){
|
163
|
+
return Juice.Object.toArray(this.getElementsByTagName('*'));
|
164
|
+
},
|
165
|
+
inspect: function(){
|
166
|
+
var tag = this.tagName.toLowerCase();
|
167
|
+
var id = "#"+this.id;
|
168
|
+
var classN = "."+this.className;
|
169
|
+
return "#<HTMLElement:"+tag+classN+id;
|
170
|
+
}
|
171
|
+
};
|
172
|
+
Juice.Object.extend(Juice,{DOM:{}});
|
173
|
+
Juice.Object.extend(Juice.DOM,{
|
174
|
+
extend: function(fns){
|
175
|
+
var isIE = (window.navigator.userAgent.indexOf("MSIE") > 0);
|
176
|
+
if(!isIE){
|
177
|
+
Juice.Object.extend(HTMLElement.prototype,fns);
|
178
|
+
}
|
179
|
+
else{
|
180
|
+
// Fix document.createElement
|
181
|
+
var _getCreate = document.createElement;
|
182
|
+
function fixCreate(tag){
|
183
|
+
var _elem = _getCreate(tag);
|
184
|
+
for(var i in fns){
|
185
|
+
_elem[i] = fns[i]
|
186
|
+
}
|
187
|
+
return _elem;
|
188
|
+
}
|
189
|
+
document.createElement = fixCreate;
|
190
|
+
// Fix document.getElementById
|
191
|
+
var _getId = document.getElementById;
|
192
|
+
function fixId(id){
|
193
|
+
var _elem = _getId(id);
|
194
|
+
if(_elem != null){
|
195
|
+
for(var i in fns){
|
196
|
+
_elem[i] = fns[i]
|
197
|
+
}
|
198
|
+
}
|
199
|
+
return _elem;
|
200
|
+
}
|
201
|
+
document.getElementById = fixId;
|
202
|
+
// Fix document.getElementsByTagName
|
203
|
+
var _getTags = document.getElementsByTagName;
|
204
|
+
function fixTags(tag){
|
205
|
+
var _elem = _getTags(tag);
|
206
|
+
if(_elem != null){
|
207
|
+
for(var index=0; i < _elem.length; i++){
|
208
|
+
for(var i in fns){
|
209
|
+
_elem[index][i] = fns[i];
|
210
|
+
}
|
211
|
+
}
|
212
|
+
}
|
213
|
+
return _elem;
|
214
|
+
}
|
215
|
+
document.getElementsByTagName = fixTags;
|
216
|
+
// Extend the dom quick..
|
217
|
+
document.getElementsByTagName("*");
|
218
|
+
}
|
219
|
+
}
|
220
|
+
});
|
221
|
+
// This is also our method exposed to extend the dom
|
222
|
+
Juice.DOM.extend(core_functions);
|
223
|
+
})();
|