PluginProbe
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 2.12.8
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v2.12.8
2.12.8 2.12.7 2.12.6 2.12.5 2.12.4 2.12.3 2.12.2 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 All 98 releases
sureforms / inc / lib / astra-notices / notices.js

notices.js in SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz 2.12.8, at inc/lib/astra-notices/notices.js

95 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Customizer controls toggles
3 *
4 * @package Astra
5 */
6
7 ( function( $ ) {
8
9 /**
10 * Helper class for the main Customizer interface.
11 *
12 * @since 1.0.0
13 * @class ASTCustomizer
14 */
15 AstraNotices = {
16
17 /**
18 * Initializes our custom logic for the Customizer.
19 *
20 * @since 1.0.0
21 * @method init
22 */
23 init: function()
24 {
25 this._bind();
26 },
27
28 /**
29 * Binds events for the Astra Portfolio.
30 *
31 * @since 1.0.0
32 * @access private
33 * @method _bind
34 */
35 _bind: function()
36 {
37 $( document ).on('click', '.astra-notice-close', AstraNotices._dismissNoticeNew );
38 $( document ).on('click', '.astra-notice .notice-dismiss', AstraNotices._dismissNotice );
39 },
40
41 _dismissNotice: function( event ) {
42 event.preventDefault();
43
44 var repeat_notice_after = $( this ).parents('.astra-notice').data( 'repeat-notice-after' ) || '';
45 var notice_id = $( this ).parents('.astra-notice').attr( 'id' ) || '';
46
47 AstraNotices._ajax( notice_id, repeat_notice_after );
48 },
49
50 _dismissNoticeNew: function( event ) {
51 event.preventDefault();
52
53 var repeat_notice_after = $( this ).attr( 'data-repeat-notice-after' ) || '';
54 var notice_id = $( this ).parents('.astra-notice').attr( 'id' ) || '';
55
56 var $el = $( this ).parents('.astra-notice');
57 $el.fadeTo( 100, 0, function() {
58 $el.slideUp( 100, function() {
59 $el.remove();
60 });
61 });
62
63 AstraNotices._ajax( notice_id, repeat_notice_after );
64
65 var link = $( this ).attr( 'href' ) || '';
66 var target = $( this ).attr( 'target' ) || '';
67 if( '' !== link && '_blank' === target ) {
68 window.open(link , '_blank');
69 }
70 },
71
72 _ajax: function( notice_id, repeat_notice_after ) {
73
74 if( '' === notice_id ) {
75 return;
76 }
77
78 $.ajax({
79 url: ajaxurl,
80 type: 'POST',
81 data: {
82 action : 'astra-notice-dismiss',
83 nonce : astraNotices._notice_nonce,
84 notice_id : notice_id,
85 repeat_notice_after : parseInt( repeat_notice_after, 10 ),
86 },
87 });
88
89 }
90 };
91
92 $( function() {
93 AstraNotices.init();
94 } );
95 } )( jQuery );