PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 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 All 139 releases
learnpress / assets / src / apps / js / utils / lp-modal-overlay.js

lp-modal-overlay.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.8, at assets/src/apps/js/utils/lp-modal-overlay.js

63 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 const $ = jQuery;
2 let elLPOverlay = null;
3 const lpModalOverlay = {
4 elLPOverlay: null,
5 elMainContent: null,
6 elTitle: null,
7 elBtnYes: null,
8 elBtnNo: null,
9 elFooter: null,
10 elCalledModal: null,
11 callBackYes: null,
12 instance: null,
13 init() {
14 if ( this.instance ) {
15 return true;
16 }
17
18 this.elLPOverlay = $( '.lp-overlay' );
19
20 if ( ! this.elLPOverlay.length ) {
21 return false;
22 }
23 elLPOverlay = this.elLPOverlay;
24
25 this.elMainContent = elLPOverlay.find( '.main-content' );
26 this.elTitle = elLPOverlay.find( '.modal-title' );
27 this.elBtnYes = elLPOverlay.find( '.btn-yes' );
28 this.elBtnNo = elLPOverlay.find( '.btn-no' );
29 this.elFooter = elLPOverlay.find( '.lp-modal-footer' );
30
31 $( document ).on( 'click', '.close, .btn-no', function() {
32 elLPOverlay.hide();
33 } );
34
35 $( document ).on( 'click', '.btn-yes', function( e ) {
36 e.preventDefault();
37 e.stopPropagation();
38
39 if ( 'function' === typeof lpModalOverlay.callBackYes ) {
40 lpModalOverlay.callBackYes( e );
41 }
42 } );
43
44 this.instance = this;
45
46 return true;
47 },
48 setElCalledModal( elCalledModal ) {
49 this.elCalledModal = elCalledModal;
50 },
51 setContentModal( content, event ) {
52 this.elMainContent.html( content );
53 if ( 'function' === typeof event ) {
54 event();
55 }
56 },
57 setTitleModal( content ) {
58 this.elTitle.html( content );
59 },
60 };
61
62 export default lpModalOverlay;
63