PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.1.7.3.1
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.1.7.3.1
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 / js / admin / share / admin-notice.js

admin-notice.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.1.7.3.1, at assets/src/js/admin/share/admin-notice.js

33 lines 883 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 ( function( $ ) {
2 const dismissNotice = function dismissNotice( notice, options ) {
3 const hooks = wp.hooks;
4
5 options = $.extend( { el: null }, options || {} );
6
7 hooks && hooks.doAction( 'before-dismiss-notice', 'LP', notice, options );
8 $.ajax( {
9 url: '',
10 data: $.extend( { 'lp-dismiss-notice': notice }, options.data || {} ),
11 dataType: 'text',
12 success: ( response ) => {
13 response = LP.parseJSON( response );
14
15 if ( response.dismissed === notice ) {
16 $( options.el ).fadeOut();
17 }
18
19 hooks && hooks.doAction( 'dismissed-notice', 'LP', notice, options );
20 },
21 } );
22 };
23
24 $( document ).on( 'click', '.lp-notice [data-dismiss-notice]', function() {
25 const data = $( this ).data();
26 const notice = data.dismissNotice;
27
28 delete data.dismissNotice;
29
30 dismissNotice( notice, { data, el: $( this ).closest( '.lp-notice' ) } );
31 } );
32 }( jQuery ) );
33