};
});
-var jsc = (new Date).getTime();
+var jsc = now();
jQuery.extend({
get: function( url, data, callback, type ) {
s.cache = false;
if ( s.cache === false && s.type.toLowerCase() == "get" ) {
- var ts = (new Date()).getTime();
+ var ts = now();
// try replacing _= if it is there
var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
// if nothing was replaced, add timestamp to the end
},
httpData: function( r, type ) {
- var ct = r.getResponseHeader("content-type");
- var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
- var data = xml ? r.responseXML : r.responseText;
+ var ct = r.getResponseHeader("content-type"),
+ xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
+ data = xml ? r.responseXML : r.responseText;
if ( xml && data.documentElement.tagName == "parsererror" )
throw "parsererror";
*/
// Map over jQuery in case of overwrite
-if ( window.jQuery )
- var _jQuery = window.jQuery;
+var _jQuery = window.jQuery,
+// Map over the $ in case of overwrite
+ _$ = window.$;
-var jQuery = window.jQuery = function( selector, context ) {
+var jQuery = window.jQuery = window.$ = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
- return new jQuery.prototype.init( selector, context );
+ return new jQuery.fn.init( selector, context );
};
-// Map over the $ in case of overwrite
-if ( window.$ )
- var _$ = window.$;
-
-// Map the jQuery namespace to the '$' one
-window.$ = jQuery;
-
// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
-var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
+var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
// Is it a simple selector
-var isSimple = /^.[^:#\[\.]*$/;
+ isSimple = /^.[^:#\[\.]*$/;
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
},
is: function( selector ) {
- return selector ?
- jQuery.multiFilter( selector, this ).length > 0 :
- false;
+ return !!selector && jQuery.multiFilter( selector, this ).length > 0;
},
hasClass: function( selector ) {
};
// Give the init function the jQuery prototype for later instantiation
-jQuery.prototype.init.prototype = jQuery.prototype;
+jQuery.fn.init.prototype = jQuery.fn;
function evalScript( i, elem ) {
if ( elem.src )
elem.parentNode.removeChild( elem );
}
+function now(){
+ return +new Date;
+}
+
jQuery.extend = jQuery.fn.extend = function() {
// copy reference to target object
var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
return target;
};
-var expando = "jQuery" + (new Date()).getTime(), uuid = 0, windowData = {};
+var expando = "jQuery" + now(), uuid = 0, windowData = {},
// exclude the following css properties to add px
-var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
+ exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
// cache getComputedStyle
-var getComputedStyle = document.defaultView && document.defaultView.getComputedStyle;
+ getComputedStyle = document.defaultView && document.defaultView.getComputedStyle;
jQuery.extend({
noConflict: function( deep ) {
// If the element isn't reporting its values properly in Safari
// then some display: none elements are involved
else {
- var swap = [], stack = [];
+ var swap = [], stack = [], a = elem, i = 0;
// Locate all of the parent display: none elements
- for ( var a = elem; a && color(a); a = a.parentNode )
+ for ( ; a && color(a); a = a.parentNode )
stack.unshift(a);
// Go through and make them visible, but in reverse
// (It would be better if we knew the exact display type that they had)
- for ( var i = 0; i < stack.length; i++ )
+ for ( ; i < stack.length; i++ )
if ( color( stack[ i ] ) ) {
swap[ i ] = stack[ i ].style.display;
stack[ i ].style.display = "block";
( computedStyle && computedStyle.getPropertyValue( name ) ) || "";
// Finally, revert the display styles back
- for ( var i = 0; i < swap.length; i++ )
+ for ( i = 0; i < swap.length; i++ )
if ( swap[ i ] != null )
stack[ i ].style.display = swap[ i ];
}
return;
if ( elem.constructor == Number )
- elem = elem.toString();
+ elem += '';
// Convert html string into DOM nodes
if ( typeof elem == "string" ) {
// For whatever reason, IE has trouble passing the window object
// around, causing it to be cloned in the process
- if ( jQuery.browser.msie && elem.setInterval != undefined )
+ if ( jQuery.browser.msie && elem.setInterval )
elem = window;
// Make sure that the function being executed has a unique ID
// event in IE.
handle.elem = elem;
- // Handle multiple events seperated by a space
- // jQuery(...).bind("mouseover mouseout", fn);
- jQuery.each(types.split(/\s+/), function(index, type) {
- // Namespaced event handlers
- var parts = type.split(".");
- type = parts[0];
- handler.type = parts[1];
-
- // Get the current list of functions bound to this event
- var handlers = events[type];
-
- // Init the event handler queue
- if (!handlers) {
- handlers = events[type] = {};
-
- // Check for a special event handler
- // Only use addEventListener/attachEvent if the special
- // events handler returns false
- if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
- // Bind the global event handler to the element
- if (elem.addEventListener)
- elem.addEventListener(type, handle, false);
- else if (elem.attachEvent)
- elem.attachEvent("on" + type, handle);
- }
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ jQuery.each(types.split(/\s+/), function(index, type) {
+ // Namespaced event handlers
+ var parts = type.split(".");
+ type = parts[0];
+ handler.type = parts[1];
+
+ // Get the current list of functions bound to this event
+ var handlers = events[type];
+
+ // Init the event handler queue
+ if (!handlers) {
+ handlers = events[type] = {};
+
+ // Check for a special event handler
+ // Only use addEventListener/attachEvent if the special
+ // events handler returns false
+ if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
+ // Bind the global event handler to the element
+ if (elem.addEventListener)
+ elem.addEventListener(type, handle, false);
+ else if (elem.attachEvent)
+ elem.attachEvent("on" + type, handle);
}
+ }
- // Add the function to the element's handler list
- handlers[handler.guid] = handler;
+ // Add the function to the element's handler list
+ handlers[handler.guid] = handler;
- // Keep track of which events have been used, for global triggering
- jQuery.event.global[type] = true;
- });
+ // Keep track of which events have been used, for global triggering
+ jQuery.event.global[type] = true;
+ });
// Nullify elem to prevent memory leaks in IE
elem = null;
target: elem,
preventDefault: function(){},
stopPropagation: function(){},
- timeStamp: +new Date
+ timeStamp: now()
});
data[0][expando] = true; // no need to fix fake event
}
};
// Fix timeStamp
- event.timeStamp = event.timeStamp || +new Date;
+ event.timeStamp = event.timeStamp || now();
// Fix target property, if necessary
if ( !event.target )
// If we actually just moused on to a sub-element, ignore it
if ( withinElement(event, this) ) return true;
// Execute the right handlers by setting the event type to mouseenter
- arguments[0].type = "mouseenter";
+ event.type = "mouseenter";
return jQuery.event.handle.apply(this, arguments);
}
},
// If we actually just moused on to a sub-element, ignore it
if ( withinElement(event, this) ) return true;
// Execute the right handlers by setting the event type to mouseleave
- arguments[0].type = "mouseleave";
+ event.type = "mouseleave";
return jQuery.event.handle.apply(this, arguments);
}
}
},
triggerHandler: function( type, data, fn ) {
- if ( this[0] )
- return jQuery.event.trigger( type, data, this[0], false, fn );
- return undefined;
+ return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
},
toggle: function( fn ) {
if ( this.nodeType != 1)
return false;
- var opt = jQuery.extend({}, optall);
- var hidden = jQuery(this).is(":hidden"), self = this;
+ var opt = jQuery.extend({}, optall), p,
+ hidden = jQuery(this).is(":hidden"), self = this;
- for ( var p in prop ) {
+ for ( p in prop ) {
if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
return jQuery.isFunction(opt.complete) && opt.complete.apply(this);
});
var queue = function( elem, type, array ) {
- if ( !elem )
- return undefined;
-
- type = type || "fx";
-
- var q = jQuery.data( elem, type + "queue" );
-
- if ( !q || array )
- q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
+ if ( elem ){
+
+ type = type || "fx";
+
+ var q = jQuery.data( elem, type + "queue" );
+
+ if ( !q || array )
+ q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
+ }
return q;
};
opt.duration = (opt.duration && opt.duration.constructor == Number ?
opt.duration :
- { slow: 600, fast: 200 }[opt.duration]) || 400;
+ jQuery.fx.speeds[opt.duration]) || 400;
// Queueing
opt.old = opt.complete;
// Start an animation from one number to another
custom: function(from, to, unit){
- this.startTime = (new Date()).getTime();
+ this.startTime = now();
this.start = from;
this.end = to;
this.unit = unit || this.unit || "px";
// Each step of an animation
step: function(gotoEnd){
- var t = (new Date()).getTime();
+ var t = now();
if ( gotoEnd || t > this.options.duration + this.startTime ) {
this.now = this.end;
};
-jQuery.fx.step = {
- scrollLeft: function(fx){
- fx.elem.scrollLeft = fx.now;
- },
-
- scrollTop: function(fx){
- fx.elem.scrollTop = fx.now;
- },
-
- opacity: function(fx){
- jQuery.attr(fx.elem.style, "opacity", fx.now);
+jQuery.extend( jQuery.fx, {
+ speeds:{
+ slow: 600,
+ fast: 200
},
-
- _default: function(fx){
- fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+ step: {
+ scrollLeft: function(fx){
+ fx.elem.scrollLeft = fx.now;
+ },
+
+ scrollTop: function(fx){
+ fx.elem.scrollTop = fx.now;
+ },
+
+ opacity: function(fx){
+ jQuery.attr(fx.elem.style, "opacity", fx.now);
+ },
+
+ _default: function(fx){
+ fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+ }
}
-};
+});
t = jQuery.trim(t);
- var foundToken = false;
+ var foundToken = false,
// An attempt at speeding up child selectors that
// point to a specific element tag
- var re = quickChild;
- var m = re.exec(t);
+ re = quickChild,
+
+ m = re.exec(t);
if ( m ) {
nodeName = m[1].toUpperCase();
},
dir: function( elem, dir ){
- var matched = [];
- var cur = elem[dir];
+ var matched = [],
+ cur = elem[dir];
while ( cur && cur != document ) {
if ( cur.nodeType == 1 )
matched.push( cur );
}
});
+