PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / trunk
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses vtrunk
4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 4.2.1 All 138 releases
learnpress / assets / src / js / utils / fn.js

fn.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses trunk, at assets/src/js/utils/fn.js

36 lines 775 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Auto prepend `LP` prefix for jQuery fn plugin name.
3 *
4 * Create : $.fn.LP( 'PLUGIN_NAME', func) <=> $.fn.LP_PLUGIN_NAME
5 * Usage: $(selector).LP('PLUGIN_NAME') <=> $(selector).LP_PLUGIN_NAME()
6 *
7 * @version 3.2.6
8 */
9
10 const $ = window.jQuery;
11 let exp;
12
13 ( function() {
14 if ( $ === undefined ) {
15 return;
16 }
17
18 $.fn.LP = exp = function( widget, fn ) {
19 if ( typeof fn === 'function' ) {
20 $.fn[ 'LP_' + widget ] = fn;
21 } else if ( widget ) {
22 const args = [];
23 if ( arguments.length > 1 ) {
24 for ( let i = 1; i < arguments.length; i++ ) {
25 args.push( arguments[ i ] );
26 }
27 }
28
29 return typeof ( $( this )[ 'LP_' + widget ] ) === 'function' ? $( this )[ 'LP_' + widget ].apply( this, args ) : this;
30 }
31 return this;
32 };
33 }() );
34
35 export default exp;
36