PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 4.9.0
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v4.9.0
4.9.0 0.9.6 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.2 1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 2.0.0 2.0.1 2.1.1 2.2.1 2.3.1 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 2.8.0 2.9.0 3.0.1 3.0.2 3.0.3 3.1.0 3.10.0 3.11.0 3.11.1 3.2.0 3.2.1 3.3.0 3.4.0 3.5.0 3.5.1 3.5.2 3.6.1 3.7.0 3.8.0 3.8.2 3.9.0 4.0.1 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.8.0 trunk 0.10.0 0.10.1 0.11.1 0.11.2 0.3.1 0.3.2 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.5.2 0.6 0.7 0.8 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5
wp-mail-smtp / assets / js / smtp-notifications.js
wp-mail-smtp / assets / js Last commit date
vendor 5 days ago connect.js 5 days ago connect.min.js 5 days ago smtp-about.js 5 days ago smtp-about.min.js 5 days ago smtp-activelayer-wc.js 5 days ago smtp-activelayer-wc.min.js 5 days ago smtp-admin-notices.js 5 days ago smtp-admin-notices.min.js 5 days ago smtp-admin.js 5 days ago smtp-admin.min.js 5 days ago smtp-ai-mcp.js 5 days ago smtp-ai-mcp.min.js 5 days ago smtp-code-snippets.js 5 days ago smtp-code-snippets.min.js 5 days ago smtp-dashboard-widget.js 5 days ago smtp-dashboard-widget.min.js 5 days ago smtp-notifications.js 5 days ago smtp-notifications.min.js 5 days ago smtp-recommendations.js 5 days ago smtp-recommendations.min.js 5 days ago smtp-tools-debug-events.js 5 days ago smtp-tools-debug-events.min.js 5 days ago
smtp-notifications.js
186 lines
1 /* global wp_mail_smtp, ajaxurl */
2
3 /**
4 * WP Mail SMTP Admin Notifications.
5 *
6 * @since 2.3.0
7 */
8
9 'use strict';
10
11 var WPMailSMTPAdminNotifications = window.WPMailSMTPAdminNotifications || ( function( document, window, $ ) {
12
13 /**
14 * Elements holder.
15 *
16 * @since 2.3.0
17 *
18 * @type {object}
19 */
20 var el = {
21 $notifications: $( '#wp-mail-smtp-notifications' ),
22 $nextButton: $( '#wp-mail-smtp-notifications .navigation .next' ),
23 $prevButton: $( '#wp-mail-smtp-notifications .navigation .prev' ),
24 $adminBarCounter: $( '#wp-admin-bar-wp-mail-smtp-menu .wp-mail-smtp-admin-bar-menu-notification-counter' ),
25 };
26
27 /**
28 * Public functions and properties.
29 *
30 * @since 2.3.0
31 *
32 * @type {object}
33 */
34 var app = {
35
36 /**
37 * Start the engine.
38 *
39 * @since 2.3.0
40 */
41 init: function() {
42
43 $( app.ready );
44 },
45
46 /**
47 * Document ready.
48 *
49 * @since 2.3.0
50 */
51 ready: function() {
52
53 app.updateNavigation();
54 app.events();
55 },
56
57 /**
58 * Register JS events.
59 *
60 * @since 2.3.0
61 */
62 events: function() {
63
64 el.$notifications
65 .on( 'click', '.dismiss', app.dismiss )
66 .on( 'click', '.next', app.navNext )
67 .on( 'click', '.prev', app.navPrev );
68 },
69
70 /**
71 * Click on the Dismiss notification button.
72 *
73 * @since 2.3.0
74 *
75 * @param {object} event Event object.
76 */
77 dismiss: function( event ) {
78
79 if ( el.$currentMessage.length === 0 ) {
80 return;
81 }
82
83 // AJAX call - update option.
84 var data = {
85 action: 'wp_mail_smtp_notification_dismiss',
86 nonce: wp_mail_smtp.nonce,
87 id: el.$currentMessage.data( 'message-id' ),
88 };
89
90 $.post( ajaxurl, data, function( response ) {
91 if ( ! response.success ) {
92 return;
93 }
94
95 // Update counter.
96 var count = parseInt( el.$adminBarCounter.text(), 10 );
97 if ( count > 1 ) {
98 --count;
99 el.$adminBarCounter.html( '<span>' + count + '</span>' );
100 } else {
101 el.$adminBarCounter.remove();
102 }
103
104 // Remove notification.
105 var $nextMessage = el.$nextMessage.length < 1 ? el.$prevMessage : el.$nextMessage;
106
107 if ( $nextMessage.length === 0 ) {
108 el.$notifications.remove();
109 } else {
110 el.$currentMessage.remove();
111 $nextMessage.addClass( 'current' );
112 app.updateNavigation();
113 }
114 } );
115 },
116
117 /**
118 * Click on the Next notification button.
119 *
120 * @since 2.3.0
121 *
122 * @param {object} event Event object.
123 */
124 navNext: function( event ) {
125
126 if ( el.$nextButton.hasClass( 'disabled' ) ) {
127 return;
128 }
129
130 el.$currentMessage.removeClass( 'current' );
131 el.$nextMessage.addClass( 'current' );
132
133 app.updateNavigation();
134 },
135
136 /**
137 * Click on the Previous notification button.
138 *
139 * @since 2.3.0
140 *
141 * @param {object} event Event object.
142 */
143 navPrev: function( event ) {
144
145 if ( el.$prevButton.hasClass( 'disabled' ) ) {
146 return;
147 }
148
149 el.$currentMessage.removeClass( 'current' );
150 el.$prevMessage.addClass( 'current' );
151
152 app.updateNavigation();
153 },
154
155 /**
156 * Update navigation buttons.
157 *
158 * @since 2.3.0
159 */
160 updateNavigation: function() {
161
162 el.$currentMessage = el.$notifications.find( '.wp-mail-smtp-notifications-message.current' );
163 el.$nextMessage = el.$currentMessage.next( '.wp-mail-smtp-notifications-message' );
164 el.$prevMessage = el.$currentMessage.prev( '.wp-mail-smtp-notifications-message' );
165
166 if ( el.$nextMessage.length === 0 ) {
167 el.$nextButton.addClass( 'disabled' );
168 } else {
169 el.$nextButton.removeClass( 'disabled' );
170 }
171
172 if ( el.$prevMessage.length === 0 ) {
173 el.$prevButton.addClass( 'disabled' );
174 } else {
175 el.$prevButton.removeClass( 'disabled' );
176 }
177 },
178 };
179
180 return app;
181
182 }( document, window, jQuery ) );
183
184 // Initialize.
185 WPMailSMTPAdminNotifications.init();
186