1 var e = ["blur","focus","contextmenu","load","resize","scroll","unload",
2 "click","dblclick","mousedown","mouseup","mouseenter","mouseleave",
3 "mousemove","mouseover","mouseout","change","reset","select","submit",
4 "keydown","keypress","keyup","abort","error","ready"];
6 for ( var i = 0; i < e.length; i++ ) {
9 $.fn[o] = function(f){ return this.bind(o, f); };
10 $.fn["un"+o] = function(f){ return this.unbind(o, f); };
11 $.fn["do"+o] = function(){ return this.trigger(o); };
12 $.fn["one"+o] = function(f){ return this.bind(o, function(e){
13 if ( this[o+f] != null ) return true;
15 return $.apply(this,f,[e]);
19 //$.fn["on"+o] = function(f){ return this.bind(o, f); };
23 $.fn.hover = function(f,g) {
24 // Check if mouse(over|out) are still within the same parent element
25 return this.each(function(){
27 addEvent(this, "mouseover", function(e) {
28 var p = ( e.fromElement != null ? e.fromElement : e.relatedTarget );
29 while ( p && p != obj ) p = p.parentNode;
30 if ( p == obj ) return false;
31 return $.apply(obj,f,[e]);
33 addEvent(this, "mouseout", function(e) {
34 var p = ( e.toElement != null ? e.toElement : e.relatedTarget );
35 while ( p && p != obj ) p = p.parentNode;
36 if ( p == obj ) return false;
37 return $.apply(obj,g,[e]);
43 $.fn.onhover = $.fn.hover;
45 $.fn.ready = function(f) {
46 return this.each(function(){
48 this.$$ready.push( f );
52 this.$$timer = setInterval( function(){
53 if ( obj && obj.getElementsByTagName && obj.getElementById && obj.body ) {
54 clearInterval( obj.$$timer );
56 for ( var i = 0; i < obj.$$ready.length; i++ )
57 $.apply( obj, obj.$$ready[i] );
66 $.fn.onready = $.fn.ready;
68 $.fn.toggle = function(a,b) {
69 return a && b ? this.click(function(e){
70 this.$$last = this.$$last == a ? b : a;
72 return $.apply( this, this.$$last, [e] ) || false;