h = h.responseText;
self.html(h).find("script").each(function(){
try {
- eval( this.text || this.textContent || this.innerHTML );
+ $.eval( this.text || this.textContent || this.innerHTML );
} catch(e){}
});
if(f){f(h);}
$.fn.formValues = function() {
var a = [];
this.find("input[@type='submit'],input[@type='hidden'],textarea,input[@checked],input[@type='password'],input[@type='text'],option[@selected]").filter(":enabled").each(function() {
- o = {};
+ var o = {};
o.name = this.name || this.id || this.parentNode.name || this.parentNode.id;
o.value = this.value;
a.push(o);
//
// Evaluate the scripts
objElement.html(strHTML).find("script").each(function(){
- try { eval( this.text || this.textContent || this.innerHTML ); } catch(e){}
+ try { $.eval( this.text || this.textContent || this.innerHTML ); } catch(e){}
});
//
-var e = ["blur","focus","contextmenu","load","resize","scroll","unload",
- "click","dblclick","mousedown","mouseup","mouseenter","mouseleave",
- "mousemove","mouseover","mouseout","change","reset","select","submit",
- "keydown","keypress","keyup","abort","error","ready"];
+(function(){
+ var e = ["blur","focus","contextmenu","load","resize","scroll","unload",
+ "click","dblclick","mousedown","mouseup","mouseenter","mouseleave",
+ "mousemove","mouseover","mouseout","change","reset","select","submit",
+ "keydown","keypress","keyup","abort","error","ready"];
-for ( var i = 0; i < e.length; i++ ) {
- (function(){
- var o = e[i];
- $.fn[o] = function(f){ return this.bind(o, f); };
- $.fn["un"+o] = function(f){ return this.unbind(o, f); };
- $.fn["do"+o] = function(){ return this.trigger(o); };
- $.fn["one"+o] = function(f){ return this.bind(o, function(e){
- if ( this[o+f] !== null ) { return true; }
- this[o+f]++;
- return $.apply(this,f,[e]);
- }); };
+ for ( var i = 0; i < e.length; i++ ) {
+ (function(){
+ var o = e[i];
+ $.fn[o] = function(f){ return this.bind(o, f); };
+ $.fn["un"+o] = function(f){ return this.unbind(o, f); };
+ $.fn["do"+o] = function(){ return this.trigger(o); };
+ $.fn["one"+o] = function(f){ return this.bind(o, function(e){
+ if ( this[o+f] !== null ) { return true; }
+ this[o+f]++;
+ return $.apply(this,f,[e]);
+ }); };
- // Deprecated
- //$.fn["on"+o] = function(f){ return this.bind(o, f); };
- })();
-}
+ // Deprecated
+ //$.fn["on"+o] = function(f){ return this.bind(o, f); };
+ })();
+ }
+})();
$.fn.hover = function(f,g) {
// Check if mouse(over|out) are still within the same parent element
return this.each(function(){
var obj = this;
- addEvent(this, "mouseover", function(e) {
+ $.event.add(this, "mouseover", function(e) {
var p = ( e.fromElement !== null ? e.fromElement : e.relatedTarget );
while ( p && p != obj ) { p = p.parentNode; }
if ( p == obj ) { return false; }
return $.apply(obj,f,[e]);
});
- addEvent(this, "mouseout", function(e) {
+ $.event.add(this, "mouseout", function(e) {
var p = ( e.toElement !== null ? e.toElement : e.relatedTarget );
while ( p && p != obj ) { p = p.parentNode; }
if ( p == obj ) { return false; }
document.addEventListener( "DOMContentLoaded", $.ready, null );
}
-addEvent( window, "load", $.ready );
+$.event.add( window, "load", $.ready );
$.fn.ready = function(f) {
return this.each(function(){
$.fn.hide = function(a,o) {
o = $.speed(a,o);
return a ? this.each(function(){
- new fx.FadeSize(this,o).hide();
+ new $.fx.FadeSize(this,o).hide();
}) : this._hide();
};
$.fn.show = function(a,o) {
o = $.speed(a,o);
return a ? this.each(function(){
- new fx.FadeSize(this,o).show();
+ new $.fx.FadeSize(this,o).show();
}) : this._show();
};
$.fn.slideDown = function(a,o) {
o = $.speed(a,o);
return this.each(function(){
- new fx.Resize(this,o).show("height");
+ new $.fx.Resize(this,o).show("height");
});
};
$.fn.slideUp = function(a,o) {
o = $.speed(a,o);
return this.each(function(){
- new fx.Resize(this,o).hide("height");
+ new $.fx.Resize(this,o).hide("height");
});
};
$.fn.fadeOut = function(a,o) {
o = $.speed(a,o);
return a ? this.each(function(){
- new fx.Opacity(this,o).hide();
+ new $.fx.Opacity(this,o).hide();
}) : this._hide();
};
$.fn.fadeIn = function(a,o) {
o = $.speed(a,o);
return a ? this.each(function(){
- new fx.Opacity(this,o).show();
+ new $.fx.Opacity(this,o).show();
}) : this._show();
};
* people. You've been warned.
*/
-function fx(el,op,ty,tz){
+$.fx = function(el,op,ty,tz){
var z = this;
z.a = function(){z.el.style[ty]=z.now+z.o.unit;};
z.max = function(){return z.el["io"+ty]||z.el["natural"+tz]||z.el["scroll"+tz]||z.cur();};
this.now=f;z.a();z.io=z.cur();z.s=(new Date()).getTime();
z.timer=setInterval(function(){z.step(f,t);}, 13);
};
-}
-fx.fn = ["show","hide","toggle"];
-fx.ty = ["Height","Width","Left","Top"];
-for(var $i in fx.ty){(function(){
- var c = fx.ty[$i];
- fx[c] = function(a,b){
- return new fx(a,b,c.toLowerCase(),c);
- };
-})();}
-fx.Opacity = function(a,b){
- var o = new fx(a,b,"opacity");
+};
+
+$.fx.fn = ["show","hide","toggle"];
+$.fx.ty = ["Height","Width","Left","Top"];
+
+(function(){
+ for(var $i in $.fx.ty){(function(){
+ var c = $.fx.ty[$i];
+ $.fx[c] = function(a,b){
+ return new $.fx(a,b,c.toLowerCase(),c);
+ };
+ })();}
+})();
+
+$.fx.Opacity = function(a,b){
+ var o = new $.fx(a,b,"opacity");
o.cur = function(){return parseFloat(o.el.style.opacity);};
o.a = function() {
var e = o.el.style;
o.a();
return o;
};
-fx.Resize = function(e,o){
+$.fx.Resize = function(e,o){
var z = this;
- var h = new fx.Height(e,o);
+ var h = new $.fx.Height(e,o);
if(o) { o.onComplete = null; }
- var w = new fx.Width(e,o);
+ var w = new $.fx.Width(e,o);
function c(a,b,d){return (!a||a==c||b==d);}
- for(var i in fx.fn){(function(){
- var j = fx.fn[i];
+ for(var i in $.fx.fn){(function(){
+ var j = $.fx.fn[i];
z[j] = function(a,b){
if(c(a,b,"height")) { h[j](); }
if(c(a,b,"width")) { w[j](); }
w.modify(d);
};
};
-fx.FadeSize = function(e,o){
+$.fx.FadeSize = function(e,o){
var z = this;
- var r = new fx.Resize(e,o);
+ var r = new $.fx.Resize(e,o);
if(o) { o.onComplete = null; }
- var p = new fx.Opacity(e,o);
- for(var i in fx.fn){(function(){
- var j = fx.fn[i];
+ var p = new $.fx.Opacity(e,o);
+ for(var i in $.fx.fn){(function(){
+ var j = $.fx.fn[i];
z[j] = function(a,b){p[j]();r[j](a,b);};
})();}
};
},
bind: function(t,f) {
- return this.each(function(){addEvent(this,t,f);});
+ return this.each(function(){$.event.add(this,t,f);});
},
unbind: function(t,f) {
- return this.each(function(){removeEvent(this,t,f);});
+ return this.each(function(){$.event.remove(this,t,f);});
},
trigger: function(t) {
- return this.each(function(){triggerEvent(this,t);});
+ return this.each(function(){$.event.trigger(this,t);});
},
find: function(t) {
return self;
}
+$.eval = eval;
+
$.apply = function(o,f,a) {
a = a || [];
if ( f.apply ) {
p[i] = 'a['+i+']';
}
o.$$exec = this;
- var r = eval('o.$$exec(' + p.join(',') + ')');
+ var r = $.eval('o.$$exec(' + p.join(',') + ')');
o.$$exec = null;
return r;
}
}
if ( f !== null ) {
- eval('f = function(a,i){return ' + f + '}');
+ $.eval('f = function(a,i){return ' + f + '}');
r = g( r, f );
}
}
return r;
};
+$.event = {};
+
// Bind an event to an element
// Original by Dean Edwards
-function addEvent(element, type, handler) {
+$.event.add = function(element, type, handler) {
if ( element.location ) { element = window; } // Ughhhhh....
- if (!handler.$$guid) { handler.$$guid = addEvent.guid++; }
+ if (!handler.$$guid) { handler.$$guid = $.event.add.guid++; }
if (!element.events) { element.events = {}; }
var handlers = element.events[type];
if (!handlers) {
}
}
handlers[handler.$$guid] = handler;
- element["on" + type] = handleEvent;
-}
+ element["on" + type] = $.event.handle;
+};
-addEvent.guid = 1;
+$.event.add.guid = 1;
// Detach an event or set of events from an element
-function removeEvent(element, type, handler) {
+$.event.remove = function(element, type, handler) {
if (element.events) {
if (type && element.events[type]) {
if ( handler ) {
}
} else {
for ( var j in element.events ) {
- removeEvent( element, j );
+ $.event.remove( element, j );
}
}
}
-}
+};
-function triggerEvent(element,type,data) {
+$.event.trigger = function(element,type,data) {
data = data || [{ type: type }];
if ( element && element["on" + type] ) {
$.apply( element, element["on" + type], data );
}
-}
+};
-function handleEvent(event) {
+$.event.handle = function(event) {
var returnValue = true;
- event = event || fixEvent(window.event);
+ event = event || $.event.fix(window.event);
var handlers = [];
for ( var j in this.events[event.type] ) {
handlers[handlers.length] = this.events[event.type][j];
} catch(e){}
}
return returnValue;
-}
+};
-function fixEvent(event) {
- event.preventDefault = fixEvent.preventDefault;
- event.stopPropagation = fixEvent.stopPropagation;
+$.event.fix = function(event) {
+ event.preventDefault = $.event.fix.preventDefault;
+ event.stopPropagation = $.event.fix.stopPropagation;
return event;
-}
+};
-fixEvent.preventDefault = function() {
+$.event.fix.preventDefault = function() {
this.returnValue = false;
};
-fixEvent.stopPropagation = function() {
+$.event.fix.stopPropagation = function() {
this.cancelBubble = true;
};