PluginProbe
Autoptimize / trunk
Autoptimize vtrunk
3.1.16 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 All 108 releases
autoptimize / classes / external / php / persist-admin-notices-dismissal / dismiss-notice.js

dismiss-notice.js in Autoptimize trunk, at classes/external/php/persist-admin-notices-dismissal/dismiss-notice.js

34 lines 868 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function ($) {
2 //shorthand for ready event.
3 $(
4 function () {
5 $( 'div[data-dismissible] button.notice-dismiss' ).on('click',
6 function (event) {
7 event.preventDefault();
8 var $this = $( this );
9
10 var attr_value, option_name, dismissible_length, data;
11
12 attr_value = $this.parent().attr( 'data-dismissible' ).split( '-' );
13
14 // remove the dismissible length from the attribute value and rejoin the array.
15 dismissible_length = attr_value.pop();
16
17 option_name = attr_value.join( '-' );
18
19 data = {
20 'action': 'dismiss_admin_notice',
21 'option_name': option_name,
22 'dismissible_length': dismissible_length,
23 'nonce': dismissible_notice.nonce
24 };
25
26 // We can also pass the url value separately from ajaxurl for front end AJAX implementations
27 $.post( ajaxurl, data );
28 }
29 );
30 }
31 )
32
33 }(jQuery));
34