PluginProbe
Lasso Lite – Affiliate Link Manager & Product Displays / 108
Lasso Lite – Affiliate Link Manager & Product Displays v108
158 157 155 156 154 153 152 151 150 149 148 trunk 0.9.9 104 105 106 107 108 109 110 111 112 113 114 115 All 57 releases
simple-urls / admin / assets / js / support.js

support.js in Lasso Lite – Affiliate Link Manager & Product Displays 108, at admin/assets/js/support.js

77 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready(function() {
2 setTimeout(function () {
3 jQuery('#fake-intercom-bubble-chat').css('opacity', 1);
4 }, 2000);
5
6 jQuery(document)
7 .on('click', '#enable-support-wrapper .dismiss', function () {
8 jQuery("#enable-support").modal('hide');
9 lasso_lite_helper.set_local_storage('lasso_lite_should_open_support_modal', 0);
10 })
11 .on('click', '#btn-save-support', save_support )
12 .on('click', '#fake-intercom-bubble-chat', function () {
13 jQuery("#enable-support").modal('show');
14 })
15 .ready(function () {
16 update_support();
17 });
18
19 function save_support() {
20 let btn_save = jQuery('#btn-save-support');
21 let js_error = jQuery('#enable-support-wrapper .js-error');
22 let email = jQuery('#enable-support-wrapper #email').val().trim();
23 let is_subscribe = jQuery('#enable-support-wrapper #subscribe').prop("checked");
24 if ( email !== '' ) {
25 jQuery.ajax({
26 url: lassoLiteOptionsData.ajax_url,
27 type: 'post',
28 data: {
29 action: 'lasso_lite_save_support',
30 email: email,
31 is_subscribe: is_subscribe,
32 },
33 beforeSend: function() {
34 jQuery('#enable-support-wrapper #email').removeClass('invalid-field');
35 js_error.css('display', 'none');
36 lasso_lite_helper.add_loading_button(btn_save);
37 }
38 }).done(function(res) {
39 lasso_lite_helper.add_loading_button(btn_save, 'Enable Support', false);
40 let data = res.data;
41 if ( data.success ) {
42 jQuery("#enable-support").modal('hide');
43
44 // Auto open customization display helper after enabling support
45 if ( 'undefined' !== typeof window.need_more_customization_flag ) {
46 lasso_lite_helper.set_local_storage('lasso_lite_open_need_more_customization', 1);
47 }
48
49 // Go to next step if we are in Welcome page
50 if ( 'surl-onboarding' === lasso_lite_helper.get_page_name() ) {
51 go_to_next_step_action(btn_save);
52 } else {
53 location.reload();
54 }
55 } else {
56 jQuery('#enable-support-wrapper #email').addClass('invalid-field');
57 js_error.text(data.msg);
58 js_error.css('display', 'block');
59 }
60 })
61 }
62 }
63
64 function update_support() {
65 jQuery('input[name="enable_support"]').change(lasso_lite_helper.debounce(function(e) {
66 let enable_support = jQuery('input[name="enable_support"]').prop('checked');
67 jQuery.ajax({
68 url: lassoLiteOptionsData.ajax_url,
69 type: 'post',
70 data: {
71 action: 'lasso_lite_update_support',
72 enable_support: enable_support,
73 }
74 });
75 }, 1000, null, true));
76 }
77 });