PluginProbe ʕ •ᴥ•ʔ
Backup Migration / 1.4.9
Backup Migration v1.4.9
2.1.6 2.1.5.2 trunk 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.6.1 1.4.7 1.4.8 1.4.9 1.4.9.1 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.5.1
backup-backup / modules / new-bb-banner / assets / js / script.js
backup-backup / modules / new-bb-banner / assets / js Last commit date
script.js 1 year ago
script.js
75 lines
1 // Always close the code, cause you can make conflicts (same for css use prefixes)
2 (function ($) {
3
4
5 let nonce = new_bb_banner.dismiss_nonce;
6 let is_backup_pro_exists = new_bb_banner.is_backup_pro_exists;
7 let current_plugin = new_bb_banner.current_plugin;
8 let is_bmi_exists = new_bb_banner.is_bmi_exists;
9
10 console.log('is_backup_pro_exists', is_backup_pro_exists);
11 if (is_backup_pro_exists) {
12 $('#bmi-banner__card-premium-external-storage').show();
13 $('#bmi-banner__card-free-external-storage').hide();
14
15 $('#bmi-banner__card-premium-storage').show();
16 $('#bmi-banner__card-free-storage').hide();
17
18 $('#bmi-banner__card-4gb-upgraded').hide();
19
20 } else {
21 $('#bmi-banner__card-premium-external-storage').hide();
22 $('#bmi-banner__card-free-external-storage').show();
23
24 $('#bmi-banner__card-premium-storage').hide();
25 $('#bmi-banner__card-free-storage').show();
26
27 $('#bmi-banner__card-4gb-upgraded').show();
28 }
29
30 function banner_hide() {
31 $('#new-bb-banner').hide(300);
32 }
33
34 $('.bmi-banner__cta-button.redirect-to-bmi').on('click', function () {
35
36 let currentUrl = window.location.href;
37 let shouldRedirectToBMI = false;
38
39 if (!currentUrl.includes('page=backup-migration')) {
40 shouldRedirectToBMI = true;
41 }
42
43 $.post(ajaxurl, {
44 action: 'dismiss_new_bb_banner',
45 nonce: nonce,
46 token: 'new_bb_banner',
47 shouldRedirectToBMI: shouldRedirectToBMI
48 }).done(function (res) {
49 if (shouldRedirectToBMI && res.data.redirect) {
50 window.location.href = res.data.redirect;
51 }
52 }).fail(function (err) {
53 console.error(err);
54 });
55
56 banner_hide();
57
58 });
59
60 $('.bmi-banner__dismiss-link, .bmi-banner__close').on('click', function (e) {
61 e.preventDefault();
62 $.post(ajaxurl, {
63 action: 'dismiss_new_bb_banner',
64 nonce: nonce,
65 token: 'new_bb_banner'
66 }).done(function (res) {
67 }).fail(function (err) {
68 console.error(err);
69 });
70
71 banner_hide();
72 });
73
74 })(jQuery);
75