SanSYS

Untitled

Jun 13th, 2015
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. define([
  2.     "../core",
  3.     "../event"
  4. ], function( jQuery ) {
  5.  
  6. jQuery.each( ("blur focus focusin focusout resize scroll click dblclick " +
  7.     "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  8.     "change select submit keydown keypress keyup contextmenu").split(" "),
  9.     function( i, name ) {
  10.  
  11.     // Handle event binding
  12.     jQuery.fn[ name ] = function( data, fn ) {
  13.         return arguments.length > 0 ?
  14.             this.on( name, null, data, fn ) :
  15.             this.trigger( name );
  16.     };
  17. });
  18.  
  19. jQuery.fn.extend({
  20.     hover: function( fnOver, fnOut ) {
  21.         return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  22.     },
  23.  
  24.     bind: function( types, data, fn ) {
  25.         return this.on( types, null, data, fn );
  26.     },
  27.     unbind: function( types, fn ) {
  28.         return this.off( types, null, fn );
  29.     },
  30.  
  31.     delegate: function( selector, types, data, fn ) {
  32.         return this.on( types, selector, data, fn );
  33.     },
  34.     undelegate: function( selector, types, fn ) {
  35.         // ( namespace ) or ( selector, types [, fn] )
  36.         return arguments.length === 1 ?
  37.             this.off( selector, "**" ) :
  38.             this.off( types, selector || "**", fn );
  39.     }
  40. });
  41.  
  42. });
Advertisement
Add Comment
Please, Sign In to add comment