author | amit@thunder |
Sat, 13 Feb 2010 13:32:38 +0530 | |
changeset 5 | c9c9819cd5e5 |
parent 2 | 52d12eb31c30 |
permissions | -rwxr-xr-x |
0
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1 |
(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2 |
/* |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
3 |
* jQuery 1.2.1 - New Wave Javascript |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
4 |
* |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
5 |
* Copyright (c) 2007 John Resig (jquery.com) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
6 |
* Dual licensed under the MIT (MIT-LICENSE.txt) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
7 |
* and GPL (GPL-LICENSE.txt) licenses. |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
8 |
* |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
9 |
* $Date: 2007-09-16 23:42:06 -0400 (Sun, 16 Sep 2007) $ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
10 |
* $Rev: 3353 $ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
11 |
*/ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
12 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
13 |
// Map over jQuery in case of overwrite |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
14 |
if ( typeof jQuery != "undefined" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
15 |
var _jQuery = jQuery; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
16 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
17 |
var jQuery = window.jQuery = function(selector, context) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
18 |
// If the context is a namespace object, return a new object |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
19 |
return this instanceof jQuery ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
20 |
this.init(selector, context) : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
21 |
new jQuery(selector, context); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
22 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
23 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
24 |
// Map over the $ in case of overwrite |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
25 |
if ( typeof $ != "undefined" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
26 |
var _$ = $; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
27 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
28 |
// Map the jQuery namespace to the '$' one |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
29 |
window.$ = jQuery; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
30 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
31 |
var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
32 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
33 |
jQuery.fn = jQuery.prototype = { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
34 |
init: function(selector, context) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
35 |
// Make sure that a selection was provided |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
36 |
selector = selector || document; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
37 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
38 |
// Handle HTML strings |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
39 |
if ( typeof selector == "string" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
40 |
var m = quickExpr.exec(selector); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
41 |
if ( m && (m[1] || !context) ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
42 |
// HANDLE: $(html) -> $(array) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
43 |
if ( m[1] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
44 |
selector = jQuery.clean( [ m[1] ], context ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
45 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
46 |
// HANDLE: $("#id") |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
47 |
else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
48 |
var tmp = document.getElementById( m[3] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
49 |
if ( tmp ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
50 |
// Handle the case where IE and Opera return items |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
51 |
// by name instead of ID |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
52 |
if ( tmp.id != m[3] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
53 |
return jQuery().find( selector ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
54 |
else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
55 |
this[0] = tmp; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
56 |
this.length = 1; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
57 |
return this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
58 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
59 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
60 |
selector = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
61 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
62 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
63 |
// HANDLE: $(expr) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
64 |
} else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
65 |
return new jQuery( context ).find( selector ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
66 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
67 |
// HANDLE: $(function) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
68 |
// Shortcut for document ready |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
69 |
} else if ( jQuery.isFunction(selector) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
70 |
return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( selector ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
71 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
72 |
return this.setArray( |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
73 |
// HANDLE: $(array) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
74 |
selector.constructor == Array && selector || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
75 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
76 |
// HANDLE: $(arraylike) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
77 |
// Watch for when an array-like object is passed as the selector |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
78 |
(selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
79 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
80 |
// HANDLE: $(*) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
81 |
[ selector ] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
82 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
83 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
84 |
jquery: "1.2.1", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
85 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
86 |
size: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
87 |
return this.length; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
88 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
89 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
90 |
length: 0, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
91 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
92 |
get: function( num ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
93 |
return num == undefined ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
94 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
95 |
// Return a 'clean' array |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
96 |
jQuery.makeArray( this ) : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
97 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
98 |
// Return just the object |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
99 |
this[num]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
100 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
101 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
102 |
pushStack: function( a ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
103 |
var ret = jQuery(a); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
104 |
ret.prevObject = this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
105 |
return ret; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
106 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
107 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
108 |
setArray: function( a ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
109 |
this.length = 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
110 |
Array.prototype.push.apply( this, a ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
111 |
return this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
112 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
113 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
114 |
each: function( fn, args ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
115 |
return jQuery.each( this, fn, args ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
116 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
117 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
118 |
index: function( obj ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
119 |
var pos = -1; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
120 |
this.each(function(i){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
121 |
if ( this == obj ) pos = i; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
122 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
123 |
return pos; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
124 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
125 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
126 |
attr: function( key, value, type ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
127 |
var obj = key; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
128 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
129 |
// Look for the case where we're accessing a style value |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
130 |
if ( key.constructor == String ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
131 |
if ( value == undefined ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
132 |
return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
133 |
else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
134 |
obj = {}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
135 |
obj[ key ] = value; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
136 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
137 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
138 |
// Check to see if we're setting style values |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
139 |
return this.each(function(index){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
140 |
// Set all the styles |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
141 |
for ( var prop in obj ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
142 |
jQuery.attr( |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
143 |
type ? this.style : this, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
144 |
prop, jQuery.prop(this, obj[prop], type, index, prop) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
145 |
); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
146 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
147 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
148 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
149 |
css: function( key, value ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
150 |
return this.attr( key, value, "curCSS" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
151 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
152 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
153 |
text: function(e) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
154 |
if ( typeof e != "object" && e != null ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
155 |
return this.empty().append( document.createTextNode( e ) ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
156 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
157 |
var t = ""; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
158 |
jQuery.each( e || this, function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
159 |
jQuery.each( this.childNodes, function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
160 |
if ( this.nodeType != 8 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
161 |
t += this.nodeType != 1 ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
162 |
this.nodeValue : jQuery.fn.text([ this ]); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
163 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
164 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
165 |
return t; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
166 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
167 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
168 |
wrapAll: function(html) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
169 |
if ( this[0] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
170 |
// The elements to wrap the target around |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
171 |
jQuery(html, this[0].ownerDocument) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
172 |
.clone() |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
173 |
.insertBefore(this[0]) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
174 |
.map(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
175 |
var elem = this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
176 |
while ( elem.firstChild ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
177 |
elem = elem.firstChild; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
178 |
return elem; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
179 |
}) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
180 |
.append(this); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
181 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
182 |
return this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
183 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
184 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
185 |
wrapInner: function(html) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
186 |
return this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
187 |
jQuery(this).contents().wrapAll(html); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
188 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
189 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
190 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
191 |
wrap: function(html) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
192 |
return this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
193 |
jQuery(this).wrapAll(html); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
194 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
195 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
196 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
197 |
append: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
198 |
return this.domManip(arguments, true, 1, function(a){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
199 |
this.appendChild( a ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
200 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
201 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
202 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
203 |
prepend: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
204 |
return this.domManip(arguments, true, -1, function(a){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
205 |
this.insertBefore( a, this.firstChild ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
206 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
207 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
208 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
209 |
before: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
210 |
return this.domManip(arguments, false, 1, function(a){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
211 |
this.parentNode.insertBefore( a, this ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
212 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
213 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
214 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
215 |
after: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
216 |
return this.domManip(arguments, false, -1, function(a){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
217 |
this.parentNode.insertBefore( a, this.nextSibling ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
218 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
219 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
220 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
221 |
end: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
222 |
return this.prevObject || jQuery([]); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
223 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
224 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
225 |
find: function(t) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
226 |
var data = jQuery.map(this, function(a){ return jQuery.find(t,a); }); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
227 |
return this.pushStack( /[^+>] [^+>]/.test( t ) || t.indexOf("..") > -1 ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
228 |
jQuery.unique( data ) : data ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
229 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
230 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
231 |
clone: function(events) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
232 |
// Do the clone |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
233 |
var ret = this.map(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
234 |
return this.outerHTML ? jQuery(this.outerHTML)[0] : this.cloneNode(true); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
235 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
236 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
237 |
// Need to set the expando to null on the cloned set if it exists |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
238 |
// removeData doesn't work here, IE removes it from the original as well |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
239 |
// this is primarily for IE but the data expando shouldn't be copied over in any browser |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
240 |
var clone = ret.find("*").andSelf().each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
241 |
if ( this[ expando ] != undefined ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
242 |
this[ expando ] = null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
243 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
244 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
245 |
// Copy the events from the original to the clone |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
246 |
if (events === true) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
247 |
this.find("*").andSelf().each(function(i) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
248 |
var events = jQuery.data(this, "events"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
249 |
for ( var type in events ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
250 |
for ( var handler in events[type] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
251 |
jQuery.event.add(clone[i], type, events[type][handler], events[type][handler].data); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
252 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
253 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
254 |
// Return the cloned set |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
255 |
return ret; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
256 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
257 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
258 |
filter: function(t) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
259 |
return this.pushStack( |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
260 |
jQuery.isFunction( t ) && |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
261 |
jQuery.grep(this, function(el, index){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
262 |
return t.apply(el, [index]); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
263 |
}) || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
264 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
265 |
jQuery.multiFilter(t,this) ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
266 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
267 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
268 |
not: function(t) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
269 |
return this.pushStack( |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
270 |
t.constructor == String && |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
271 |
jQuery.multiFilter(t, this, true) || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
272 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
273 |
jQuery.grep(this, function(a) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
274 |
return ( t.constructor == Array || t.jquery ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
275 |
? jQuery.inArray( a, t ) < 0 |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
276 |
: a != t; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
277 |
}) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
278 |
); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
279 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
280 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
281 |
add: function(t) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
282 |
return this.pushStack( jQuery.merge( |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
283 |
this.get(), |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
284 |
t.constructor == String ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
285 |
jQuery(t).get() : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
286 |
t.length != undefined && (!t.nodeName || jQuery.nodeName(t, "form")) ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
287 |
t : [t] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
288 |
); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
289 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
290 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
291 |
is: function(expr) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
292 |
return expr ? jQuery.multiFilter(expr,this).length > 0 : false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
293 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
294 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
295 |
hasClass: function(expr) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
296 |
return this.is("." + expr); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
297 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
298 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
299 |
val: function( val ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
300 |
if ( val == undefined ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
301 |
if ( this.length ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
302 |
var elem = this[0]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
303 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
304 |
// We need to handle select boxes special |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
305 |
if ( jQuery.nodeName(elem, "select") ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
306 |
var index = elem.selectedIndex, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
307 |
a = [], |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
308 |
options = elem.options, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
309 |
one = elem.type == "select-one"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
310 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
311 |
// Nothing was selected |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
312 |
if ( index < 0 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
313 |
return null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
314 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
315 |
// Loop through all the selected options |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
316 |
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
317 |
var option = options[i]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
318 |
if ( option.selected ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
319 |
// Get the specifc value for the option |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
320 |
var val = jQuery.browser.msie && !option.attributes["value"].specified ? option.text : option.value; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
321 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
322 |
// We don't need an array for one selects |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
323 |
if ( one ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
324 |
return val; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
325 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
326 |
// Multi-Selects return an array |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
327 |
a.push(val); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
328 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
329 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
330 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
331 |
return a; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
332 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
333 |
// Everything else, we just grab the value |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
334 |
} else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
335 |
return this[0].value.replace(/\r/g, ""); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
336 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
337 |
} else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
338 |
return this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
339 |
if ( val.constructor == Array && /radio|checkbox/.test(this.type) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
340 |
this.checked = (jQuery.inArray(this.value, val) >= 0 || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
341 |
jQuery.inArray(this.name, val) >= 0); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
342 |
else if ( jQuery.nodeName(this, "select") ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
343 |
var tmp = val.constructor == Array ? val : [val]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
344 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
345 |
jQuery("option", this).each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
346 |
this.selected = (jQuery.inArray(this.value, tmp) >= 0 || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
347 |
jQuery.inArray(this.text, tmp) >= 0); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
348 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
349 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
350 |
if ( !tmp.length ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
351 |
this.selectedIndex = -1; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
352 |
} else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
353 |
this.value = val; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
354 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
355 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
356 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
357 |
html: function( val ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
358 |
return val == undefined ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
359 |
( this.length ? this[0].innerHTML : null ) : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
360 |
this.empty().append( val ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
361 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
362 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
363 |
replaceWith: function( val ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
364 |
return this.after( val ).remove(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
365 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
366 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
367 |
eq: function(i){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
368 |
return this.slice(i, i+1); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
369 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
370 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
371 |
slice: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
372 |
return this.pushStack( Array.prototype.slice.apply( this, arguments ) ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
373 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
374 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
375 |
map: function(fn) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
376 |
return this.pushStack(jQuery.map( this, function(elem,i){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
377 |
return fn.call( elem, i, elem ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
378 |
})); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
379 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
380 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
381 |
andSelf: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
382 |
return this.add( this.prevObject ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
383 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
384 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
385 |
domManip: function(args, table, dir, fn) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
386 |
var clone = this.length > 1, a; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
387 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
388 |
return this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
389 |
if ( !a ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
390 |
a = jQuery.clean(args, this.ownerDocument); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
391 |
if ( dir < 0 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
392 |
a.reverse(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
393 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
394 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
395 |
var obj = this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
396 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
397 |
if ( table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr") ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
398 |
obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody")); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
399 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
400 |
jQuery.each( a, function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
401 |
var elem = clone ? this.cloneNode(true) : this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
402 |
if ( !evalScript(0, elem) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
403 |
fn.call( obj, elem ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
404 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
405 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
406 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
407 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
408 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
409 |
function evalScript(i, elem){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
410 |
var script = jQuery.nodeName(elem, "script"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
411 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
412 |
if ( script ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
413 |
if ( elem.src ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
414 |
jQuery.ajax({ url: elem.src, async: false, dataType: "script" }); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
415 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
416 |
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
417 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
418 |
if ( elem.parentNode ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
419 |
elem.parentNode.removeChild(elem); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
420 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
421 |
} else if ( elem.nodeType == 1 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
422 |
jQuery("script", elem).each(evalScript); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
423 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
424 |
return script; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
425 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
426 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
427 |
jQuery.extend = jQuery.fn.extend = function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
428 |
// copy reference to target object |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
429 |
var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
430 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
431 |
// Handle a deep copy situation |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
432 |
if ( target.constructor == Boolean ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
433 |
deep = target; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
434 |
target = arguments[1] || {}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
435 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
436 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
437 |
// extend jQuery itself if only one argument is passed |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
438 |
if ( al == 1 ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
439 |
target = this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
440 |
a = 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
441 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
442 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
443 |
var prop; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
444 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
445 |
for ( ; a < al; a++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
446 |
// Only deal with non-null/undefined values |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
447 |
if ( (prop = arguments[a]) != null ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
448 |
// Extend the base object |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
449 |
for ( var i in prop ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
450 |
// Prevent never-ending loop |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
451 |
if ( target == prop[i] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
452 |
continue; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
453 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
454 |
// Recurse if we're merging object values |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
455 |
if ( deep && typeof prop[i] == 'object' && target[i] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
456 |
jQuery.extend( target[i], prop[i] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
457 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
458 |
// Don't bring in undefined values |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
459 |
else if ( prop[i] != undefined ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
460 |
target[i] = prop[i]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
461 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
462 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
463 |
// Return the modified object |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
464 |
return target; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
465 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
466 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
467 |
var expando = "jQuery" + (new Date()).getTime(), uuid = 0, win = {}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
468 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
469 |
jQuery.extend({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
470 |
noConflict: function(deep) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
471 |
window.$ = _$; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
472 |
if ( deep ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
473 |
window.jQuery = _jQuery; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
474 |
return jQuery; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
475 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
476 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
477 |
// This may seem like some crazy code, but trust me when I say that this |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
478 |
// is the only cross-browser way to do this. --John |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
479 |
isFunction: function( fn ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
480 |
return !!fn && typeof fn != "string" && !fn.nodeName && |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
481 |
fn.constructor != Array && /function/i.test( fn + "" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
482 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
483 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
484 |
// check if an element is in a XML document |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
485 |
isXMLDoc: function(elem) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
486 |
return elem.documentElement && !elem.body || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
487 |
elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
488 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
489 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
490 |
// Evalulates a script in a global context |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
491 |
// Evaluates Async. in Safari 2 :-( |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
492 |
globalEval: function( data ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
493 |
data = jQuery.trim( data ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
494 |
if ( data ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
495 |
if ( window.execScript ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
496 |
window.execScript( data ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
497 |
else if ( jQuery.browser.safari ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
498 |
// safari doesn't provide a synchronous global eval |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
499 |
window.setTimeout( data, 0 ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
500 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
501 |
eval.call( window, data ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
502 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
503 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
504 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
505 |
nodeName: function( elem, name ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
506 |
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
507 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
508 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
509 |
cache: {}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
510 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
511 |
data: function( elem, name, data ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
512 |
elem = elem == window ? win : elem; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
513 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
514 |
var id = elem[ expando ]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
515 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
516 |
// Compute a unique ID for the element |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
517 |
if ( !id ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
518 |
id = elem[ expando ] = ++uuid; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
519 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
520 |
// Only generate the data cache if we're |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
521 |
// trying to access or manipulate it |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
522 |
if ( name && !jQuery.cache[ id ] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
523 |
jQuery.cache[ id ] = {}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
524 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
525 |
// Prevent overriding the named cache with undefined values |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
526 |
if ( data != undefined ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
527 |
jQuery.cache[ id ][ name ] = data; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
528 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
529 |
// Return the named cache data, or the ID for the element |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
530 |
return name ? jQuery.cache[ id ][ name ] : id; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
531 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
532 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
533 |
removeData: function( elem, name ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
534 |
elem = elem == window ? win : elem; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
535 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
536 |
var id = elem[ expando ]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
537 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
538 |
// If we want to remove a specific section of the element's data |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
539 |
if ( name ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
540 |
if ( jQuery.cache[ id ] ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
541 |
// Remove the section of cache data |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
542 |
delete jQuery.cache[ id ][ name ]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
543 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
544 |
// If we've removed all the data, remove the element's cache |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
545 |
name = ""; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
546 |
for ( name in jQuery.cache[ id ] ) break; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
547 |
if ( !name ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
548 |
jQuery.removeData( elem ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
549 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
550 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
551 |
// Otherwise, we want to remove all of the element's data |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
552 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
553 |
// Clean up the element expando |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
554 |
try { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
555 |
delete elem[ expando ]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
556 |
} catch(e){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
557 |
// IE has trouble directly removing the expando |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
558 |
// but it's ok with using removeAttribute |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
559 |
if ( elem.removeAttribute ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
560 |
elem.removeAttribute( expando ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
561 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
562 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
563 |
// Completely remove the data cache |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
564 |
delete jQuery.cache[ id ]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
565 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
566 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
567 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
568 |
// args is for internal usage only |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
569 |
each: function( obj, fn, args ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
570 |
if ( args ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
571 |
if ( obj.length == undefined ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
572 |
for ( var i in obj ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
573 |
fn.apply( obj[i], args ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
574 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
575 |
for ( var i = 0, ol = obj.length; i < ol; i++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
576 |
if ( fn.apply( obj[i], args ) === false ) break; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
577 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
578 |
// A special, fast, case for the most common use of each |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
579 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
580 |
if ( obj.length == undefined ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
581 |
for ( var i in obj ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
582 |
fn.call( obj[i], i, obj[i] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
583 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
584 |
for ( var i = 0, ol = obj.length, val = obj[0]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
585 |
i < ol && fn.call(val,i,val) !== false; val = obj[++i] ){} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
586 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
587 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
588 |
return obj; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
589 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
590 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
591 |
prop: function(elem, value, type, index, prop){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
592 |
// Handle executable functions |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
593 |
if ( jQuery.isFunction( value ) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
594 |
value = value.call( elem, [index] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
595 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
596 |
// exclude the following css properties to add px |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
597 |
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
598 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
599 |
// Handle passing in a number to a CSS property |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
600 |
return value && value.constructor == Number && type == "curCSS" && !exclude.test(prop) ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
601 |
value + "px" : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
602 |
value; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
603 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
604 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
605 |
className: { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
606 |
// internal only, use addClass("class") |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
607 |
add: function( elem, c ){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
608 |
jQuery.each( (c || "").split(/\s+/), function(i, cur){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
609 |
if ( !jQuery.className.has( elem.className, cur ) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
610 |
elem.className += ( elem.className ? " " : "" ) + cur; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
611 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
612 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
613 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
614 |
// internal only, use removeClass("class") |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
615 |
remove: function( elem, c ){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
616 |
elem.className = c != undefined ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
617 |
jQuery.grep( elem.className.split(/\s+/), function(cur){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
618 |
return !jQuery.className.has( c, cur ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
619 |
}).join(" ") : ""; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
620 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
621 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
622 |
// internal only, use is(".class") |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
623 |
has: function( t, c ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
624 |
return jQuery.inArray( c, (t.className || t).toString().split(/\s+/) ) > -1; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
625 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
626 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
627 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
628 |
swap: function(e,o,f) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
629 |
for ( var i in o ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
630 |
e.style["old"+i] = e.style[i]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
631 |
e.style[i] = o[i]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
632 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
633 |
f.apply( e, [] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
634 |
for ( var i in o ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
635 |
e.style[i] = e.style["old"+i]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
636 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
637 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
638 |
css: function(e,p) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
639 |
if ( p == "height" || p == "width" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
640 |
var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
641 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
642 |
jQuery.each( d, function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
643 |
old["padding" + this] = 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
644 |
old["border" + this + "Width"] = 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
645 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
646 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
647 |
jQuery.swap( e, old, function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
648 |
if ( jQuery(e).is(':visible') ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
649 |
oHeight = e.offsetHeight; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
650 |
oWidth = e.offsetWidth; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
651 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
652 |
e = jQuery(e.cloneNode(true)) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
653 |
.find(":radio").removeAttr("checked").end() |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
654 |
.css({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
655 |
visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0" |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
656 |
}).appendTo(e.parentNode)[0]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
657 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
658 |
var parPos = jQuery.css(e.parentNode,"position") || "static"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
659 |
if ( parPos == "static" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
660 |
e.parentNode.style.position = "relative"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
661 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
662 |
oHeight = e.clientHeight; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
663 |
oWidth = e.clientWidth; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
664 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
665 |
if ( parPos == "static" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
666 |
e.parentNode.style.position = "static"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
667 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
668 |
e.parentNode.removeChild(e); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
669 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
670 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
671 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
672 |
return p == "height" ? oHeight : oWidth; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
673 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
674 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
675 |
return jQuery.curCSS( e, p ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
676 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
677 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
678 |
curCSS: function(elem, prop, force) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
679 |
var ret, stack = [], swap = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
680 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
681 |
// A helper method for determining if an element's values are broken |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
682 |
function color(a){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
683 |
if ( !jQuery.browser.safari ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
684 |
return false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
685 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
686 |
var ret = document.defaultView.getComputedStyle(a,null); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
687 |
return !ret || ret.getPropertyValue("color") == ""; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
688 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
689 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
690 |
if (prop == "opacity" && jQuery.browser.msie) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
691 |
ret = jQuery.attr(elem.style, "opacity"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
692 |
return ret == "" ? "1" : ret; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
693 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
694 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
695 |
if (prop.match(/float/i)) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
696 |
prop = styleFloat; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
697 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
698 |
if (!force && elem.style[prop]) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
699 |
ret = elem.style[prop]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
700 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
701 |
else if (document.defaultView && document.defaultView.getComputedStyle) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
702 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
703 |
if (prop.match(/float/i)) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
704 |
prop = "float"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
705 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
706 |
prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
707 |
var cur = document.defaultView.getComputedStyle(elem, null); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
708 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
709 |
if ( cur && !color(elem) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
710 |
ret = cur.getPropertyValue(prop); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
711 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
712 |
// If the element isn't reporting its values properly in Safari |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
713 |
// then some display: none elements are involved |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
714 |
else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
715 |
// Locate all of the parent display: none elements |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
716 |
for ( var a = elem; a && color(a); a = a.parentNode ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
717 |
stack.unshift(a); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
718 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
719 |
// Go through and make them visible, but in reverse |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
720 |
// (It would be better if we knew the exact display type that they had) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
721 |
for ( a = 0; a < stack.length; a++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
722 |
if ( color(stack[a]) ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
723 |
swap[a] = stack[a].style.display; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
724 |
stack[a].style.display = "block"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
725 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
726 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
727 |
// Since we flip the display style, we have to handle that |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
728 |
// one special, otherwise get the value |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
729 |
ret = prop == "display" && swap[stack.length-1] != null ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
730 |
"none" : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
731 |
document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop) || ""; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
732 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
733 |
// Finally, revert the display styles back |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
734 |
for ( a = 0; a < swap.length; a++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
735 |
if ( swap[a] != null ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
736 |
stack[a].style.display = swap[a]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
737 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
738 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
739 |
if ( prop == "opacity" && ret == "" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
740 |
ret = "1"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
741 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
742 |
} else if (elem.currentStyle) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
743 |
var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
744 |
ret = elem.currentStyle[prop] || elem.currentStyle[newProp]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
745 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
746 |
// From the awesome hack by Dean Edwards |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
747 |
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
748 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
749 |
// If we're not dealing with a regular pixel number |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
750 |
// but a number that has a weird ending, we need to convert it to pixels |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
751 |
if ( !/^\d+(px)?$/i.test(ret) && /^\d/.test(ret) ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
752 |
var style = elem.style.left; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
753 |
var runtimeStyle = elem.runtimeStyle.left; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
754 |
elem.runtimeStyle.left = elem.currentStyle.left; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
755 |
elem.style.left = ret || 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
756 |
ret = elem.style.pixelLeft + "px"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
757 |
elem.style.left = style; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
758 |
elem.runtimeStyle.left = runtimeStyle; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
759 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
760 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
761 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
762 |
return ret; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
763 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
764 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
765 |
clean: function(a, doc) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
766 |
var r = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
767 |
doc = doc || document; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
768 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
769 |
jQuery.each( a, function(i,arg){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
770 |
if ( !arg ) return; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
771 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
772 |
if ( arg.constructor == Number ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
773 |
arg = arg.toString(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
774 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
775 |
// Convert html string into DOM nodes |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
776 |
if ( typeof arg == "string" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
777 |
// Fix "XHTML"-style tags in all browsers |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
778 |
arg = arg.replace(/(<(\w+)[^>]*?)\/>/g, function(m, all, tag){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
779 |
return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area)$/i)? m : all+"></"+tag+">"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
780 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
781 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
782 |
// Trim whitespace, otherwise indexOf won't work as expected |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
783 |
var s = jQuery.trim(arg).toLowerCase(), div = doc.createElement("div"), tb = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
784 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
785 |
var wrap = |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
786 |
// option or optgroup |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
787 |
!s.indexOf("<opt") && |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
788 |
[1, "<select>", "</select>"] || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
789 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
790 |
!s.indexOf("<leg") && |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
791 |
[1, "<fieldset>", "</fieldset>"] || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
792 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
793 |
s.match(/^<(thead|tbody|tfoot|colg|cap)/) && |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
794 |
[1, "<table>", "</table>"] || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
795 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
796 |
!s.indexOf("<tr") && |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
797 |
[2, "<table><tbody>", "</tbody></table>"] || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
798 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
799 |
// <thead> matched above |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
800 |
(!s.indexOf("<td") || !s.indexOf("<th")) && |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
801 |
[3, "<table><tbody><tr>", "</tr></tbody></table>"] || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
802 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
803 |
!s.indexOf("<col") && |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
804 |
[2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
805 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
806 |
// IE can't serialize <link> and <script> tags normally |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
807 |
jQuery.browser.msie && |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
808 |
[1, "div<div>", "</div>"] || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
809 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
810 |
[0,"",""]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
811 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
812 |
// Go to html and back, then peel off extra wrappers |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
813 |
div.innerHTML = wrap[1] + arg + wrap[2]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
814 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
815 |
// Move to the right depth |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
816 |
while ( wrap[0]-- ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
817 |
div = div.lastChild; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
818 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
819 |
// Remove IE's autoinserted <tbody> from table fragments |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
820 |
if ( jQuery.browser.msie ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
821 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
822 |
// String was a <table>, *may* have spurious <tbody> |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
823 |
if ( !s.indexOf("<table") && s.indexOf("<tbody") < 0 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
824 |
tb = div.firstChild && div.firstChild.childNodes; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
825 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
826 |
// String was a bare <thead> or <tfoot> |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
827 |
else if ( wrap[1] == "<table>" && s.indexOf("<tbody") < 0 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
828 |
tb = div.childNodes; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
829 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
830 |
for ( var n = tb.length-1; n >= 0 ; --n ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
831 |
if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
832 |
tb[n].parentNode.removeChild(tb[n]); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
833 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
834 |
// IE completely kills leading whitespace when innerHTML is used |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
835 |
if ( /^\s/.test(arg) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
836 |
div.insertBefore( doc.createTextNode( arg.match(/^\s*/)[0] ), div.firstChild ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
837 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
838 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
839 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
840 |
arg = jQuery.makeArray( div.childNodes ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
841 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
842 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
843 |
if ( 0 === arg.length && (!jQuery.nodeName(arg, "form") && !jQuery.nodeName(arg, "select")) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
844 |
return; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
845 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
846 |
if ( arg[0] == undefined || jQuery.nodeName(arg, "form") || arg.options ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
847 |
r.push( arg ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
848 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
849 |
r = jQuery.merge( r, arg ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
850 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
851 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
852 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
853 |
return r; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
854 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
855 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
856 |
attr: function(elem, name, value){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
857 |
var fix = jQuery.isXMLDoc(elem) ? {} : jQuery.props; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
858 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
859 |
// Safari mis-reports the default selected property of a hidden option |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
860 |
// Accessing the parent's selectedIndex property fixes it |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
861 |
if ( name == "selected" && jQuery.browser.safari ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
862 |
elem.parentNode.selectedIndex; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
863 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
864 |
// Certain attributes only work when accessed via the old DOM 0 way |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
865 |
if ( fix[name] ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
866 |
if ( value != undefined ) elem[fix[name]] = value; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
867 |
return elem[fix[name]]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
868 |
} else if ( jQuery.browser.msie && name == "style" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
869 |
return jQuery.attr( elem.style, "cssText", value ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
870 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
871 |
else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
872 |
return elem.getAttributeNode(name).nodeValue; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
873 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
874 |
// IE elem.getAttribute passes even for style |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
875 |
else if ( elem.tagName ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
876 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
877 |
if ( value != undefined ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
878 |
if ( name == "type" && jQuery.nodeName(elem,"input") && elem.parentNode ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
879 |
throw "type property can't be changed"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
880 |
elem.setAttribute( name, value ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
881 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
882 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
883 |
if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
884 |
return elem.getAttribute( name, 2 ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
885 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
886 |
return elem.getAttribute( name ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
887 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
888 |
// elem is actually elem.style ... set the style |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
889 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
890 |
// IE actually uses filters for opacity |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
891 |
if ( name == "opacity" && jQuery.browser.msie ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
892 |
if ( value != undefined ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
893 |
// IE has trouble with opacity if it does not have layout |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
894 |
// Force it by setting the zoom level |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
895 |
elem.zoom = 1; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
896 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
897 |
// Set the alpha filter to set the opacity |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
898 |
elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/,"") + |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
899 |
(parseFloat(value).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
900 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
901 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
902 |
return elem.filter ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
903 |
(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : ""; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
904 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
905 |
name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
906 |
if ( value != undefined ) elem[name] = value; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
907 |
return elem[name]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
908 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
909 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
910 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
911 |
trim: function(t){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
912 |
return (t||"").replace(/^\s+|\s+$/g, ""); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
913 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
914 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
915 |
makeArray: function( a ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
916 |
var r = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
917 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
918 |
// Need to use typeof to fight Safari childNodes crashes |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
919 |
if ( typeof a != "array" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
920 |
for ( var i = 0, al = a.length; i < al; i++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
921 |
r.push( a[i] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
922 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
923 |
r = a.slice( 0 ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
924 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
925 |
return r; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
926 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
927 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
928 |
inArray: function( b, a ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
929 |
for ( var i = 0, al = a.length; i < al; i++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
930 |
if ( a[i] == b ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
931 |
return i; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
932 |
return -1; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
933 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
934 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
935 |
merge: function(first, second) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
936 |
// We have to loop this way because IE & Opera overwrite the length |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
937 |
// expando of getElementsByTagName |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
938 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
939 |
// Also, we need to make sure that the correct elements are being returned |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
940 |
// (IE returns comment nodes in a '*' query) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
941 |
if ( jQuery.browser.msie ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
942 |
for ( var i = 0; second[i]; i++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
943 |
if ( second[i].nodeType != 8 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
944 |
first.push(second[i]); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
945 |
} else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
946 |
for ( var i = 0; second[i]; i++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
947 |
first.push(second[i]); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
948 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
949 |
return first; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
950 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
951 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
952 |
unique: function(first) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
953 |
var r = [], done = {}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
954 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
955 |
try { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
956 |
for ( var i = 0, fl = first.length; i < fl; i++ ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
957 |
var id = jQuery.data(first[i]); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
958 |
if ( !done[id] ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
959 |
done[id] = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
960 |
r.push(first[i]); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
961 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
962 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
963 |
} catch(e) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
964 |
r = first; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
965 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
966 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
967 |
return r; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
968 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
969 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
970 |
grep: function(elems, fn, inv) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
971 |
// If a string is passed in for the function, make a function |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
972 |
// for it (a handy shortcut) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
973 |
if ( typeof fn == "string" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
974 |
fn = eval("false||function(a,i){return " + fn + "}"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
975 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
976 |
var result = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
977 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
978 |
// Go through the array, only saving the items |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
979 |
// that pass the validator function |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
980 |
for ( var i = 0, el = elems.length; i < el; i++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
981 |
if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
982 |
result.push( elems[i] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
983 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
984 |
return result; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
985 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
986 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
987 |
map: function(elems, fn) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
988 |
// If a string is passed in for the function, make a function |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
989 |
// for it (a handy shortcut) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
990 |
if ( typeof fn == "string" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
991 |
fn = eval("false||function(a){return " + fn + "}"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
992 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
993 |
var result = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
994 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
995 |
// Go through the array, translating each of the items to their |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
996 |
// new value (or values). |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
997 |
for ( var i = 0, el = elems.length; i < el; i++ ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
998 |
var val = fn(elems[i],i); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
999 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1000 |
if ( val !== null && val != undefined ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1001 |
if ( val.constructor != Array ) val = [val]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1002 |
result = result.concat( val ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1003 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1004 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1005 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1006 |
return result; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1007 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1008 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1009 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1010 |
var userAgent = navigator.userAgent.toLowerCase(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1011 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1012 |
// Figure out what browser is being used |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1013 |
jQuery.browser = { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1014 |
version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1], |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1015 |
safari: /webkit/.test(userAgent), |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1016 |
opera: /opera/.test(userAgent), |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1017 |
msie: /msie/.test(userAgent) && !/opera/.test(userAgent), |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1018 |
mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1019 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1020 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1021 |
var styleFloat = jQuery.browser.msie ? "styleFloat" : "cssFloat"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1022 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1023 |
jQuery.extend({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1024 |
// Check to see if the W3C box model is being used |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1025 |
boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1026 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1027 |
styleFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1028 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1029 |
props: { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1030 |
"for": "htmlFor", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1031 |
"class": "className", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1032 |
"float": styleFloat, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1033 |
cssFloat: styleFloat, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1034 |
styleFloat: styleFloat, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1035 |
innerHTML: "innerHTML", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1036 |
className: "className", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1037 |
value: "value", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1038 |
disabled: "disabled", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1039 |
checked: "checked", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1040 |
readonly: "readOnly", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1041 |
selected: "selected", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1042 |
maxlength: "maxLength" |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1043 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1044 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1045 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1046 |
jQuery.each({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1047 |
parent: "a.parentNode", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1048 |
parents: "jQuery.dir(a,'parentNode')", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1049 |
next: "jQuery.nth(a,2,'nextSibling')", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1050 |
prev: "jQuery.nth(a,2,'previousSibling')", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1051 |
nextAll: "jQuery.dir(a,'nextSibling')", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1052 |
prevAll: "jQuery.dir(a,'previousSibling')", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1053 |
siblings: "jQuery.sibling(a.parentNode.firstChild,a)", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1054 |
children: "jQuery.sibling(a.firstChild)", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1055 |
contents: "jQuery.nodeName(a,'iframe')?a.contentDocument||a.contentWindow.document:jQuery.makeArray(a.childNodes)" |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1056 |
}, function(i,n){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1057 |
jQuery.fn[ i ] = function(a) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1058 |
var ret = jQuery.map(this,n); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1059 |
if ( a && typeof a == "string" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1060 |
ret = jQuery.multiFilter(a,ret); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1061 |
return this.pushStack( jQuery.unique(ret) ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1062 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1063 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1064 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1065 |
jQuery.each({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1066 |
appendTo: "append", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1067 |
prependTo: "prepend", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1068 |
insertBefore: "before", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1069 |
insertAfter: "after", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1070 |
replaceAll: "replaceWith" |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1071 |
}, function(i,n){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1072 |
jQuery.fn[ i ] = function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1073 |
var a = arguments; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1074 |
return this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1075 |
for ( var j = 0, al = a.length; j < al; j++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1076 |
jQuery(a[j])[n]( this ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1077 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1078 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1079 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1080 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1081 |
jQuery.each( { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1082 |
removeAttr: function( key ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1083 |
jQuery.attr( this, key, "" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1084 |
this.removeAttribute( key ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1085 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1086 |
addClass: function(c){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1087 |
jQuery.className.add(this,c); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1088 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1089 |
removeClass: function(c){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1090 |
jQuery.className.remove(this,c); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1091 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1092 |
toggleClass: function( c ){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1093 |
jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this, c); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1094 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1095 |
remove: function(a){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1096 |
if ( !a || jQuery.filter( a, [this] ).r.length ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1097 |
jQuery.removeData( this ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1098 |
this.parentNode.removeChild( this ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1099 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1100 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1101 |
empty: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1102 |
// Clean up the cache |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1103 |
jQuery("*", this).each(function(){ jQuery.removeData(this); }); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1104 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1105 |
while ( this.firstChild ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1106 |
this.removeChild( this.firstChild ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1107 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1108 |
}, function(i,n){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1109 |
jQuery.fn[ i ] = function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1110 |
return this.each( n, arguments ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1111 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1112 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1113 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1114 |
jQuery.each( [ "Height", "Width" ], function(i,name){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1115 |
var n = name.toLowerCase(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1116 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1117 |
jQuery.fn[ n ] = function(h) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1118 |
return this[0] == window ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1119 |
jQuery.browser.safari && self["inner" + name] || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1120 |
jQuery.boxModel && Math.max(document.documentElement["client" + name], document.body["client" + name]) || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1121 |
document.body["client" + name] : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1122 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1123 |
this[0] == document ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1124 |
Math.max( document.body["scroll" + name], document.body["offset" + name] ) : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1125 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1126 |
h == undefined ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1127 |
( this.length ? jQuery.css( this[0], n ) : null ) : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1128 |
this.css( n, h.constructor == String ? h : h + "px" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1129 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1130 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1131 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1132 |
var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1133 |
"(?:[\\w*_-]|\\\\.)" : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1134 |
"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1135 |
quickChild = new RegExp("^>\\s*(" + chars + "+)"), |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1136 |
quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"), |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1137 |
quickClass = new RegExp("^([#.]?)(" + chars + "*)"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1138 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1139 |
jQuery.extend({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1140 |
expr: { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1141 |
"": "m[2]=='*'||jQuery.nodeName(a,m[2])", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1142 |
"#": "a.getAttribute('id')==m[2]", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1143 |
":": { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1144 |
// Position Checks |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1145 |
lt: "i<m[3]-0", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1146 |
gt: "i>m[3]-0", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1147 |
nth: "m[3]-0==i", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1148 |
eq: "m[3]-0==i", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1149 |
first: "i==0", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1150 |
last: "i==r.length-1", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1151 |
even: "i%2==0", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1152 |
odd: "i%2", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1153 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1154 |
// Child Checks |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1155 |
"first-child": "a.parentNode.getElementsByTagName('*')[0]==a", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1156 |
"last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1157 |
"only-child": "!jQuery.nth(a.parentNode.lastChild,2,'previousSibling')", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1158 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1159 |
// Parent Checks |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1160 |
parent: "a.firstChild", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1161 |
empty: "!a.firstChild", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1162 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1163 |
// Text Check |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1164 |
contains: "(a.textContent||a.innerText||jQuery(a).text()||'').indexOf(m[3])>=0", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1165 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1166 |
// Visibility |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1167 |
visible: '"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"', |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1168 |
hidden: '"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"', |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1169 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1170 |
// Form attributes |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1171 |
enabled: "!a.disabled", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1172 |
disabled: "a.disabled", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1173 |
checked: "a.checked", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1174 |
selected: "a.selected||jQuery.attr(a,'selected')", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1175 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1176 |
// Form elements |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1177 |
text: "'text'==a.type", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1178 |
radio: "'radio'==a.type", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1179 |
checkbox: "'checkbox'==a.type", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1180 |
file: "'file'==a.type", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1181 |
password: "'password'==a.type", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1182 |
submit: "'submit'==a.type", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1183 |
image: "'image'==a.type", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1184 |
reset: "'reset'==a.type", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1185 |
button: '"button"==a.type||jQuery.nodeName(a,"button")', |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1186 |
input: "/input|select|textarea|button/i.test(a.nodeName)", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1187 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1188 |
// :has() |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1189 |
has: "jQuery.find(m[3],a).length", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1190 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1191 |
// :header |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1192 |
header: "/h\\d/i.test(a.nodeName)", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1193 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1194 |
// :animated |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1195 |
animated: "jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length" |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1196 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1197 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1198 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1199 |
// The regular expressions that power the parsing engine |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1200 |
parse: [ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1201 |
// Match: [@value='test'], [@foo] |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1202 |
/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1203 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1204 |
// Match: :contains('foo') |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1205 |
/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1206 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1207 |
// Match: :even, :last-chlid, #id, .class |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1208 |
new RegExp("^([:.#]*)(" + chars + "+)") |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1209 |
], |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1210 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1211 |
multiFilter: function( expr, elems, not ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1212 |
var old, cur = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1213 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1214 |
while ( expr && expr != old ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1215 |
old = expr; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1216 |
var f = jQuery.filter( expr, elems, not ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1217 |
expr = f.t.replace(/^\s*,\s*/, "" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1218 |
cur = not ? elems = f.r : jQuery.merge( cur, f.r ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1219 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1220 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1221 |
return cur; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1222 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1223 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1224 |
find: function( t, context ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1225 |
// Quickly handle non-string expressions |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1226 |
if ( typeof t != "string" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1227 |
return [ t ]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1228 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1229 |
// Make sure that the context is a DOM Element |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1230 |
if ( context && !context.nodeType ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1231 |
context = null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1232 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1233 |
// Set the correct context (if none is provided) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1234 |
context = context || document; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1235 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1236 |
// Initialize the search |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1237 |
var ret = [context], done = [], last; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1238 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1239 |
// Continue while a selector expression exists, and while |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1240 |
// we're no longer looping upon ourselves |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1241 |
while ( t && last != t ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1242 |
var r = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1243 |
last = t; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1244 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1245 |
t = jQuery.trim(t); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1246 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1247 |
var foundToken = false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1248 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1249 |
// An attempt at speeding up child selectors that |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1250 |
// point to a specific element tag |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1251 |
var re = quickChild; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1252 |
var m = re.exec(t); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1253 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1254 |
if ( m ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1255 |
var nodeName = m[1].toUpperCase(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1256 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1257 |
// Perform our own iteration and filter |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1258 |
for ( var i = 0; ret[i]; i++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1259 |
for ( var c = ret[i].firstChild; c; c = c.nextSibling ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1260 |
if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName.toUpperCase()) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1261 |
r.push( c ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1262 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1263 |
ret = r; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1264 |
t = t.replace( re, "" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1265 |
if ( t.indexOf(" ") == 0 ) continue; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1266 |
foundToken = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1267 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1268 |
re = /^([>+~])\s*(\w*)/i; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1269 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1270 |
if ( (m = re.exec(t)) != null ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1271 |
r = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1272 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1273 |
var nodeName = m[2], merge = {}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1274 |
m = m[1]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1275 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1276 |
for ( var j = 0, rl = ret.length; j < rl; j++ ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1277 |
var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1278 |
for ( ; n; n = n.nextSibling ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1279 |
if ( n.nodeType == 1 ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1280 |
var id = jQuery.data(n); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1281 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1282 |
if ( m == "~" && merge[id] ) break; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1283 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1284 |
if (!nodeName || n.nodeName.toUpperCase() == nodeName.toUpperCase() ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1285 |
if ( m == "~" ) merge[id] = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1286 |
r.push( n ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1287 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1288 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1289 |
if ( m == "+" ) break; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1290 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1291 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1292 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1293 |
ret = r; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1294 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1295 |
// And remove the token |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1296 |
t = jQuery.trim( t.replace( re, "" ) ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1297 |
foundToken = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1298 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1299 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1300 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1301 |
// See if there's still an expression, and that we haven't already |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1302 |
// matched a token |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1303 |
if ( t && !foundToken ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1304 |
// Handle multiple expressions |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1305 |
if ( !t.indexOf(",") ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1306 |
// Clean the result set |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1307 |
if ( context == ret[0] ) ret.shift(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1308 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1309 |
// Merge the result sets |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1310 |
done = jQuery.merge( done, ret ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1311 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1312 |
// Reset the context |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1313 |
r = ret = [context]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1314 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1315 |
// Touch up the selector string |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1316 |
t = " " + t.substr(1,t.length); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1317 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1318 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1319 |
// Optimize for the case nodeName#idName |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1320 |
var re2 = quickID; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1321 |
var m = re2.exec(t); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1322 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1323 |
// Re-organize the results, so that they're consistent |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1324 |
if ( m ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1325 |
m = [ 0, m[2], m[3], m[1] ]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1326 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1327 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1328 |
// Otherwise, do a traditional filter check for |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1329 |
// ID, class, and element selectors |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1330 |
re2 = quickClass; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1331 |
m = re2.exec(t); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1332 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1333 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1334 |
m[2] = m[2].replace(/\\/g, ""); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1335 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1336 |
var elem = ret[ret.length-1]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1337 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1338 |
// Try to do a global search by ID, where we can |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1339 |
if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1340 |
// Optimization for HTML document case |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1341 |
var oid = elem.getElementById(m[2]); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1342 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1343 |
// Do a quick check for the existence of the actual ID attribute |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1344 |
// to avoid selecting by the name attribute in IE |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1345 |
// also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1346 |
if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1347 |
oid = jQuery('[@id="'+m[2]+'"]', elem)[0]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1348 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1349 |
// Do a quick check for node name (where applicable) so |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1350 |
// that div#foo searches will be really fast |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1351 |
ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1352 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1353 |
// We need to find all descendant elements |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1354 |
for ( var i = 0; ret[i]; i++ ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1355 |
// Grab the tag name being searched for |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1356 |
var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1357 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1358 |
// Handle IE7 being really dumb about <object>s |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1359 |
if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1360 |
tag = "param"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1361 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1362 |
r = jQuery.merge( r, ret[i].getElementsByTagName( tag )); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1363 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1364 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1365 |
// It's faster to filter by class and be done with it |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1366 |
if ( m[1] == "." ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1367 |
r = jQuery.classFilter( r, m[2] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1368 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1369 |
// Same with ID filtering |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1370 |
if ( m[1] == "#" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1371 |
var tmp = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1372 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1373 |
// Try to find the element with the ID |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1374 |
for ( var i = 0; r[i]; i++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1375 |
if ( r[i].getAttribute("id") == m[2] ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1376 |
tmp = [ r[i] ]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1377 |
break; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1378 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1379 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1380 |
r = tmp; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1381 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1382 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1383 |
ret = r; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1384 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1385 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1386 |
t = t.replace( re2, "" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1387 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1388 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1389 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1390 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1391 |
// If a selector string still exists |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1392 |
if ( t ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1393 |
// Attempt to filter it |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1394 |
var val = jQuery.filter(t,r); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1395 |
ret = r = val.r; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1396 |
t = jQuery.trim(val.t); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1397 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1398 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1399 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1400 |
// An error occurred with the selector; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1401 |
// just return an empty set instead |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1402 |
if ( t ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1403 |
ret = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1404 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1405 |
// Remove the root context |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1406 |
if ( ret && context == ret[0] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1407 |
ret.shift(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1408 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1409 |
// And combine the results |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1410 |
done = jQuery.merge( done, ret ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1411 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1412 |
return done; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1413 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1414 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1415 |
classFilter: function(r,m,not){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1416 |
m = " " + m + " "; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1417 |
var tmp = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1418 |
for ( var i = 0; r[i]; i++ ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1419 |
var pass = (" " + r[i].className + " ").indexOf( m ) >= 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1420 |
if ( !not && pass || not && !pass ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1421 |
tmp.push( r[i] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1422 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1423 |
return tmp; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1424 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1425 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1426 |
filter: function(t,r,not) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1427 |
var last; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1428 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1429 |
// Look for common filter expressions |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1430 |
while ( t && t != last ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1431 |
last = t; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1432 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1433 |
var p = jQuery.parse, m; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1434 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1435 |
for ( var i = 0; p[i]; i++ ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1436 |
m = p[i].exec( t ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1437 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1438 |
if ( m ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1439 |
// Remove what we just matched |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1440 |
t = t.substring( m[0].length ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1441 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1442 |
m[2] = m[2].replace(/\\/g, ""); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1443 |
break; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1444 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1445 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1446 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1447 |
if ( !m ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1448 |
break; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1449 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1450 |
// :not() is a special case that can be optimized by |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1451 |
// keeping it out of the expression list |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1452 |
if ( m[1] == ":" && m[2] == "not" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1453 |
r = jQuery.filter(m[3], r, true).r; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1454 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1455 |
// We can get a big speed boost by filtering by class here |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1456 |
else if ( m[1] == "." ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1457 |
r = jQuery.classFilter(r, m[2], not); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1458 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1459 |
else if ( m[1] == "[" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1460 |
var tmp = [], type = m[3]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1461 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1462 |
for ( var i = 0, rl = r.length; i < rl; i++ ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1463 |
var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1464 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1465 |
if ( z == null || /href|src|selected/.test(m[2]) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1466 |
z = jQuery.attr(a,m[2]) || ''; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1467 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1468 |
if ( (type == "" && !!z || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1469 |
type == "=" && z == m[5] || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1470 |
type == "!=" && z != m[5] || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1471 |
type == "^=" && z && !z.indexOf(m[5]) || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1472 |
type == "$=" && z.substr(z.length - m[5].length) == m[5] || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1473 |
(type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1474 |
tmp.push( a ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1475 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1476 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1477 |
r = tmp; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1478 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1479 |
// We can get a speed boost by handling nth-child here |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1480 |
} else if ( m[1] == ":" && m[2] == "nth-child" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1481 |
var merge = {}, tmp = [], |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1482 |
test = /(\d*)n\+?(\d*)/.exec( |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1483 |
m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1484 |
!/\D/.test(m[3]) && "n+" + m[3] || m[3]), |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1485 |
first = (test[1] || 1) - 0, last = test[2] - 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1486 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1487 |
for ( var i = 0, rl = r.length; i < rl; i++ ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1488 |
var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1489 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1490 |
if ( !merge[id] ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1491 |
var c = 1; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1492 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1493 |
for ( var n = parentNode.firstChild; n; n = n.nextSibling ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1494 |
if ( n.nodeType == 1 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1495 |
n.nodeIndex = c++; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1496 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1497 |
merge[id] = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1498 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1499 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1500 |
var add = false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1501 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1502 |
if ( first == 1 ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1503 |
if ( last == 0 || node.nodeIndex == last ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1504 |
add = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1505 |
} else if ( (node.nodeIndex + last) % first == 0 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1506 |
add = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1507 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1508 |
if ( add ^ not ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1509 |
tmp.push( node ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1510 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1511 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1512 |
r = tmp; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1513 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1514 |
// Otherwise, find the expression to execute |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1515 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1516 |
var f = jQuery.expr[m[1]]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1517 |
if ( typeof f != "string" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1518 |
f = jQuery.expr[m[1]][m[2]]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1519 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1520 |
// Build a custom macro to enclose it |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1521 |
f = eval("false||function(a,i){return " + f + "}"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1522 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1523 |
// Execute it against the current filter |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1524 |
r = jQuery.grep( r, f, not ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1525 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1526 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1527 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1528 |
// Return an array of filtered elements (r) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1529 |
// and the modified expression string (t) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1530 |
return { r: r, t: t }; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1531 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1532 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1533 |
dir: function( elem, dir ){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1534 |
var matched = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1535 |
var cur = elem[dir]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1536 |
while ( cur && cur != document ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1537 |
if ( cur.nodeType == 1 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1538 |
matched.push( cur ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1539 |
cur = cur[dir]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1540 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1541 |
return matched; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1542 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1543 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1544 |
nth: function(cur,result,dir,elem){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1545 |
result = result || 1; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1546 |
var num = 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1547 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1548 |
for ( ; cur; cur = cur[dir] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1549 |
if ( cur.nodeType == 1 && ++num == result ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1550 |
break; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1551 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1552 |
return cur; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1553 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1554 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1555 |
sibling: function( n, elem ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1556 |
var r = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1557 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1558 |
for ( ; n; n = n.nextSibling ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1559 |
if ( n.nodeType == 1 && (!elem || n != elem) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1560 |
r.push( n ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1561 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1562 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1563 |
return r; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1564 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1565 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1566 |
/* |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1567 |
* A number of helper functions used for managing events. |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1568 |
* Many of the ideas behind this code orignated from |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1569 |
* Dean Edwards' addEvent library. |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1570 |
*/ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1571 |
jQuery.event = { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1572 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1573 |
// Bind an event to an element |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1574 |
// Original by Dean Edwards |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1575 |
add: function(element, type, handler, data) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1576 |
// For whatever reason, IE has trouble passing the window object |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1577 |
// around, causing it to be cloned in the process |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1578 |
if ( jQuery.browser.msie && element.setInterval != undefined ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1579 |
element = window; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1580 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1581 |
// Make sure that the function being executed has a unique ID |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1582 |
if ( !handler.guid ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1583 |
handler.guid = this.guid++; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1584 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1585 |
// if data is passed, bind to handler |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1586 |
if( data != undefined ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1587 |
// Create temporary function pointer to original handler |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1588 |
var fn = handler; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1589 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1590 |
// Create unique handler function, wrapped around original handler |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1591 |
handler = function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1592 |
// Pass arguments and context to original handler |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1593 |
return fn.apply(this, arguments); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1594 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1595 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1596 |
// Store data in unique handler |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1597 |
handler.data = data; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1598 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1599 |
// Set the guid of unique handler to the same of original handler, so it can be removed |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1600 |
handler.guid = fn.guid; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1601 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1602 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1603 |
// Namespaced event handlers |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1604 |
var parts = type.split("."); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1605 |
type = parts[0]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1606 |
handler.type = parts[1]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1607 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1608 |
// Init the element's event structure |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1609 |
var events = jQuery.data(element, "events") || jQuery.data(element, "events", {}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1610 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1611 |
var handle = jQuery.data(element, "handle", function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1612 |
// returned undefined or false |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1613 |
var val; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1614 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1615 |
// Handle the second event of a trigger and when |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1616 |
// an event is called after a page has unloaded |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1617 |
if ( typeof jQuery == "undefined" || jQuery.event.triggered ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1618 |
return val; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1619 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1620 |
val = jQuery.event.handle.apply(element, arguments); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1621 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1622 |
return val; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1623 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1624 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1625 |
// Get the current list of functions bound to this event |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1626 |
var handlers = events[type]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1627 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1628 |
// Init the event handler queue |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1629 |
if (!handlers) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1630 |
handlers = events[type] = {}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1631 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1632 |
// And bind the global event handler to the element |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1633 |
if (element.addEventListener) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1634 |
element.addEventListener(type, handle, false); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1635 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1636 |
element.attachEvent("on" + type, handle); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1637 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1638 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1639 |
// Add the function to the element's handler list |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1640 |
handlers[handler.guid] = handler; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1641 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1642 |
// Keep track of which events have been used, for global triggering |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1643 |
this.global[type] = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1644 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1645 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1646 |
guid: 1, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1647 |
global: {}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1648 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1649 |
// Detach an event or set of events from an element |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1650 |
remove: function(element, type, handler) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1651 |
var events = jQuery.data(element, "events"), ret, index; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1652 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1653 |
// Namespaced event handlers |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1654 |
if ( typeof type == "string" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1655 |
var parts = type.split("."); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1656 |
type = parts[0]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1657 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1658 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1659 |
if ( events ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1660 |
// type is actually an event object here |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1661 |
if ( type && type.type ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1662 |
handler = type.handler; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1663 |
type = type.type; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1664 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1665 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1666 |
if ( !type ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1667 |
for ( type in events ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1668 |
this.remove( element, type ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1669 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1670 |
} else if ( events[type] ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1671 |
// remove the given handler for the given type |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1672 |
if ( handler ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1673 |
delete events[type][handler.guid]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1674 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1675 |
// remove all handlers for the given type |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1676 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1677 |
for ( handler in events[type] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1678 |
// Handle the removal of namespaced events |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1679 |
if ( !parts[1] || events[type][handler].type == parts[1] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1680 |
delete events[type][handler]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1681 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1682 |
// remove generic event handler if no more handlers exist |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1683 |
for ( ret in events[type] ) break; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1684 |
if ( !ret ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1685 |
if (element.removeEventListener) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1686 |
element.removeEventListener(type, jQuery.data(element, "handle"), false); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1687 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1688 |
element.detachEvent("on" + type, jQuery.data(element, "handle")); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1689 |
ret = null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1690 |
delete events[type]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1691 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1692 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1693 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1694 |
// Remove the expando if it's no longer used |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1695 |
for ( ret in events ) break; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1696 |
if ( !ret ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1697 |
jQuery.removeData( element, "events" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1698 |
jQuery.removeData( element, "handle" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1699 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1700 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1701 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1702 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1703 |
trigger: function(type, data, element, donative, extra) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1704 |
// Clone the incoming data, if any |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1705 |
data = jQuery.makeArray(data || []); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1706 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1707 |
// Handle a global trigger |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1708 |
if ( !element ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1709 |
// Only trigger if we've ever bound an event for it |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1710 |
if ( this.global[type] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1711 |
jQuery("*").add([window, document]).trigger(type, data); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1712 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1713 |
// Handle triggering a single element |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1714 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1715 |
var val, ret, fn = jQuery.isFunction( element[ type ] || null ), |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1716 |
// Check to see if we need to provide a fake event, or not |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1717 |
evt = !data[0] || !data[0].preventDefault; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1718 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1719 |
// Pass along a fake event |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1720 |
if ( evt ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1721 |
data.unshift( this.fix({ type: type, target: element }) ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1722 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1723 |
// Enforce the right trigger type |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1724 |
data[0].type = type; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1725 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1726 |
// Trigger the event |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1727 |
if ( jQuery.isFunction( jQuery.data(element, "handle") ) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1728 |
val = jQuery.data(element, "handle").apply( element, data ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1729 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1730 |
// Handle triggering native .onfoo handlers |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1731 |
if ( !fn && element["on"+type] && element["on"+type].apply( element, data ) === false ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1732 |
val = false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1733 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1734 |
// Extra functions don't get the custom event object |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1735 |
if ( evt ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1736 |
data.shift(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1737 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1738 |
// Handle triggering of extra function |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1739 |
if ( extra && extra.apply( element, data ) === false ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1740 |
val = false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1741 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1742 |
// Trigger the native events (except for clicks on links) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1743 |
if ( fn && donative !== false && val !== false && !(jQuery.nodeName(element, 'a') && type == "click") ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1744 |
this.triggered = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1745 |
element[ type ](); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1746 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1747 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1748 |
this.triggered = false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1749 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1750 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1751 |
return val; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1752 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1753 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1754 |
handle: function(event) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1755 |
// returned undefined or false |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1756 |
var val; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1757 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1758 |
// Empty object is for triggered events with no data |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1759 |
event = jQuery.event.fix( event || window.event || {} ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1760 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1761 |
// Namespaced event handlers |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1762 |
var parts = event.type.split("."); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1763 |
event.type = parts[0]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1764 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1765 |
var c = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type], args = Array.prototype.slice.call( arguments, 1 ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1766 |
args.unshift( event ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1767 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1768 |
for ( var j in c ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1769 |
// Pass in a reference to the handler function itself |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1770 |
// So that we can later remove it |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1771 |
args[0].handler = c[j]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1772 |
args[0].data = c[j].data; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1773 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1774 |
// Filter the functions by class |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1775 |
if ( !parts[1] || c[j].type == parts[1] ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1776 |
var tmp = c[j].apply( this, args ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1777 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1778 |
if ( val !== false ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1779 |
val = tmp; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1780 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1781 |
if ( tmp === false ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1782 |
event.preventDefault(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1783 |
event.stopPropagation(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1784 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1785 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1786 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1787 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1788 |
// Clean up added properties in IE to prevent memory leak |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1789 |
if (jQuery.browser.msie) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1790 |
event.target = event.preventDefault = event.stopPropagation = |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1791 |
event.handler = event.data = null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1792 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1793 |
return val; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1794 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1795 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1796 |
fix: function(event) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1797 |
// store a copy of the original event object |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1798 |
// and clone to set read-only properties |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1799 |
var originalEvent = event; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1800 |
event = jQuery.extend({}, originalEvent); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1801 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1802 |
// add preventDefault and stopPropagation since |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1803 |
// they will not work on the clone |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1804 |
event.preventDefault = function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1805 |
// if preventDefault exists run it on the original event |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1806 |
if (originalEvent.preventDefault) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1807 |
originalEvent.preventDefault(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1808 |
// otherwise set the returnValue property of the original event to false (IE) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1809 |
originalEvent.returnValue = false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1810 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1811 |
event.stopPropagation = function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1812 |
// if stopPropagation exists run it on the original event |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1813 |
if (originalEvent.stopPropagation) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1814 |
originalEvent.stopPropagation(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1815 |
// otherwise set the cancelBubble property of the original event to true (IE) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1816 |
originalEvent.cancelBubble = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1817 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1818 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1819 |
// Fix target property, if necessary |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1820 |
if ( !event.target && event.srcElement ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1821 |
event.target = event.srcElement; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1822 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1823 |
// check if target is a textnode (safari) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1824 |
if (jQuery.browser.safari && event.target.nodeType == 3) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1825 |
event.target = originalEvent.target.parentNode; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1826 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1827 |
// Add relatedTarget, if necessary |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1828 |
if ( !event.relatedTarget && event.fromElement ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1829 |
event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1830 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1831 |
// Calculate pageX/Y if missing and clientX/Y available |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1832 |
if ( event.pageX == null && event.clientX != null ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1833 |
var e = document.documentElement, b = document.body; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1834 |
event.pageX = event.clientX + (e && e.scrollLeft || b.scrollLeft || 0); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1835 |
event.pageY = event.clientY + (e && e.scrollTop || b.scrollTop || 0); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1836 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1837 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1838 |
// Add which for key events |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1839 |
if ( !event.which && (event.charCode || event.keyCode) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1840 |
event.which = event.charCode || event.keyCode; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1841 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1842 |
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1843 |
if ( !event.metaKey && event.ctrlKey ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1844 |
event.metaKey = event.ctrlKey; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1845 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1846 |
// Add which for click: 1 == left; 2 == middle; 3 == right |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1847 |
// Note: button is not normalized, so don't use it |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1848 |
if ( !event.which && event.button ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1849 |
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1850 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1851 |
return event; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1852 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1853 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1854 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1855 |
jQuery.fn.extend({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1856 |
bind: function( type, data, fn ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1857 |
return type == "unload" ? this.one(type, data, fn) : this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1858 |
jQuery.event.add( this, type, fn || data, fn && data ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1859 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1860 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1861 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1862 |
one: function( type, data, fn ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1863 |
return this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1864 |
jQuery.event.add( this, type, function(event) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1865 |
jQuery(this).unbind(event); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1866 |
return (fn || data).apply( this, arguments); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1867 |
}, fn && data); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1868 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1869 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1870 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1871 |
unbind: function( type, fn ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1872 |
return this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1873 |
jQuery.event.remove( this, type, fn ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1874 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1875 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1876 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1877 |
trigger: function( type, data, fn ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1878 |
return this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1879 |
jQuery.event.trigger( type, data, this, true, fn ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1880 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1881 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1882 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1883 |
triggerHandler: function( type, data, fn ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1884 |
if ( this[0] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1885 |
return jQuery.event.trigger( type, data, this[0], false, fn ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1886 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1887 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1888 |
toggle: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1889 |
// Save reference to arguments for access in closure |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1890 |
var a = arguments; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1891 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1892 |
return this.click(function(e) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1893 |
// Figure out which function to execute |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1894 |
this.lastToggle = 0 == this.lastToggle ? 1 : 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1895 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1896 |
// Make sure that clicks stop |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1897 |
e.preventDefault(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1898 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1899 |
// and execute the function |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1900 |
return a[this.lastToggle].apply( this, [e] ) || false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1901 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1902 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1903 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1904 |
hover: function(f,g) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1905 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1906 |
// A private function for handling mouse 'hovering' |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1907 |
function handleHover(e) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1908 |
// Check if mouse(over|out) are still within the same parent element |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1909 |
var p = e.relatedTarget; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1910 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1911 |
// Traverse up the tree |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1912 |
while ( p && p != this ) try { p = p.parentNode; } catch(e) { p = this; }; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1913 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1914 |
// If we actually just moused on to a sub-element, ignore it |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1915 |
if ( p == this ) return false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1916 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1917 |
// Execute the right function |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1918 |
return (e.type == "mouseover" ? f : g).apply(this, [e]); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1919 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1920 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1921 |
// Bind the function to the two event listeners |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1922 |
return this.mouseover(handleHover).mouseout(handleHover); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1923 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1924 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1925 |
ready: function(f) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1926 |
// Attach the listeners |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1927 |
bindReady(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1928 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1929 |
// If the DOM is already ready |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1930 |
if ( jQuery.isReady ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1931 |
// Execute the function immediately |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1932 |
f.apply( document, [jQuery] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1933 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1934 |
// Otherwise, remember the function for later |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1935 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1936 |
// Add the function to the wait list |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1937 |
jQuery.readyList.push( function() { return f.apply(this, [jQuery]); } ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1938 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1939 |
return this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1940 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1941 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1942 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1943 |
jQuery.extend({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1944 |
/* |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1945 |
* All the code that makes DOM Ready work nicely. |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1946 |
*/ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1947 |
isReady: false, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1948 |
readyList: [], |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1949 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1950 |
// Handle when the DOM is ready |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1951 |
ready: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1952 |
// Make sure that the DOM is not already loaded |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1953 |
if ( !jQuery.isReady ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1954 |
// Remember that the DOM is ready |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1955 |
jQuery.isReady = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1956 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1957 |
// If there are functions bound, to execute |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1958 |
if ( jQuery.readyList ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1959 |
// Execute all of them |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1960 |
jQuery.each( jQuery.readyList, function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1961 |
this.apply( document ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1962 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1963 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1964 |
// Reset the list of functions |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1965 |
jQuery.readyList = null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1966 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1967 |
// Remove event listener to avoid memory leak |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1968 |
if ( jQuery.browser.mozilla || jQuery.browser.opera ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1969 |
document.removeEventListener( "DOMContentLoaded", jQuery.ready, false ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1970 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1971 |
// Remove script element used by IE hack |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1972 |
if( !window.frames.length ) // don't remove if frames are present (#1187) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1973 |
jQuery(window).load(function(){ jQuery("#__ie_init").remove(); }); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1974 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1975 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1976 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1977 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1978 |
jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1979 |
"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1980 |
"submit,keydown,keypress,keyup,error").split(","), function(i,o){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1981 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1982 |
// Handle event binding |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1983 |
jQuery.fn[o] = function(f){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1984 |
return f ? this.bind(o, f) : this.trigger(o); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1985 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1986 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1987 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1988 |
var readyBound = false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1989 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1990 |
function bindReady(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1991 |
if ( readyBound ) return; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1992 |
readyBound = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1993 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1994 |
// If Mozilla is used |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1995 |
if ( jQuery.browser.mozilla || jQuery.browser.opera ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1996 |
// Use the handy event callback |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1997 |
document.addEventListener( "DOMContentLoaded", jQuery.ready, false ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1998 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
1999 |
// If IE is used, use the excellent hack by Matthias Miller |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2000 |
// http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2001 |
else if ( jQuery.browser.msie ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2002 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2003 |
// Only works if you document.write() it |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2004 |
document.write("<scr" + "ipt id=__ie_init defer=true " + |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2005 |
"src=//:><\/script>"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2006 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2007 |
// Use the defer script hack |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2008 |
var script = document.getElementById("__ie_init"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2009 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2010 |
// script does not exist if jQuery is loaded dynamically |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2011 |
if ( script ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2012 |
script.onreadystatechange = function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2013 |
if ( this.readyState != "complete" ) return; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2014 |
jQuery.ready(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2015 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2016 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2017 |
// Clear from memory |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2018 |
script = null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2019 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2020 |
// If Safari is used |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2021 |
} else if ( jQuery.browser.safari ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2022 |
// Continually check to see if the document.readyState is valid |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2023 |
jQuery.safariTimer = setInterval(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2024 |
// loaded and complete are both valid states |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2025 |
if ( document.readyState == "loaded" || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2026 |
document.readyState == "complete" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2027 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2028 |
// If either one are found, remove the timer |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2029 |
clearInterval( jQuery.safariTimer ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2030 |
jQuery.safariTimer = null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2031 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2032 |
// and execute any waiting functions |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2033 |
jQuery.ready(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2034 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2035 |
}, 10); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2036 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2037 |
// A fallback to window.onload, that will always work |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2038 |
jQuery.event.add( window, "load", jQuery.ready ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2039 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2040 |
jQuery.fn.extend({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2041 |
load: function( url, params, callback ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2042 |
if ( jQuery.isFunction( url ) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2043 |
return this.bind("load", url); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2044 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2045 |
var off = url.indexOf(" "); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2046 |
if ( off >= 0 ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2047 |
var selector = url.slice(off, url.length); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2048 |
url = url.slice(0, off); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2049 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2050 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2051 |
callback = callback || function(){}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2052 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2053 |
// Default to a GET request |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2054 |
var type = "GET"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2055 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2056 |
// If the second parameter was provided |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2057 |
if ( params ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2058 |
// If it's a function |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2059 |
if ( jQuery.isFunction( params ) ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2060 |
// We assume that it's the callback |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2061 |
callback = params; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2062 |
params = null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2063 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2064 |
// Otherwise, build a param string |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2065 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2066 |
params = jQuery.param( params ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2067 |
type = "POST"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2068 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2069 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2070 |
var self = this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2071 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2072 |
// Request the remote document |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2073 |
jQuery.ajax({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2074 |
url: url, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2075 |
type: type, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2076 |
data: params, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2077 |
complete: function(res, status){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2078 |
// If successful, inject the HTML into all the matched elements |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2079 |
if ( status == "success" || status == "notmodified" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2080 |
// See if a selector was specified |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2081 |
self.html( selector ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2082 |
// Create a dummy div to hold the results |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2083 |
jQuery("<div/>") |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2084 |
// inject the contents of the document in, removing the scripts |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2085 |
// to avoid any 'Permission Denied' errors in IE |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2086 |
.append(res.responseText.replace(/<script(.|\s)*?\/script>/g, "")) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2087 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2088 |
// Locate the specified elements |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2089 |
.find(selector) : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2090 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2091 |
// If not, just inject the full result |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2092 |
res.responseText ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2093 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2094 |
// Add delay to account for Safari's delay in globalEval |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2095 |
setTimeout(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2096 |
self.each( callback, [res.responseText, status, res] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2097 |
}, 13); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2098 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2099 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2100 |
return this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2101 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2102 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2103 |
serialize: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2104 |
return jQuery.param(this.serializeArray()); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2105 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2106 |
serializeArray: function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2107 |
return this.map(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2108 |
return jQuery.nodeName(this, "form") ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2109 |
jQuery.makeArray(this.elements) : this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2110 |
}) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2111 |
.filter(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2112 |
return this.name && !this.disabled && |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2113 |
(this.checked || /select|textarea/i.test(this.nodeName) || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2114 |
/text|hidden|password/i.test(this.type)); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2115 |
}) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2116 |
.map(function(i, elem){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2117 |
var val = jQuery(this).val(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2118 |
return val == null ? null : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2119 |
val.constructor == Array ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2120 |
jQuery.map( val, function(val, i){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2121 |
return {name: elem.name, value: val}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2122 |
}) : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2123 |
{name: elem.name, value: val}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2124 |
}).get(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2125 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2126 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2127 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2128 |
// Attach a bunch of functions for handling common AJAX events |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2129 |
jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2130 |
jQuery.fn[o] = function(f){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2131 |
return this.bind(o, f); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2132 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2133 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2134 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2135 |
var jsc = (new Date).getTime(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2136 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2137 |
jQuery.extend({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2138 |
get: function( url, data, callback, type ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2139 |
// shift arguments if data argument was ommited |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2140 |
if ( jQuery.isFunction( data ) ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2141 |
callback = data; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2142 |
data = null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2143 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2144 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2145 |
return jQuery.ajax({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2146 |
type: "GET", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2147 |
url: url, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2148 |
data: data, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2149 |
success: callback, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2150 |
dataType: type |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2151 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2152 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2153 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2154 |
getScript: function( url, callback ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2155 |
return jQuery.get(url, null, callback, "script"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2156 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2157 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2158 |
getJSON: function( url, data, callback ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2159 |
return jQuery.get(url, data, callback, "json"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2160 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2161 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2162 |
post: function( url, data, callback, type ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2163 |
if ( jQuery.isFunction( data ) ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2164 |
callback = data; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2165 |
data = {}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2166 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2167 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2168 |
return jQuery.ajax({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2169 |
type: "POST", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2170 |
url: url, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2171 |
data: data, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2172 |
success: callback, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2173 |
dataType: type |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2174 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2175 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2176 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2177 |
ajaxSetup: function( settings ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2178 |
jQuery.extend( jQuery.ajaxSettings, settings ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2179 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2180 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2181 |
ajaxSettings: { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2182 |
global: true, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2183 |
type: "GET", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2184 |
timeout: 0, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2185 |
contentType: "application/x-www-form-urlencoded", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2186 |
processData: true, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2187 |
async: true, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2188 |
data: null |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2189 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2190 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2191 |
// Last-Modified header cache for next request |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2192 |
lastModified: {}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2193 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2194 |
ajax: function( s ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2195 |
var jsonp, jsre = /=(\?|%3F)/g, status, data; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2196 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2197 |
// Extend the settings, but re-extend 's' so that it can be |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2198 |
// checked again later (in the test suite, specifically) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2199 |
s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2200 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2201 |
// convert data if not already a string |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2202 |
if ( s.data && s.processData && typeof s.data != "string" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2203 |
s.data = jQuery.param(s.data); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2204 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2205 |
// Handle JSONP Parameter Callbacks |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2206 |
if ( s.dataType == "jsonp" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2207 |
if ( s.type.toLowerCase() == "get" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2208 |
if ( !s.url.match(jsre) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2209 |
s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2210 |
} else if ( !s.data || !s.data.match(jsre) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2211 |
s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2212 |
s.dataType = "json"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2213 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2214 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2215 |
// Build temporary JSONP function |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2216 |
if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2217 |
jsonp = "jsonp" + jsc++; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2218 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2219 |
// Replace the =? sequence both in the query string and the data |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2220 |
if ( s.data ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2221 |
s.data = s.data.replace(jsre, "=" + jsonp); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2222 |
s.url = s.url.replace(jsre, "=" + jsonp); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2223 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2224 |
// We need to make sure |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2225 |
// that a JSONP style response is executed properly |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2226 |
s.dataType = "script"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2227 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2228 |
// Handle JSONP-style loading |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2229 |
window[ jsonp ] = function(tmp){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2230 |
data = tmp; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2231 |
success(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2232 |
complete(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2233 |
// Garbage collect |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2234 |
window[ jsonp ] = undefined; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2235 |
try{ delete window[ jsonp ]; } catch(e){} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2236 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2237 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2238 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2239 |
if ( s.dataType == "script" && s.cache == null ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2240 |
s.cache = false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2241 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2242 |
if ( s.cache === false && s.type.toLowerCase() == "get" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2243 |
s.url += (s.url.match(/\?/) ? "&" : "?") + "_=" + (new Date()).getTime(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2244 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2245 |
// If data is available, append data to url for get requests |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2246 |
if ( s.data && s.type.toLowerCase() == "get" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2247 |
s.url += (s.url.match(/\?/) ? "&" : "?") + s.data; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2248 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2249 |
// IE likes to send both get and post data, prevent this |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2250 |
s.data = null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2251 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2252 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2253 |
// Watch for a new set of requests |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2254 |
if ( s.global && ! jQuery.active++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2255 |
jQuery.event.trigger( "ajaxStart" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2256 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2257 |
// If we're requesting a remote document |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2258 |
// and trying to load JSON or Script |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2259 |
if ( !s.url.indexOf("http") && s.dataType == "script" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2260 |
var head = document.getElementsByTagName("head")[0]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2261 |
var script = document.createElement("script"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2262 |
script.src = s.url; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2263 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2264 |
// Handle Script loading |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2265 |
if ( !jsonp && (s.success || s.complete) ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2266 |
var done = false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2267 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2268 |
// Attach handlers for all browsers |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2269 |
script.onload = script.onreadystatechange = function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2270 |
if ( !done && (!this.readyState || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2271 |
this.readyState == "loaded" || this.readyState == "complete") ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2272 |
done = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2273 |
success(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2274 |
complete(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2275 |
head.removeChild( script ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2276 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2277 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2278 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2279 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2280 |
head.appendChild(script); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2281 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2282 |
// We handle everything using the script element injection |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2283 |
return; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2284 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2285 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2286 |
var requestDone = false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2287 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2288 |
// Create the request object; Microsoft failed to properly |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2289 |
// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2290 |
var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2291 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2292 |
// Open the socket |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2293 |
xml.open(s.type, s.url, s.async); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2294 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2295 |
// Set the correct header, if data is being sent |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2296 |
if ( s.data ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2297 |
xml.setRequestHeader("Content-Type", s.contentType); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2298 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2299 |
// Set the If-Modified-Since header, if ifModified mode. |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2300 |
if ( s.ifModified ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2301 |
xml.setRequestHeader("If-Modified-Since", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2302 |
jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2303 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2304 |
// Set header so the called script knows that it's an XMLHttpRequest |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2305 |
xml.setRequestHeader("X-Requested-With", "XMLHttpRequest"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2306 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2307 |
// Allow custom headers/mimetypes |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2308 |
if ( s.beforeSend ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2309 |
s.beforeSend(xml); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2310 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2311 |
if ( s.global ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2312 |
jQuery.event.trigger("ajaxSend", [xml, s]); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2313 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2314 |
// Wait for a response to come back |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2315 |
var onreadystatechange = function(isTimeout){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2316 |
// The transfer is complete and the data is available, or the request timed out |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2317 |
if ( !requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout") ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2318 |
requestDone = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2319 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2320 |
// clear poll interval |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2321 |
if (ival) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2322 |
clearInterval(ival); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2323 |
ival = null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2324 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2325 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2326 |
status = isTimeout == "timeout" && "timeout" || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2327 |
!jQuery.httpSuccess( xml ) && "error" || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2328 |
s.ifModified && jQuery.httpNotModified( xml, s.url ) && "notmodified" || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2329 |
"success"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2330 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2331 |
if ( status == "success" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2332 |
// Watch for, and catch, XML document parse errors |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2333 |
try { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2334 |
// process the data (runs the xml through httpData regardless of callback) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2335 |
data = jQuery.httpData( xml, s.dataType ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2336 |
} catch(e) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2337 |
status = "parsererror"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2338 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2339 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2340 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2341 |
// Make sure that the request was successful or notmodified |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2342 |
if ( status == "success" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2343 |
// Cache Last-Modified header, if ifModified mode. |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2344 |
var modRes; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2345 |
try { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2346 |
modRes = xml.getResponseHeader("Last-Modified"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2347 |
} catch(e) {} // swallow exception thrown by FF if header is not available |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2348 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2349 |
if ( s.ifModified && modRes ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2350 |
jQuery.lastModified[s.url] = modRes; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2351 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2352 |
// JSONP handles its own success callback |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2353 |
if ( !jsonp ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2354 |
success(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2355 |
} else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2356 |
jQuery.handleError(s, xml, status); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2357 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2358 |
// Fire the complete handlers |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2359 |
complete(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2360 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2361 |
// Stop memory leaks |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2362 |
if ( s.async ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2363 |
xml = null; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2364 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2365 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2366 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2367 |
if ( s.async ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2368 |
// don't attach the handler to the request, just poll it instead |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2369 |
var ival = setInterval(onreadystatechange, 13); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2370 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2371 |
// Timeout checker |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2372 |
if ( s.timeout > 0 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2373 |
setTimeout(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2374 |
// Check to see if the request is still happening |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2375 |
if ( xml ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2376 |
// Cancel the request |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2377 |
xml.abort(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2378 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2379 |
if( !requestDone ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2380 |
onreadystatechange( "timeout" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2381 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2382 |
}, s.timeout); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2383 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2384 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2385 |
// Send the data |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2386 |
try { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2387 |
xml.send(s.data); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2388 |
} catch(e) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2389 |
jQuery.handleError(s, xml, null, e); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2390 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2391 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2392 |
// firefox 1.5 doesn't fire statechange for sync requests |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2393 |
if ( !s.async ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2394 |
onreadystatechange(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2395 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2396 |
// return XMLHttpRequest to allow aborting the request etc. |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2397 |
return xml; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2398 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2399 |
function success(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2400 |
// If a local callback was specified, fire it and pass it the data |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2401 |
if ( s.success ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2402 |
s.success( data, status ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2403 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2404 |
// Fire the global callback |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2405 |
if ( s.global ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2406 |
jQuery.event.trigger( "ajaxSuccess", [xml, s] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2407 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2408 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2409 |
function complete(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2410 |
// Process result |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2411 |
if ( s.complete ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2412 |
s.complete(xml, status); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2413 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2414 |
// The request was completed |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2415 |
if ( s.global ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2416 |
jQuery.event.trigger( "ajaxComplete", [xml, s] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2417 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2418 |
// Handle the global AJAX counter |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2419 |
if ( s.global && ! --jQuery.active ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2420 |
jQuery.event.trigger( "ajaxStop" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2421 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2422 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2423 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2424 |
handleError: function( s, xml, status, e ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2425 |
// If a local callback was specified, fire it |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2426 |
if ( s.error ) s.error( xml, status, e ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2427 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2428 |
// Fire the global callback |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2429 |
if ( s.global ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2430 |
jQuery.event.trigger( "ajaxError", [xml, s, e] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2431 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2432 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2433 |
// Counter for holding the number of active queries |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2434 |
active: 0, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2435 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2436 |
// Determines if an XMLHttpRequest was successful or not |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2437 |
httpSuccess: function( r ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2438 |
try { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2439 |
return !r.status && location.protocol == "file:" || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2440 |
( r.status >= 200 && r.status < 300 ) || r.status == 304 || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2441 |
jQuery.browser.safari && r.status == undefined; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2442 |
} catch(e){} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2443 |
return false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2444 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2445 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2446 |
// Determines if an XMLHttpRequest returns NotModified |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2447 |
httpNotModified: function( xml, url ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2448 |
try { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2449 |
var xmlRes = xml.getResponseHeader("Last-Modified"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2450 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2451 |
// Firefox always returns 200. check Last-Modified date |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2452 |
return xml.status == 304 || xmlRes == jQuery.lastModified[url] || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2453 |
jQuery.browser.safari && xml.status == undefined; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2454 |
} catch(e){} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2455 |
return false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2456 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2457 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2458 |
httpData: function( r, type ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2459 |
var ct = r.getResponseHeader("content-type"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2460 |
var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2461 |
var data = xml ? r.responseXML : r.responseText; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2462 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2463 |
if ( xml && data.documentElement.tagName == "parsererror" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2464 |
throw "parsererror"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2465 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2466 |
// If the type is "script", eval it in global context |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2467 |
if ( type == "script" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2468 |
jQuery.globalEval( data ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2469 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2470 |
// Get the JavaScript object, if JSON is used. |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2471 |
if ( type == "json" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2472 |
data = eval("(" + data + ")"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2473 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2474 |
return data; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2475 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2476 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2477 |
// Serialize an array of form elements or a set of |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2478 |
// key/values into a query string |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2479 |
param: function( a ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2480 |
var s = []; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2481 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2482 |
// If an array was passed in, assume that it is an array |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2483 |
// of form elements |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2484 |
if ( a.constructor == Array || a.jquery ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2485 |
// Serialize the form elements |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2486 |
jQuery.each( a, function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2487 |
s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2488 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2489 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2490 |
// Otherwise, assume that it's an object of key/value pairs |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2491 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2492 |
// Serialize the key/values |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2493 |
for ( var j in a ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2494 |
// If the value is an array then the key names need to be repeated |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2495 |
if ( a[j] && a[j].constructor == Array ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2496 |
jQuery.each( a[j], function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2497 |
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2498 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2499 |
else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2500 |
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2501 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2502 |
// Return the resulting serialization |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2503 |
return s.join("&").replace(/%20/g, "+"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2504 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2505 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2506 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2507 |
jQuery.fn.extend({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2508 |
show: function(speed,callback){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2509 |
return speed ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2510 |
this.animate({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2511 |
height: "show", width: "show", opacity: "show" |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2512 |
}, speed, callback) : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2513 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2514 |
this.filter(":hidden").each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2515 |
this.style.display = this.oldblock ? this.oldblock : ""; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2516 |
if ( jQuery.css(this,"display") == "none" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2517 |
this.style.display = "block"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2518 |
}).end(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2519 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2520 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2521 |
hide: function(speed,callback){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2522 |
return speed ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2523 |
this.animate({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2524 |
height: "hide", width: "hide", opacity: "hide" |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2525 |
}, speed, callback) : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2526 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2527 |
this.filter(":visible").each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2528 |
this.oldblock = this.oldblock || jQuery.css(this,"display"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2529 |
if ( this.oldblock == "none" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2530 |
this.oldblock = "block"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2531 |
this.style.display = "none"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2532 |
}).end(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2533 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2534 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2535 |
// Save the old toggle function |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2536 |
_toggle: jQuery.fn.toggle, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2537 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2538 |
toggle: function( fn, fn2 ){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2539 |
return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2540 |
this._toggle( fn, fn2 ) : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2541 |
fn ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2542 |
this.animate({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2543 |
height: "toggle", width: "toggle", opacity: "toggle" |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2544 |
}, fn, fn2) : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2545 |
this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2546 |
jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ](); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2547 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2548 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2549 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2550 |
slideDown: function(speed,callback){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2551 |
return this.animate({height: "show"}, speed, callback); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2552 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2553 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2554 |
slideUp: function(speed,callback){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2555 |
return this.animate({height: "hide"}, speed, callback); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2556 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2557 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2558 |
slideToggle: function(speed, callback){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2559 |
return this.animate({height: "toggle"}, speed, callback); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2560 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2561 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2562 |
fadeIn: function(speed, callback){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2563 |
return this.animate({opacity: "show"}, speed, callback); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2564 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2565 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2566 |
fadeOut: function(speed, callback){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2567 |
return this.animate({opacity: "hide"}, speed, callback); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2568 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2569 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2570 |
fadeTo: function(speed,to,callback){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2571 |
return this.animate({opacity: to}, speed, callback); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2572 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2573 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2574 |
animate: function( prop, speed, easing, callback ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2575 |
var opt = jQuery.speed(speed, easing, callback); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2576 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2577 |
return this[ opt.queue === false ? "each" : "queue" ](function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2578 |
opt = jQuery.extend({}, opt); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2579 |
var hidden = jQuery(this).is(":hidden"), self = this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2580 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2581 |
for ( var p in prop ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2582 |
if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2583 |
return jQuery.isFunction(opt.complete) && opt.complete.apply(this); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2584 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2585 |
if ( p == "height" || p == "width" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2586 |
// Store display property |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2587 |
opt.display = jQuery.css(this, "display"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2588 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2589 |
// Make sure that nothing sneaks out |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2590 |
opt.overflow = this.style.overflow; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2591 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2592 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2593 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2594 |
if ( opt.overflow != null ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2595 |
this.style.overflow = "hidden"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2596 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2597 |
opt.curAnim = jQuery.extend({}, prop); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2598 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2599 |
jQuery.each( prop, function(name, val){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2600 |
var e = new jQuery.fx( self, opt, name ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2601 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2602 |
if ( /toggle|show|hide/.test(val) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2603 |
e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2604 |
else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2605 |
var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/), |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2606 |
start = e.cur(true) || 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2607 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2608 |
if ( parts ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2609 |
var end = parseFloat(parts[2]), |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2610 |
unit = parts[3] || "px"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2611 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2612 |
// We need to compute starting value |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2613 |
if ( unit != "px" ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2614 |
self.style[ name ] = (end || 1) + unit; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2615 |
start = ((end || 1) / e.cur(true)) * start; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2616 |
self.style[ name ] = start + unit; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2617 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2618 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2619 |
// If a +=/-= token was provided, we're doing a relative animation |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2620 |
if ( parts[1] ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2621 |
end = ((parts[1] == "-=" ? -1 : 1) * end) + start; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2622 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2623 |
e.custom( start, end, unit ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2624 |
} else |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2625 |
e.custom( start, val, "" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2626 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2627 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2628 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2629 |
// For JS strict compliance |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2630 |
return true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2631 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2632 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2633 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2634 |
queue: function(type, fn){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2635 |
if ( jQuery.isFunction(type) ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2636 |
fn = type; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2637 |
type = "fx"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2638 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2639 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2640 |
if ( !type || (typeof type == "string" && !fn) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2641 |
return queue( this[0], type ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2642 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2643 |
return this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2644 |
if ( fn.constructor == Array ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2645 |
queue(this, type, fn); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2646 |
else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2647 |
queue(this, type).push( fn ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2648 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2649 |
if ( queue(this, type).length == 1 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2650 |
fn.apply(this); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2651 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2652 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2653 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2654 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2655 |
stop: function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2656 |
var timers = jQuery.timers; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2657 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2658 |
return this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2659 |
for ( var i = 0; i < timers.length; i++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2660 |
if ( timers[i].elem == this ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2661 |
timers.splice(i--, 1); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2662 |
}).dequeue(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2663 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2664 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2665 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2666 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2667 |
var queue = function( elem, type, array ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2668 |
if ( !elem ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2669 |
return; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2670 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2671 |
var q = jQuery.data( elem, type + "queue" ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2672 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2673 |
if ( !q || array ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2674 |
q = jQuery.data( elem, type + "queue", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2675 |
array ? jQuery.makeArray(array) : [] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2676 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2677 |
return q; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2678 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2679 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2680 |
jQuery.fn.dequeue = function(type){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2681 |
type = type || "fx"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2682 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2683 |
return this.each(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2684 |
var q = queue(this, type); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2685 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2686 |
q.shift(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2687 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2688 |
if ( q.length ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2689 |
q[0].apply( this ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2690 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2691 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2692 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2693 |
jQuery.extend({ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2694 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2695 |
speed: function(speed, easing, fn) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2696 |
var opt = speed && speed.constructor == Object ? speed : { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2697 |
complete: fn || !fn && easing || |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2698 |
jQuery.isFunction( speed ) && speed, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2699 |
duration: speed, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2700 |
easing: fn && easing || easing && easing.constructor != Function && easing |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2701 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2702 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2703 |
opt.duration = (opt.duration && opt.duration.constructor == Number ? |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2704 |
opt.duration : |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2705 |
{ slow: 600, fast: 200 }[opt.duration]) || 400; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2706 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2707 |
// Queueing |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2708 |
opt.old = opt.complete; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2709 |
opt.complete = function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2710 |
jQuery(this).dequeue(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2711 |
if ( jQuery.isFunction( opt.old ) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2712 |
opt.old.apply( this ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2713 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2714 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2715 |
return opt; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2716 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2717 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2718 |
easing: { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2719 |
linear: function( p, n, firstNum, diff ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2720 |
return firstNum + diff * p; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2721 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2722 |
swing: function( p, n, firstNum, diff ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2723 |
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2724 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2725 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2726 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2727 |
timers: [], |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2728 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2729 |
fx: function( elem, options, prop ){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2730 |
this.options = options; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2731 |
this.elem = elem; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2732 |
this.prop = prop; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2733 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2734 |
if ( !options.orig ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2735 |
options.orig = {}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2736 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2737 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2738 |
}); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2739 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2740 |
jQuery.fx.prototype = { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2741 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2742 |
// Simple function for setting a style value |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2743 |
update: function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2744 |
if ( this.options.step ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2745 |
this.options.step.apply( this.elem, [ this.now, this ] ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2746 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2747 |
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2748 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2749 |
// Set display property to block for height/width animations |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2750 |
if ( this.prop == "height" || this.prop == "width" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2751 |
this.elem.style.display = "block"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2752 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2753 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2754 |
// Get the current size |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2755 |
cur: function(force){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2756 |
if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2757 |
return this.elem[ this.prop ]; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2758 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2759 |
var r = parseFloat(jQuery.curCSS(this.elem, this.prop, force)); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2760 |
return r && r > -10000 ? r : parseFloat(jQuery.css(this.elem, this.prop)) || 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2761 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2762 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2763 |
// Start an animation from one number to another |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2764 |
custom: function(from, to, unit){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2765 |
this.startTime = (new Date()).getTime(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2766 |
this.start = from; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2767 |
this.end = to; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2768 |
this.unit = unit || this.unit || "px"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2769 |
this.now = this.start; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2770 |
this.pos = this.state = 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2771 |
this.update(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2772 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2773 |
var self = this; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2774 |
function t(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2775 |
return self.step(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2776 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2777 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2778 |
t.elem = this.elem; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2779 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2780 |
jQuery.timers.push(t); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2781 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2782 |
if ( jQuery.timers.length == 1 ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2783 |
var timer = setInterval(function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2784 |
var timers = jQuery.timers; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2785 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2786 |
for ( var i = 0; i < timers.length; i++ ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2787 |
if ( !timers[i]() ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2788 |
timers.splice(i--, 1); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2789 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2790 |
if ( !timers.length ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2791 |
clearInterval( timer ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2792 |
}, 13); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2793 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2794 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2795 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2796 |
// Simple 'show' function |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2797 |
show: function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2798 |
// Remember where we started, so that we can go back to it later |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2799 |
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2800 |
this.options.show = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2801 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2802 |
// Begin the animation |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2803 |
this.custom(0, this.cur()); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2804 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2805 |
// Make sure that we start at a small width/height to avoid any |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2806 |
// flash of content |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2807 |
if ( this.prop == "width" || this.prop == "height" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2808 |
this.elem.style[this.prop] = "1px"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2809 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2810 |
// Start by showing the element |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2811 |
jQuery(this.elem).show(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2812 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2813 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2814 |
// Simple 'hide' function |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2815 |
hide: function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2816 |
// Remember where we started, so that we can go back to it later |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2817 |
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2818 |
this.options.hide = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2819 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2820 |
// Begin the animation |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2821 |
this.custom(this.cur(), 0); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2822 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2823 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2824 |
// Each step of an animation |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2825 |
step: function(){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2826 |
var t = (new Date()).getTime(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2827 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2828 |
if ( t > this.options.duration + this.startTime ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2829 |
this.now = this.end; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2830 |
this.pos = this.state = 1; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2831 |
this.update(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2832 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2833 |
this.options.curAnim[ this.prop ] = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2834 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2835 |
var done = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2836 |
for ( var i in this.options.curAnim ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2837 |
if ( this.options.curAnim[i] !== true ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2838 |
done = false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2839 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2840 |
if ( done ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2841 |
if ( this.options.display != null ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2842 |
// Reset the overflow |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2843 |
this.elem.style.overflow = this.options.overflow; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2844 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2845 |
// Reset the display |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2846 |
this.elem.style.display = this.options.display; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2847 |
if ( jQuery.css(this.elem, "display") == "none" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2848 |
this.elem.style.display = "block"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2849 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2850 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2851 |
// Hide the element if the "hide" operation was done |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2852 |
if ( this.options.hide ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2853 |
this.elem.style.display = "none"; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2854 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2855 |
// Reset the properties, if the item has been hidden or shown |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2856 |
if ( this.options.hide || this.options.show ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2857 |
for ( var p in this.options.curAnim ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2858 |
jQuery.attr(this.elem.style, p, this.options.orig[p]); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2859 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2860 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2861 |
// If a callback was provided, execute it |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2862 |
if ( done && jQuery.isFunction( this.options.complete ) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2863 |
// Execute the complete function |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2864 |
this.options.complete.apply( this.elem ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2865 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2866 |
return false; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2867 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2868 |
var n = t - this.startTime; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2869 |
this.state = n / this.options.duration; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2870 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2871 |
// Perform the easing function, defaults to swing |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2872 |
this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2873 |
this.now = this.start + ((this.end - this.start) * this.pos); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2874 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2875 |
// Perform the next step of the animation |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2876 |
this.update(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2877 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2878 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2879 |
return true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2880 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2881 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2882 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2883 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2884 |
jQuery.fx.step = { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2885 |
scrollLeft: function(fx){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2886 |
fx.elem.scrollLeft = fx.now; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2887 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2888 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2889 |
scrollTop: function(fx){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2890 |
fx.elem.scrollTop = fx.now; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2891 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2892 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2893 |
opacity: function(fx){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2894 |
jQuery.attr(fx.elem.style, "opacity", fx.now); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2895 |
}, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2896 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2897 |
_default: function(fx){ |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2898 |
fx.elem.style[ fx.prop ] = fx.now + fx.unit; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2899 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2900 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2901 |
// The Offset Method |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2902 |
// Originally By Brandon Aaron, part of the Dimension Plugin |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2903 |
// http://jquery.com/plugins/project/dimensions |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2904 |
jQuery.fn.offset = function() { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2905 |
var left = 0, top = 0, elem = this[0], results; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2906 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2907 |
if ( elem ) with ( jQuery.browser ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2908 |
var absolute = jQuery.css(elem, "position") == "absolute", |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2909 |
parent = elem.parentNode, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2910 |
offsetParent = elem.offsetParent, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2911 |
doc = elem.ownerDocument, |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2912 |
safari2 = safari && parseInt(version) < 522; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2913 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2914 |
// Use getBoundingClientRect if available |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2915 |
if ( elem.getBoundingClientRect ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2916 |
box = elem.getBoundingClientRect(); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2917 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2918 |
// Add the document scroll offsets |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2919 |
add( |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2920 |
box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2921 |
box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2922 |
); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2923 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2924 |
// IE adds the HTML element's border, by default it is medium which is 2px |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2925 |
// IE 6 and IE 7 quirks mode the border width is overwritable by the following css html { border: 0; } |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2926 |
// IE 7 standards mode, the border is always 2px |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2927 |
if ( msie ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2928 |
var border = jQuery("html").css("borderWidth"); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2929 |
border = (border == "medium" || jQuery.boxModel && parseInt(version) >= 7) && 2 || border; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2930 |
add( -border, -border ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2931 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2932 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2933 |
// Otherwise loop through the offsetParents and parentNodes |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2934 |
} else { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2935 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2936 |
// Initial element offsets |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2937 |
add( elem.offsetLeft, elem.offsetTop ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2938 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2939 |
// Get parent offsets |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2940 |
while ( offsetParent ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2941 |
// Add offsetParent offsets |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2942 |
add( offsetParent.offsetLeft, offsetParent.offsetTop ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2943 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2944 |
// Mozilla and Safari > 2 does not include the border on offset parents |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2945 |
// However Mozilla adds the border for table cells |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2946 |
if ( mozilla && /^t[d|h]$/i.test(parent.tagName) || !safari2 ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2947 |
border( offsetParent ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2948 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2949 |
// Safari <= 2 doubles body offsets with an absolutely positioned element or parent |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2950 |
if ( safari2 && !absolute && jQuery.css(offsetParent, "position") == "absolute" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2951 |
absolute = true; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2952 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2953 |
// Get next offsetParent |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2954 |
offsetParent = offsetParent.offsetParent; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2955 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2956 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2957 |
// Get parent scroll offsets |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2958 |
while ( parent.tagName && !/^body|html$/i.test(parent.tagName) ) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2959 |
// Work around opera inline/table scrollLeft/Top bug |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2960 |
if ( !/^inline|table-row.*$/i.test(jQuery.css(parent, "display")) ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2961 |
// Subtract parent scroll offsets |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2962 |
add( -parent.scrollLeft, -parent.scrollTop ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2963 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2964 |
// Mozilla does not add the border for a parent that has overflow != visible |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2965 |
if ( mozilla && jQuery.css(parent, "overflow") != "visible" ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2966 |
border( parent ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2967 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2968 |
// Get next parent |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2969 |
parent = parent.parentNode; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2970 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2971 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2972 |
// Safari doubles body offsets with an absolutely positioned element or parent |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2973 |
if ( safari2 && absolute ) |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2974 |
add( -doc.body.offsetLeft, -doc.body.offsetTop ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2975 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2976 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2977 |
// Return an object with top and left properties |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2978 |
results = { top: top, left: left }; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2979 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2980 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2981 |
return results; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2982 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2983 |
function border(elem) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2984 |
add( jQuery.css(elem, "borderLeftWidth"), jQuery.css(elem, "borderTopWidth") ); |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2985 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2986 |
|
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2987 |
function add(l, t) { |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2988 |
left += parseInt(l) || 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2989 |
top += parseInt(t) || 0; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2990 |
} |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2991 |
}; |
8083d21c0020
The first commit of all the required files for the review app
amit@thunder
parents:
diff
changeset
|
2992 |
})(); |