| 1 |
( function( factory ) { |
| 2 |
"use strict"; |
| 3 |
|
| 4 |
if ( typeof define === "function" && define.amd ) { |
| 5 |
|
| 6 |
|
| 7 |
define( [ "jquery", "./version" ], factory ); |
| 8 |
} else { |
| 9 |
|
| 10 |
|
| 11 |
factory( jQuery ); |
| 12 |
} |
| 13 |
} )( function( $ ) { |
| 14 |
"use strict"; |
| 15 |
|
| 16 |
|
| 17 |
return $.ui.plugin = { |
| 18 |
add: function( module, option, set ) { |
| 19 |
var i, |
| 20 |
proto = $.ui[ module ].prototype; |
| 21 |
for ( i in set ) { |
| 22 |
proto.plugins[ i ] = proto.plugins[ i ] || []; |
| 23 |
proto.plugins[ i ].push( [ option, set[ i ] ] ); |
| 24 |
} |
| 25 |
}, |
| 26 |
call: function( instance, name, args, allowDisconnected ) { |
| 27 |
var i, |
| 28 |
set = instance.plugins[ name ]; |
| 29 |
|
| 30 |
if ( !set ) { |
| 31 |
return; |
| 32 |
} |
| 33 |
|
| 34 |
if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || |
| 35 |
instance.element[ 0 ].parentNode.nodeType === 11 ) ) { |
| 36 |
return; |
| 37 |
} |
| 38 |
|
| 39 |
for ( i = 0; i < set.length; i++ ) { |
| 40 |
if ( instance.options[ set[ i ][ 0 ] ] ) { |
| 41 |
set[ i ][ 1 ].apply( instance.element, args ); |
| 42 |
} |
| 43 |
} |
| 44 |
} |
| 45 |
}; |
| 46 |
|
| 47 |
} ); |