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 $.ready = function() {
47 clearInterval( $.$$timer );
49 for ( var i = 0; i < $.$$ready.length; i++ ) {
50 $.apply( document, $.$$ready[i] );
56 if ( document.addEventListener ) {
57 document.addEventListener( "DOMContentLoaded", $.ready, null );
60 addEvent( window, "load", $.ready );
62 $.fn.ready = function(f) {
63 return this.each(function(){
69 $.$$timer = setInterval( function(){
70 if ( o && o.getElementsByTagName && o.getElementById && o.body ) {
79 $.fn.onready = $.fn.ready;
81 $.fn.toggle = function(a,b) {
82 return a && b ? this.click(function(e){
83 this.$$last = this.$$last == a ? b : a;
85 return $.apply( this, this.$$last, [e] ) || false;