smparkes-envjs 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/envjsrb +157 -73
- data/bin/jquery-1.3.2-test.js +11 -4
- data/lib/envjs/env.js +935 -11028
- data/lib/envjs/net/cgi.rb +94 -0
- data/lib/envjs/net/file.rb +4 -4
- data/lib/envjs/runtime.rb +80 -24
- data/test/call-load-test.js +0 -2
- 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/html/malformed.html +1 -0
- data/test/index.html +21 -19
- data/test/{primaryTests.js → primary-tests.js} +1 -3
- data/test/{prototype.js → prototype-test.js} +0 -2
- data/test/qunit/qunit/qunit.css +0 -0
- data/test/qunit/qunit/qunit.js +2 -2
- data/test/{qunit/qunit/qunit.js.smp → specs/dist/env.spec.js} +539 -7
- 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/{qunit.smp/qunit → specs}/qunit.css +0 -0
- data/test/{qunit.smp/qunit → specs}/qunit.js +2 -2
- 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/elementmembers.js +31 -0
- data/test/unit/nu.validator.js +34 -0
- data/test/unit/onload.js +1 -3
- data/test/unit/parser.js +106 -98
- data/test/unit/prototypecompat.js +2 -2
- data/test/vendor/jQuery/1.3.2/ChangeLog.txt +98 -0
- data/test/vendor/jQuery/1.3.2/GPL-LICENSE.txt +278 -0
- data/test/vendor/jQuery/1.3.2/MIT-LICENSE.txt +20 -0
- data/test/vendor/jQuery/1.3.2/Makefile +154 -0
- data/test/vendor/jQuery/1.3.2/README +67 -0
- data/test/vendor/jQuery/1.3.2/build/ant-contrib-0.6.jar +0 -0
- data/test/vendor/jQuery/1.3.2/build/build/min.js +11 -0
- data/test/vendor/jQuery/1.3.2/build/build/pack.js +19 -0
- data/test/vendor/jQuery/1.3.2/build/js/Packer.js +209 -0
- data/test/vendor/jQuery/1.3.2/build/js/ParseMaster.js +106 -0
- data/test/vendor/jQuery/1.3.2/build/js/Words.js +62 -0
- data/test/vendor/jQuery/1.3.2/build/js/base2.js +978 -0
- data/test/vendor/jQuery/1.3.2/build/js/jsmin.js +316 -0
- data/test/vendor/jQuery/1.3.2/build/js/json.js +117 -0
- data/test/vendor/jQuery/1.3.2/build/js/pack.js +316 -0
- data/test/vendor/jQuery/1.3.2/build/js/parse.js +105 -0
- data/test/vendor/jQuery/1.3.2/build/js/writeFile.js +19 -0
- data/test/vendor/jQuery/1.3.2/build/js/xml.js +25 -0
- data/test/vendor/jQuery/1.3.2/build/js.jar +0 -0
- data/test/vendor/jQuery/1.3.2/build/runtest/env.js +1 -0
- data/test/vendor/jQuery/1.3.2/build/runtest/test.js +106 -0
- data/test/vendor/jQuery/1.3.2/build/runtest/testrunner.js +197 -0
- data/test/vendor/jQuery/1.3.2/build/speed/benchmarker.css +65 -0
- data/test/vendor/jQuery/1.3.2/build/speed/benchmarker.js +181 -0
- data/test/vendor/jQuery/1.3.2/build/speed/index.html +72 -0
- data/test/vendor/jQuery/1.3.2/build/speed/jquery-basis.js +3549 -0
- data/test/vendor/jQuery/1.3.2/build/style.xsl +99 -0
- data/test/vendor/jQuery/1.3.2/build/yuicompressor-2.4.2.jar +0 -0
- data/test/vendor/jQuery/1.3.2/build.xml +123 -0
- data/test/vendor/jQuery/1.3.2/dist/jquery.js +4376 -0
- data/test/vendor/jQuery/1.3.2/reminder.txt +3 -0
- data/test/vendor/jQuery/1.3.2/src/ajax.js +541 -0
- data/test/vendor/jQuery/1.3.2/src/core.js +1255 -0
- data/test/vendor/jQuery/1.3.2/src/data.js +145 -0
- data/test/vendor/jQuery/1.3.2/src/dimensions.js +49 -0
- data/test/vendor/jQuery/1.3.2/src/event.js +684 -0
- data/test/vendor/jQuery/1.3.2/src/fx.js +407 -0
- data/test/vendor/jQuery/1.3.2/src/intro.js +13 -0
- data/test/vendor/jQuery/1.3.2/src/offset.js +155 -0
- data/test/vendor/jQuery/1.3.2/src/outro.js +1 -0
- data/test/vendor/jQuery/1.3.2/src/selector.js +1015 -0
- data/test/vendor/jQuery/1.3.2/src/support.js +112 -0
- data/test/vendor/jQuery/1.3.2/test/data/cow.jpg +0 -0
- data/test/vendor/jQuery/1.3.2/test/data/dashboard.xml +11 -0
- data/test/vendor/jQuery/1.3.2/test/data/echoQuery.php +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/iframe.html +8 -0
- data/test/vendor/jQuery/1.3.2/test/data/json.php +9 -0
- data/test/vendor/jQuery/1.3.2/test/data/json_assigned_obj.js +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/json_obj.js +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/jsonp.php +10 -0
- data/test/vendor/jQuery/1.3.2/test/data/name.html +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/name.php +29 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/absolute.html +39 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/body.html +24 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/fixed.html +33 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/relative.html +31 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/scroll.html +39 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/static.html +31 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/table.html +43 -0
- data/test/vendor/jQuery/1.3.2/test/data/params_html.php +12 -0
- data/test/vendor/jQuery/1.3.2/test/data/test.html +7 -0
- data/test/vendor/jQuery/1.3.2/test/data/test.js +3 -0
- data/test/vendor/jQuery/1.3.2/test/data/test.php +7 -0
- data/test/vendor/jQuery/1.3.2/test/data/test2.html +5 -0
- data/test/vendor/jQuery/1.3.2/test/data/test3.html +3 -0
- data/test/vendor/jQuery/1.3.2/test/data/testrunner.js +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/text.php +12 -0
- data/test/vendor/jQuery/1.3.2/test/data/with_fries.xml +25 -0
- data/test/vendor/jQuery/1.3.2/test/index.html +229 -0
- data/test/vendor/jQuery/1.3.2/test/jqenv-1259090275493.html +247 -0
- data/test/vendor/jQuery/1.3.2/test/jqenv-1259091671501.html +247 -0
- data/test/vendor/jQuery/1.3.2/test/jqenv-1259175319655.html +247 -0
- data/test/vendor/jQuery/1.3.2/test/offset.html +28 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/jquery/1.2.1/jquery.js +11 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/jquery/1.2.3/jquery.js +11 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/mootools/1.11/mootools.js +1577 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/prototype/1.6.0.2/prototype.js +4221 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/builder.js +131 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/controls.js +835 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/dragdrop.js +944 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/effects.js +1090 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/scriptaculous.js +51 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/slider.js +278 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/unittest.js +564 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/builder.js +136 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/controls.js +965 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/dragdrop.js +974 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/effects.js +1122 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/scriptaculous.js +58 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/slider.js +275 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/sound.js +55 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/unittest.js +568 -0
- data/test/vendor/jQuery/1.3.2/test/polluted.php +64 -0
- data/test/vendor/jQuery/1.3.2/test/qunit/testrunner.js +780 -0
- data/test/vendor/jQuery/1.3.2/test/qunit/testsuite.css +120 -0
- data/test/vendor/jQuery/1.3.2/test/test.js +41 -0
- data/test/vendor/jQuery/1.3.2/test/unit/ajax.js +856 -0
- data/test/vendor/jQuery/1.3.2/test/unit/core.js +1872 -0
- data/test/vendor/jQuery/1.3.2/test/unit/data.js +160 -0
- data/test/vendor/jQuery/1.3.2/test/unit/dimensions.js +86 -0
- data/test/vendor/jQuery/1.3.2/test/unit/event.js +670 -0
- data/test/vendor/jQuery/1.3.2/test/unit/fx.js +451 -0
- data/test/vendor/jQuery/1.3.2/test/unit/offset.js +173 -0
- data/test/vendor/jQuery/1.3.2/test/unit/selector.js +395 -0
- data/test/vendor/jQuery/1.3.2/test/xhtml.php +5 -0
- data/test/vendor/jQuery/1.3.2/version.txt +1 -0
- metadata +158 -22
- data/lib/envjs/runtime.rb.smp +0 -133
- data/test/envjs-call-load-test.js +0 -5
- data/test/envjs-prototype.js +0 -5
- data/test/qunit/package.json +0 -21
- data/test/qunit/test/index.html +0 -17
- data/test/qunit/test/same.js +0 -1368
- data/test/qunit/test/test.js +0 -136
- data/test/qunit.smp/package.json +0 -21
- data/test/qunit.smp/test/index.html +0 -17
- data/test/qunit.smp/test/same.js +0 -1368
- data/test/qunit.smp/test/test.js +0 -136
- data/test/rhino-call-load-test.js +0 -5
- data/test/rhino-prototype.js +0 -5
- data/test/test-with-envs-jar.js +0 -8
- data/test/test-with-rhino-jar.js +0 -9
@@ -0,0 +1,407 @@
|
|
1
|
+
var elemdisplay = {},
|
2
|
+
timerId,
|
3
|
+
fxAttrs = [
|
4
|
+
// height animations
|
5
|
+
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
|
6
|
+
// width animations
|
7
|
+
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
|
8
|
+
// opacity animations
|
9
|
+
[ "opacity" ]
|
10
|
+
];
|
11
|
+
|
12
|
+
function genFx( type, num ){
|
13
|
+
var obj = {};
|
14
|
+
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){
|
15
|
+
obj[ this ] = type;
|
16
|
+
});
|
17
|
+
return obj;
|
18
|
+
}
|
19
|
+
|
20
|
+
jQuery.fn.extend({
|
21
|
+
show: function(speed,callback){
|
22
|
+
if ( speed ) {
|
23
|
+
return this.animate( genFx("show", 3), speed, callback);
|
24
|
+
} else {
|
25
|
+
for ( var i = 0, l = this.length; i < l; i++ ){
|
26
|
+
var old = jQuery.data(this[i], "olddisplay");
|
27
|
+
|
28
|
+
this[i].style.display = old || "";
|
29
|
+
|
30
|
+
if ( jQuery.css(this[i], "display") === "none" ) {
|
31
|
+
var tagName = this[i].tagName, display;
|
32
|
+
|
33
|
+
if ( elemdisplay[ tagName ] ) {
|
34
|
+
display = elemdisplay[ tagName ];
|
35
|
+
} else {
|
36
|
+
var elem = jQuery("<" + tagName + " />").appendTo("body");
|
37
|
+
|
38
|
+
display = elem.css("display");
|
39
|
+
if ( display === "none" )
|
40
|
+
display = "block";
|
41
|
+
|
42
|
+
elem.remove();
|
43
|
+
|
44
|
+
elemdisplay[ tagName ] = display;
|
45
|
+
}
|
46
|
+
|
47
|
+
jQuery.data(this[i], "olddisplay", display);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
// Set the display of the elements in a second loop
|
52
|
+
// to avoid the constant reflow
|
53
|
+
for ( var i = 0, l = this.length; i < l; i++ ){
|
54
|
+
this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
|
55
|
+
}
|
56
|
+
|
57
|
+
return this;
|
58
|
+
}
|
59
|
+
},
|
60
|
+
|
61
|
+
hide: function(speed,callback){
|
62
|
+
if ( speed ) {
|
63
|
+
return this.animate( genFx("hide", 3), speed, callback);
|
64
|
+
} else {
|
65
|
+
for ( var i = 0, l = this.length; i < l; i++ ){
|
66
|
+
var old = jQuery.data(this[i], "olddisplay");
|
67
|
+
if ( !old && old !== "none" )
|
68
|
+
jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
|
69
|
+
}
|
70
|
+
|
71
|
+
// Set the display of the elements in a second loop
|
72
|
+
// to avoid the constant reflow
|
73
|
+
for ( var i = 0, l = this.length; i < l; i++ ){
|
74
|
+
this[i].style.display = "none";
|
75
|
+
}
|
76
|
+
|
77
|
+
return this;
|
78
|
+
}
|
79
|
+
},
|
80
|
+
|
81
|
+
// Save the old toggle function
|
82
|
+
_toggle: jQuery.fn.toggle,
|
83
|
+
|
84
|
+
toggle: function( fn, fn2 ){
|
85
|
+
var bool = typeof fn === "boolean";
|
86
|
+
|
87
|
+
return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
|
88
|
+
this._toggle.apply( this, arguments ) :
|
89
|
+
fn == null || bool ?
|
90
|
+
this.each(function(){
|
91
|
+
var state = bool ? fn : jQuery(this).is(":hidden");
|
92
|
+
jQuery(this)[ state ? "show" : "hide" ]();
|
93
|
+
}) :
|
94
|
+
this.animate(genFx("toggle", 3), fn, fn2);
|
95
|
+
},
|
96
|
+
|
97
|
+
fadeTo: function(speed,to,callback){
|
98
|
+
return this.animate({opacity: to}, speed, callback);
|
99
|
+
},
|
100
|
+
|
101
|
+
animate: function( prop, speed, easing, callback ) {
|
102
|
+
var optall = jQuery.speed(speed, easing, callback);
|
103
|
+
|
104
|
+
return this[ optall.queue === false ? "each" : "queue" ](function(){
|
105
|
+
|
106
|
+
var opt = jQuery.extend({}, optall), p,
|
107
|
+
hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
|
108
|
+
self = this;
|
109
|
+
|
110
|
+
for ( p in prop ) {
|
111
|
+
if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
|
112
|
+
return opt.complete.call(this);
|
113
|
+
|
114
|
+
if ( ( p == "height" || p == "width" ) && this.style ) {
|
115
|
+
// Store display property
|
116
|
+
opt.display = jQuery.css(this, "display");
|
117
|
+
|
118
|
+
// Make sure that nothing sneaks out
|
119
|
+
opt.overflow = this.style.overflow;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
if ( opt.overflow != null )
|
124
|
+
this.style.overflow = "hidden";
|
125
|
+
|
126
|
+
opt.curAnim = jQuery.extend({}, prop);
|
127
|
+
|
128
|
+
jQuery.each( prop, function(name, val){
|
129
|
+
var e = new jQuery.fx( self, opt, name );
|
130
|
+
|
131
|
+
if ( /toggle|show|hide/.test(val) )
|
132
|
+
e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
|
133
|
+
else {
|
134
|
+
var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
|
135
|
+
start = e.cur(true) || 0;
|
136
|
+
|
137
|
+
if ( parts ) {
|
138
|
+
var end = parseFloat(parts[2]),
|
139
|
+
unit = parts[3] || "px";
|
140
|
+
|
141
|
+
// We need to compute starting value
|
142
|
+
if ( unit != "px" ) {
|
143
|
+
self.style[ name ] = (end || 1) + unit;
|
144
|
+
start = ((end || 1) / e.cur(true)) * start;
|
145
|
+
self.style[ name ] = start + unit;
|
146
|
+
}
|
147
|
+
|
148
|
+
// If a +=/-= token was provided, we're doing a relative animation
|
149
|
+
if ( parts[1] )
|
150
|
+
end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
|
151
|
+
|
152
|
+
e.custom( start, end, unit );
|
153
|
+
} else
|
154
|
+
e.custom( start, val, "" );
|
155
|
+
}
|
156
|
+
});
|
157
|
+
|
158
|
+
// For JS strict compliance
|
159
|
+
return true;
|
160
|
+
});
|
161
|
+
},
|
162
|
+
|
163
|
+
stop: function(clearQueue, gotoEnd){
|
164
|
+
var timers = jQuery.timers;
|
165
|
+
|
166
|
+
if (clearQueue)
|
167
|
+
this.queue([]);
|
168
|
+
|
169
|
+
this.each(function(){
|
170
|
+
// go in reverse order so anything added to the queue during the loop is ignored
|
171
|
+
for ( var i = timers.length - 1; i >= 0; i-- )
|
172
|
+
if ( timers[i].elem == this ) {
|
173
|
+
if (gotoEnd)
|
174
|
+
// force the next step to be the last
|
175
|
+
timers[i](true);
|
176
|
+
timers.splice(i, 1);
|
177
|
+
}
|
178
|
+
});
|
179
|
+
|
180
|
+
// start the next in the queue if the last step wasn't forced
|
181
|
+
if (!gotoEnd)
|
182
|
+
this.dequeue();
|
183
|
+
|
184
|
+
return this;
|
185
|
+
}
|
186
|
+
|
187
|
+
});
|
188
|
+
|
189
|
+
// Generate shortcuts for custom animations
|
190
|
+
jQuery.each({
|
191
|
+
slideDown: genFx("show", 1),
|
192
|
+
slideUp: genFx("hide", 1),
|
193
|
+
slideToggle: genFx("toggle", 1),
|
194
|
+
fadeIn: { opacity: "show" },
|
195
|
+
fadeOut: { opacity: "hide" }
|
196
|
+
}, function( name, props ){
|
197
|
+
jQuery.fn[ name ] = function( speed, callback ){
|
198
|
+
return this.animate( props, speed, callback );
|
199
|
+
};
|
200
|
+
});
|
201
|
+
|
202
|
+
jQuery.extend({
|
203
|
+
|
204
|
+
speed: function(speed, easing, fn) {
|
205
|
+
var opt = typeof speed === "object" ? speed : {
|
206
|
+
complete: fn || !fn && easing ||
|
207
|
+
jQuery.isFunction( speed ) && speed,
|
208
|
+
duration: speed,
|
209
|
+
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
|
210
|
+
};
|
211
|
+
|
212
|
+
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
|
213
|
+
jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
|
214
|
+
|
215
|
+
// Queueing
|
216
|
+
opt.old = opt.complete;
|
217
|
+
opt.complete = function(){
|
218
|
+
if ( opt.queue !== false )
|
219
|
+
jQuery(this).dequeue();
|
220
|
+
if ( jQuery.isFunction( opt.old ) )
|
221
|
+
opt.old.call( this );
|
222
|
+
};
|
223
|
+
|
224
|
+
return opt;
|
225
|
+
},
|
226
|
+
|
227
|
+
easing: {
|
228
|
+
linear: function( p, n, firstNum, diff ) {
|
229
|
+
return firstNum + diff * p;
|
230
|
+
},
|
231
|
+
swing: function( p, n, firstNum, diff ) {
|
232
|
+
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
|
233
|
+
}
|
234
|
+
},
|
235
|
+
|
236
|
+
timers: [],
|
237
|
+
|
238
|
+
fx: function( elem, options, prop ){
|
239
|
+
this.options = options;
|
240
|
+
this.elem = elem;
|
241
|
+
this.prop = prop;
|
242
|
+
|
243
|
+
if ( !options.orig )
|
244
|
+
options.orig = {};
|
245
|
+
}
|
246
|
+
|
247
|
+
});
|
248
|
+
|
249
|
+
jQuery.fx.prototype = {
|
250
|
+
|
251
|
+
// Simple function for setting a style value
|
252
|
+
update: function(){
|
253
|
+
if ( this.options.step )
|
254
|
+
this.options.step.call( this.elem, this.now, this );
|
255
|
+
|
256
|
+
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
|
257
|
+
|
258
|
+
// Set display property to block for height/width animations
|
259
|
+
if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style )
|
260
|
+
this.elem.style.display = "block";
|
261
|
+
},
|
262
|
+
|
263
|
+
// Get the current size
|
264
|
+
cur: function(force){
|
265
|
+
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) )
|
266
|
+
return this.elem[ this.prop ];
|
267
|
+
|
268
|
+
var r = parseFloat(jQuery.css(this.elem, this.prop, force));
|
269
|
+
return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
|
270
|
+
},
|
271
|
+
|
272
|
+
// Start an animation from one number to another
|
273
|
+
custom: function(from, to, unit){
|
274
|
+
this.startTime = now();
|
275
|
+
this.start = from;
|
276
|
+
this.end = to;
|
277
|
+
this.unit = unit || this.unit || "px";
|
278
|
+
this.now = this.start;
|
279
|
+
this.pos = this.state = 0;
|
280
|
+
|
281
|
+
var self = this;
|
282
|
+
function t(gotoEnd){
|
283
|
+
return self.step(gotoEnd);
|
284
|
+
}
|
285
|
+
|
286
|
+
t.elem = this.elem;
|
287
|
+
|
288
|
+
if ( t() && jQuery.timers.push(t) && !timerId ) {
|
289
|
+
timerId = setInterval(function(){
|
290
|
+
var timers = jQuery.timers;
|
291
|
+
|
292
|
+
for ( var i = 0; i < timers.length; i++ )
|
293
|
+
if ( !timers[i]() )
|
294
|
+
timers.splice(i--, 1);
|
295
|
+
|
296
|
+
if ( !timers.length ) {
|
297
|
+
clearInterval( timerId );
|
298
|
+
timerId = undefined;
|
299
|
+
}
|
300
|
+
}, 13);
|
301
|
+
}
|
302
|
+
},
|
303
|
+
|
304
|
+
// Simple 'show' function
|
305
|
+
show: function(){
|
306
|
+
// Remember where we started, so that we can go back to it later
|
307
|
+
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
|
308
|
+
this.options.show = true;
|
309
|
+
|
310
|
+
// Begin the animation
|
311
|
+
// Make sure that we start at a small width/height to avoid any
|
312
|
+
// flash of content
|
313
|
+
this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
|
314
|
+
|
315
|
+
// Start by showing the element
|
316
|
+
jQuery(this.elem).show();
|
317
|
+
},
|
318
|
+
|
319
|
+
// Simple 'hide' function
|
320
|
+
hide: function(){
|
321
|
+
// Remember where we started, so that we can go back to it later
|
322
|
+
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
|
323
|
+
this.options.hide = true;
|
324
|
+
|
325
|
+
// Begin the animation
|
326
|
+
this.custom(this.cur(), 0);
|
327
|
+
},
|
328
|
+
|
329
|
+
// Each step of an animation
|
330
|
+
step: function(gotoEnd){
|
331
|
+
var t = now();
|
332
|
+
|
333
|
+
if ( gotoEnd || t >= this.options.duration + this.startTime ) {
|
334
|
+
this.now = this.end;
|
335
|
+
this.pos = this.state = 1;
|
336
|
+
this.update();
|
337
|
+
|
338
|
+
this.options.curAnim[ this.prop ] = true;
|
339
|
+
|
340
|
+
var done = true;
|
341
|
+
for ( var i in this.options.curAnim )
|
342
|
+
if ( this.options.curAnim[i] !== true )
|
343
|
+
done = false;
|
344
|
+
|
345
|
+
if ( done ) {
|
346
|
+
if ( this.options.display != null ) {
|
347
|
+
// Reset the overflow
|
348
|
+
this.elem.style.overflow = this.options.overflow;
|
349
|
+
|
350
|
+
// Reset the display
|
351
|
+
this.elem.style.display = this.options.display;
|
352
|
+
if ( jQuery.css(this.elem, "display") == "none" )
|
353
|
+
this.elem.style.display = "block";
|
354
|
+
}
|
355
|
+
|
356
|
+
// Hide the element if the "hide" operation was done
|
357
|
+
if ( this.options.hide )
|
358
|
+
jQuery(this.elem).hide();
|
359
|
+
|
360
|
+
// Reset the properties, if the item has been hidden or shown
|
361
|
+
if ( this.options.hide || this.options.show )
|
362
|
+
for ( var p in this.options.curAnim )
|
363
|
+
jQuery.attr(this.elem.style, p, this.options.orig[p]);
|
364
|
+
|
365
|
+
// Execute the complete function
|
366
|
+
this.options.complete.call( this.elem );
|
367
|
+
}
|
368
|
+
|
369
|
+
return false;
|
370
|
+
} else {
|
371
|
+
var n = t - this.startTime;
|
372
|
+
this.state = n / this.options.duration;
|
373
|
+
|
374
|
+
// Perform the easing function, defaults to swing
|
375
|
+
this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
|
376
|
+
this.now = this.start + ((this.end - this.start) * this.pos);
|
377
|
+
|
378
|
+
// Perform the next step of the animation
|
379
|
+
this.update();
|
380
|
+
}
|
381
|
+
|
382
|
+
return true;
|
383
|
+
}
|
384
|
+
|
385
|
+
};
|
386
|
+
|
387
|
+
jQuery.extend( jQuery.fx, {
|
388
|
+
speeds:{
|
389
|
+
slow: 600,
|
390
|
+
fast: 200,
|
391
|
+
// Default speed
|
392
|
+
_default: 400
|
393
|
+
},
|
394
|
+
step: {
|
395
|
+
|
396
|
+
opacity: function(fx){
|
397
|
+
jQuery.attr(fx.elem.style, "opacity", fx.now);
|
398
|
+
},
|
399
|
+
|
400
|
+
_default: function(fx){
|
401
|
+
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
|
402
|
+
fx.elem.style[ fx.prop ] = fx.now + fx.unit;
|
403
|
+
else
|
404
|
+
fx.elem[ fx.prop ] = fx.now;
|
405
|
+
}
|
406
|
+
}
|
407
|
+
});
|
@@ -0,0 +1,155 @@
|
|
1
|
+
if ( document.documentElement["getBoundingClientRect"] )
|
2
|
+
jQuery.fn.offset = function() {
|
3
|
+
if ( !this[0] ) return { top: 0, left: 0 };
|
4
|
+
if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
|
5
|
+
var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
|
6
|
+
clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
|
7
|
+
top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
|
8
|
+
left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
|
9
|
+
return { top: top, left: left };
|
10
|
+
};
|
11
|
+
else
|
12
|
+
jQuery.fn.offset = function() {
|
13
|
+
if ( !this[0] ) return { top: 0, left: 0 };
|
14
|
+
if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
|
15
|
+
jQuery.offset.initialized || jQuery.offset.initialize();
|
16
|
+
|
17
|
+
var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
|
18
|
+
doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
|
19
|
+
body = doc.body, defaultView = doc.defaultView,
|
20
|
+
prevComputedStyle = defaultView.getComputedStyle(elem, null),
|
21
|
+
top = elem.offsetTop, left = elem.offsetLeft;
|
22
|
+
|
23
|
+
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
|
24
|
+
computedStyle = defaultView.getComputedStyle(elem, null);
|
25
|
+
top -= elem.scrollTop, left -= elem.scrollLeft;
|
26
|
+
if ( elem === offsetParent ) {
|
27
|
+
top += elem.offsetTop, left += elem.offsetLeft;
|
28
|
+
if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) )
|
29
|
+
top += parseInt( computedStyle.borderTopWidth, 10) || 0,
|
30
|
+
left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
|
31
|
+
prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
|
32
|
+
}
|
33
|
+
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )
|
34
|
+
top += parseInt( computedStyle.borderTopWidth, 10) || 0,
|
35
|
+
left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
|
36
|
+
prevComputedStyle = computedStyle;
|
37
|
+
}
|
38
|
+
|
39
|
+
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" )
|
40
|
+
top += body.offsetTop,
|
41
|
+
left += body.offsetLeft;
|
42
|
+
|
43
|
+
if ( prevComputedStyle.position === "fixed" )
|
44
|
+
top += Math.max(docElem.scrollTop, body.scrollTop),
|
45
|
+
left += Math.max(docElem.scrollLeft, body.scrollLeft);
|
46
|
+
|
47
|
+
return { top: top, left: left };
|
48
|
+
};
|
49
|
+
|
50
|
+
jQuery.offset = {
|
51
|
+
initialize: function() {
|
52
|
+
if ( this.initialized ) return;
|
53
|
+
var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
|
54
|
+
html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
|
55
|
+
|
56
|
+
rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
|
57
|
+
for ( prop in rules ) container.style[prop] = rules[prop];
|
58
|
+
|
59
|
+
container.innerHTML = html;
|
60
|
+
body.insertBefore(container, body.firstChild);
|
61
|
+
innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild;
|
62
|
+
|
63
|
+
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
|
64
|
+
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
|
65
|
+
|
66
|
+
innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
|
67
|
+
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
|
68
|
+
|
69
|
+
body.style.marginTop = '1px';
|
70
|
+
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
|
71
|
+
body.style.marginTop = bodyMarginTop;
|
72
|
+
|
73
|
+
body.removeChild(container);
|
74
|
+
this.initialized = true;
|
75
|
+
},
|
76
|
+
|
77
|
+
bodyOffset: function(body) {
|
78
|
+
jQuery.offset.initialized || jQuery.offset.initialize();
|
79
|
+
var top = body.offsetTop, left = body.offsetLeft;
|
80
|
+
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
|
81
|
+
top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0,
|
82
|
+
left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
|
83
|
+
return { top: top, left: left };
|
84
|
+
}
|
85
|
+
};
|
86
|
+
|
87
|
+
|
88
|
+
jQuery.fn.extend({
|
89
|
+
position: function() {
|
90
|
+
var left = 0, top = 0, results;
|
91
|
+
|
92
|
+
if ( this[0] ) {
|
93
|
+
// Get *real* offsetParent
|
94
|
+
var offsetParent = this.offsetParent(),
|
95
|
+
|
96
|
+
// Get correct offsets
|
97
|
+
offset = this.offset(),
|
98
|
+
parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
|
99
|
+
|
100
|
+
// Subtract element margins
|
101
|
+
// note: when an element has margin: auto the offsetLeft and marginLeft
|
102
|
+
// are the same in Safari causing offset.left to incorrectly be 0
|
103
|
+
offset.top -= num( this, 'marginTop' );
|
104
|
+
offset.left -= num( this, 'marginLeft' );
|
105
|
+
|
106
|
+
// Add offsetParent borders
|
107
|
+
parentOffset.top += num( offsetParent, 'borderTopWidth' );
|
108
|
+
parentOffset.left += num( offsetParent, 'borderLeftWidth' );
|
109
|
+
|
110
|
+
// Subtract the two offsets
|
111
|
+
results = {
|
112
|
+
top: offset.top - parentOffset.top,
|
113
|
+
left: offset.left - parentOffset.left
|
114
|
+
};
|
115
|
+
}
|
116
|
+
|
117
|
+
return results;
|
118
|
+
},
|
119
|
+
|
120
|
+
offsetParent: function() {
|
121
|
+
var offsetParent = this[0].offsetParent || document.body;
|
122
|
+
while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
|
123
|
+
offsetParent = offsetParent.offsetParent;
|
124
|
+
return jQuery(offsetParent);
|
125
|
+
}
|
126
|
+
});
|
127
|
+
|
128
|
+
|
129
|
+
// Create scrollLeft and scrollTop methods
|
130
|
+
jQuery.each( ['Left', 'Top'], function(i, name) {
|
131
|
+
var method = 'scroll' + name;
|
132
|
+
|
133
|
+
jQuery.fn[ method ] = function(val) {
|
134
|
+
if (!this[0]) return null;
|
135
|
+
|
136
|
+
return val !== undefined ?
|
137
|
+
|
138
|
+
// Set the scroll offset
|
139
|
+
this.each(function() {
|
140
|
+
this == window || this == document ?
|
141
|
+
window.scrollTo(
|
142
|
+
!i ? val : jQuery(window).scrollLeft(),
|
143
|
+
i ? val : jQuery(window).scrollTop()
|
144
|
+
) :
|
145
|
+
this[ method ] = val;
|
146
|
+
}) :
|
147
|
+
|
148
|
+
// Return the scroll offset
|
149
|
+
this[0] == window || this[0] == document ?
|
150
|
+
self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
|
151
|
+
jQuery.boxModel && document.documentElement[ method ] ||
|
152
|
+
document.body[ method ] :
|
153
|
+
this[0][ method ];
|
154
|
+
};
|
155
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
})();
|