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"];
5 for ( var i = 0; i < e.length; i++ ) {
8 $.fn[o] = function(f){ return this.bind(o, f); };
9 $.fn["un"+o] = function(f){ return this.unbind(o, f); };
10 $.fn["do"+o] = function(){ return this.trigger(o); };
11 $.fn["one"+o] = function(f){ return this.bind(o, function(e){
12 if ( this[o+f] != null ) return true;
14 return $.apply(this,f,[e]);
18 //$.fn["on"+o] = function(f){ return this.bind(o, f); };
22 $.fn.hover = function(f,g) {
23 // Check if mouse(over|out) are still within the same parent element
24 return this.each(function(){
26 addEvent(this, "mouseover", function(e) {
27 var p = ( e.fromElement != null ? e.fromElement : e.relatedTarget );
28 while ( p && p != obj ) p = p.parentNode;
29 if ( p == obj ) return false;
30 return $.apply(obj,f,[e]);
32 addEvent(this, "mouseout", function(e) {
33 var p = ( e.toElement != null ? e.toElement : e.relatedTarget );
34 while ( p && p != obj ) p = p.parentNode;
35 if ( p == obj ) return false;
36 return $.apply(obj,g,[e]);
42 $.fn.onhover = $.fn.hover;
44 $.fn.ready = function(f) {
45 return this.each(function(){
47 this.$$ready.push( f );
51 this.$$timer = setInterval( function(){
52 if ( obj && obj.getElementsByTagName && obj.getElementById && obj.body ) {
53 clearInterval( obj.$$timer );
55 for ( var i = 0; i < obj.$$ready.length; i++ )
56 $.apply( obj, obj.$$ready[i] );
65 $.fn.onready = $.fn.ready;
67 $.fn.toggle = function(a,b) {
68 return a && b ? this.click(function(e){
69 this.$$last = this.$$last == a ? b : a;
71 return $.apply( this, this.$$last, [e] ) || false;