PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.2.0
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.2.0
2.4.0 2.4.1 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.2.0 2.1.21 2.1.20 2.1.19 2.1.18 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.2 All 57 releases
easy-invoice / assets / js / promotion.js

promotion.js in Easy Invoice – Invoice Generator, PDF Quotes & Payments 2.2.0, at assets/js/promotion.js

60 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Easy Invoice Promotion Banner JavaScript
3 */
4 jQuery(document).ready(function($) {
5
6 // Handle promotion banner dismissal
7 $('#easy-invoice-promotion-dismiss').on('click', function(e) {
8 e.preventDefault();
9
10 $.ajax({
11 url: easyInvoicePromotion.ajaxUrl,
12 type: 'POST',
13 data: {
14 action: 'easy_invoice_dismiss_promotion',
15 nonce: easyInvoicePromotion.nonce
16 },
17 success: function(response) {
18 if (response.success) {
19 // Hide the notice with a smooth fade out
20 $('#easy-invoice-promotion-notice').fadeOut(300, function() {
21 $(this).remove();
22 });
23 }
24 },
25 error: function() {
26 // If AJAX fails, still hide the notice
27 $('#easy-invoice-promotion-notice').fadeOut(300, function() {
28 $(this).remove();
29 });
30 }
31 });
32 });
33
34 // Override the default WordPress notice dismiss handler for our promotion notice
35 $(document).on('click', '#easy-invoice-promotion-notice .notice-dismiss', function(e) {
36 e.preventDefault();
37
38 $.ajax({
39 url: easyInvoicePromotion.ajaxUrl,
40 type: 'POST',
41 data: {
42 action: 'easy_invoice_dismiss_promotion',
43 nonce: easyInvoicePromotion.nonce
44 },
45 success: function(response) {
46 if (response.success) {
47 $('#easy-invoice-promotion-notice').fadeOut(300, function() {
48 $(this).remove();
49 });
50 }
51 },
52 error: function() {
53 $('#easy-invoice-promotion-notice').fadeOut(300, function() {
54 $(this).remove();
55 });
56 }
57 });
58 });
59 });
60