6,17 → 6,19 |
* Dual licensed under the MIT and GPL licenses. |
* http://docs.jquery.com/License |
* |
* Date: 2009-05-12 22:43:51 +0700 (Втр, 12 Май 2009) |
* Revision: 6348 |
* Date: 2009-06-17 09:31:45 +0700 (Срд, 17 Июн 2009) |
* Revision: 6399 |
*/ |
(function(){ |
(function(window, undefined){ |
|
// Will speed up references to window, and allows munging its name. |
var window = this, |
// Define a local copy of jQuery |
var jQuery = function( selector, context ) { |
// The jQuery object is actually just the init constructor 'enhanced' |
return arguments.length === 0 ? |
rootjQuery : |
new jQuery.fn.init( selector, context ); |
}, |
|
// Will speed up references to undefined, and allows munging its name. |
undefined, |
|
// Map over jQuery in case of overwrite |
_jQuery = window.jQuery, |
|
23,19 → 25,9 |
// Map over the $ in case of overwrite |
_$ = window.$, |
|
// Define a local copy of jQuery |
jQuery, |
|
// A central reference to the root jQuery(document) |
rootjQuery, |
|
jQuery = window.jQuery = window.$ = function( selector, context ) { |
// The jQuery object is actually just the init constructor 'enhanced' |
return arguments.length === 0 ? |
rootjQuery : |
new jQuery.fn.init( selector, context ); |
}, |
|
// A simple way to check for HTML strings or ID strings |
// (both of which we optimize for) |
quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, |
49,6 → 41,9 |
// Save a reference to the core toString method |
toString = Object.prototype.toString; |
|
// Expose jQuery to the global object |
window.jQuery = window.$ = jQuery; |
|
jQuery.fn = jQuery.prototype = { |
init: function( selector, context ) { |
var match, elem, ret; |
1195,7 → 1190,7 |
} else if ( name === "not" ) { |
var not = match[3]; |
|
for ( var i = 0, l = not.length; i < l; i++ ) { |
for ( i = 0, l = not.length; i < l; i++ ) { |
if ( not[i] === elem ) { |
return false; |
} |
1209,13 → 1204,13 |
switch (type) { |
case 'only': |
case 'first': |
while (node = node.previousSibling) { |
while ( (node = node.previousSibling) ) { |
if ( node.nodeType === 1 ) return false; |
} |
if ( type == 'first') return true; |
node = elem; |
case 'last': |
while (node = node.nextSibling) { |
while ( (node = node.nextSibling) ) { |
if ( node.nodeType === 1 ) return false; |
} |
return true; |
1621,11 → 1616,21 |
jQuery.expr[":"] = jQuery.expr.filters; |
|
Sizzle.selectors.filters.hidden = function(elem){ |
return elem.offsetWidth === 0 && elem.offsetHeight === 0; |
var width = elem.offsetWidth, height = elem.offsetHeight; |
return ( width === 0 && height === 0 ) ? |
true : |
( width !== 0 && height !== 0 ) ? |
false : |
!!( jQuery.curCSS(elem, "display") === "none" ); |
}; |
|
Sizzle.selectors.filters.visible = function(elem){ |
return elem.offsetWidth > 0 || elem.offsetHeight > 0; |
var width = elem.offsetWidth, height = elem.offsetHeight; |
return ( width === 0 && height === 0 ) ? |
false : |
( width > 0 && height > 0 ) ? |
true : |
!!( jQuery.curCSS(elem, "display") !== "none" ); |
}; |
|
Sizzle.selectors.filters.animated = function(elem){ |
2246,8 → 2251,7 |
remove: function( selector ) { |
if ( !selector || jQuery.multiFilter( selector, [ this ] ).length ) { |
if ( this.nodeType === 1 ) { |
cleanData( this.getElementsByTagName("*") ); |
cleanData( [this] ); |
cleanData( jQuery("*", this).add(this) ); |
} |
|
if ( this.parentNode ) { |
2259,7 → 2263,7 |
empty: function() { |
// Remove element nodes and prevent memory leaks |
if ( this.nodeType === 1 ) { |
cleanData( this.getElementsByTagName("*") ); |
cleanData( jQuery("*", this) ); |
} |
|
// Remove any remaining nodes |
2652,16 → 2656,22 |
handle.apply( elem, data ); |
} |
|
var nativeFn, nativeHandler; |
try { |
nativeFn = elem[ type ]; |
nativeHandler = elem[ "on" + type ]; |
// prevent IE from throwing an error for some elements with some event types, see #3533 |
} catch (e) {} |
// Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) |
if ( (!elem[ type ] || (jQuery.nodeName(elem, 'a') && type === "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) { |
if ( (!nativeFn || (jQuery.nodeName(elem, 'a') && type === "click")) && nativeHandler && nativeHandler.apply( elem, data ) === false ) { |
event.result = false; |
} |
|
// Trigger the native events (except for clicks on links) |
if ( !bubbling && elem[ type ] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type === "click") ) { |
if ( !bubbling && nativeFn && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type === "click") ) { |
this.triggered = true; |
try { |
elem[ type ](); |
nativeFn(); |
// prevent IE from throwing an error for some hidden elements |
} catch (e) {} |
} |
2773,7 → 2783,7 |
|
// Add which for click: 1 == left; 2 == middle; 3 == right |
// Note: button is not normalized, so don't use it |
if ( !event.which && event.button ) { |
if ( !event.which && event.button !== undefined ) { |
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); |
} |
|
3286,6 → 3296,7 |
maxlength: "maxLength", |
cellspacing: "cellSpacing", |
rowspan: "rowSpan", |
colspan: "colSpan", |
tabindex: "tabIndex" |
}; |
// exclude the following css properties to add px |
3410,12 → 3421,12 |
}, |
|
curCSS: function( elem, name, force ) { |
var ret, style = elem.style; |
var ret, style = elem.style, filter; |
|
// IE uses filters for opacity |
if ( !jQuery.support.opacity && name == "opacity" ) { |
ret = style.filter && style.filter.indexOf("opacity=") >= 0 ? |
(parseFloat( style.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '': |
if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) { |
ret = (elem.currentStyle.filter || "").match(/opacity=([^)]*)/) ? |
(parseFloat(RegExp.$1) / 100) + "" : |
""; |
|
return ret === "" ? |
3664,6 → 3675,7 |
|
// Last-Modified header cache for next request |
lastModified: {}, |
etag: {}, |
|
ajax: function( s ) { |
// Extend the settings, but re-extend 's' so that it can be |
3727,9 → 3739,6 |
// If data is available, append data to url for get requests |
if ( s.data && type == "GET" ) { |
s.url += (s.url.match(/\?/) ? "&" : "?") + s.data; |
|
// IE likes to send both get and post data, prevent this |
s.data = null; |
} |
|
// Watch for a new set of requests |
3795,10 → 3804,13 |
if ( s.data ) |
xhr.setRequestHeader("Content-Type", s.contentType); |
|
// Set the If-Modified-Since header, if ifModified mode. |
if ( s.ifModified ) |
xhr.setRequestHeader("If-Modified-Since", |
jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); |
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
if ( s.ifModified ) { |
if (jQuery.lastModified[s.url]) |
xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]); |
if (jQuery.etag[s.url]) |
xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]); |
} |
|
// Set header so the called script knows that it's an XMLHttpRequest |
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); |
3860,16 → 3872,7 |
} |
|
// Make sure that the request was successful or notmodified |
if ( status == "success" ) { |
// Cache Last-Modified header, if ifModified mode. |
var modRes; |
try { |
modRes = xhr.getResponseHeader("Last-Modified"); |
} catch(e) {} // swallow exception thrown by FF if header is not available |
|
if ( s.ifModified && modRes ) |
jQuery.lastModified[s.url] = modRes; |
|
if ( status == "success" || status == "notmodified" ) { |
// JSONP handles its own success callback |
if ( !jsonp ) |
success(); |
3903,7 → 3906,7 |
|
// Send the data |
try { |
xhr.send(s.data); |
xhr.send( type === "POST" ? s.data : null ); |
} catch(e) { |
jQuery.handleError(s, xhr, null, e); |
} |
3964,13 → 3967,16 |
|
// Determines if an XMLHttpRequest returns NotModified |
httpNotModified: function( xhr, url ) { |
try { |
var xhrRes = xhr.getResponseHeader("Last-Modified"); |
var last_modified = xhr.getResponseHeader("Last-Modified"); |
var etag = xhr.getResponseHeader("Etag"); |
|
// Firefox always returns 200. check Last-Modified date |
return xhr.status == 304 || xhrRes == jQuery.lastModified[url]; |
} catch(e){} |
return false; |
if (last_modified) |
jQuery.lastModified[url] = last_modified; |
|
if (etag) |
jQuery.etag[url] = etag; |
|
return xhr.status == 304; |
}, |
|
httpData: function( xhr, type, s ) { |
3978,24 → 3984,32 |
xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0, |
data = xml ? xhr.responseXML : xhr.responseText; |
|
if ( xml && data.documentElement.tagName == "parsererror" ) |
if ( xml && data.documentElement.tagName == "parsererror" ) { |
throw "parsererror"; |
} |
|
// Allow a pre-filtering function to sanitize the response |
// s != null is checked to keep backwards compatibility |
if( s && s.dataFilter ) |
if ( s && s.dataFilter ) { |
data = s.dataFilter( data, type ); |
} |
|
// The filter can actually parse the response |
if( typeof data === "string" ){ |
if ( typeof data === "string" ) { |
|
// If the type is "script", eval it in global context |
if ( type == "script" ) |
if ( type === "script" ) { |
jQuery.globalEval( data ); |
} |
|
// Get the JavaScript object, if JSON is used. |
if ( type == "json" ) |
data = window["eval"]("(" + data + ")"); |
if ( type == "json" ) { |
if ( typeof JSON === "object" && JSON.parse ) { |
data = JSON.parse( data ); |
} else { |
data = (new Function("return " + data))(); |
} |
} |
} |
|
return data; |
4323,20 → 4337,8 |
|
t.elem = this.elem; |
|
if ( t() && jQuery.timers.push(t) && !timerId ) { |
timerId = setInterval(function(){ |
var timers = jQuery.timers; |
|
for ( var i = 0; i < timers.length; i++ ) |
if ( !timers[i]() ) |
timers.splice(i--, 1); |
|
if ( !timers.length ) { |
clearInterval( timerId ); |
timerId = undefined; |
} |
}, 13); |
} |
if ( t() && jQuery.timers.push(t) && !timerId ) |
timerId = setInterval(jQuery.fx.tick, 13); |
}, |
|
// Simple 'show' function |
4423,6 → 4425,23 |
}; |
|
jQuery.extend( jQuery.fx, { |
|
tick:function(){ |
var timers = jQuery.timers; |
|
for ( var i = 0; i < timers.length; i++ ) |
if ( !timers[i]() ) |
timers.splice(i--, 1); |
|
if ( !timers.length ) |
jQuery.fx.stop(); |
}, |
|
stop:function(){ |
clearInterval( timerId ); |
timerId = null; |
}, |
|
speeds:{ |
slow: 600, |
fast: 200, |
4429,6 → 4448,7 |
// Default speed |
_default: 400 |
}, |
|
step: { |
|
opacity: function(fx){ |
4656,4 → 4676,4 |
}; |
|
}); |
})(); |
})(window); |