chart.js
6 days ago
check-mail-jsPdf.js
6 days ago
check_mail_push.js
6 days ago
check_mail_wizard.js
6 days ago
check_mail_wizard.min.js
6 days ago
checkemail.js
6 days ago
checkemail.min.js
6 days ago
checkmail-dashboard-chart.js
6 days ago
checkmail-dashboard-chart.min.js
6 days ago
checkmail-sw.js
6 days ago
ck_mail-newsletter-script.js
6 days ago
ck_mail-newsletter-script.min.js
6 days ago
export-logs.js
6 days ago
export-logs.min.js
6 days ago
feedback.js
6 days ago
feedback.min.js
6 days ago
firebase-app.js
6 days ago
firebase-messaging.js
6 days ago
support-settings.js
6 days ago
support-settings.min.js
6 days ago
view-logs.js
6 days ago
view-logs.min.js
6 days ago
feedback.js
92 lines
| 1 | var strict; |
| 2 | |
| 3 | jQuery(document).ready(function ($) { |
| 4 | /** |
| 5 | * DEACTIVATION FEEDBACK FORM |
| 6 | */ |
| 7 | ck_mail_deactivate_link = $('.wp-admin.plugins-php tr[data-slug="check-email"] .row-actions .deactivate a'); |
| 8 | // show overlay when clicked on "deactivate" |
| 9 | ck_mail_deactivate_link_url = ck_mail_deactivate_link.attr('href'); |
| 10 | |
| 11 | ck_mail_deactivate_link.click(function (e) { |
| 12 | e.preventDefault(); |
| 13 | // only show feedback form once per 30 days |
| 14 | var c_value = ck_mail_admin_get_cookie("ck_mail_hide_deactivate_feedback"); |
| 15 | |
| 16 | if (c_value === undefined) { |
| 17 | $('#ck-mail-reloaded-feedback-overlay').show(); |
| 18 | } else { |
| 19 | // click on the link |
| 20 | window.location.href = ck_mail_deactivate_link_url; |
| 21 | } |
| 22 | }); |
| 23 | // show text fields |
| 24 | $('#ck-mail-reloaded-feedback-content input[type="radio"]').click(function () { |
| 25 | // show text field if there is one |
| 26 | var elementText = $(this).parents('li').next('li').children('input[type="text"], textarea'); |
| 27 | $(this).parents('ul').find('input[type="text"], textarea').not(elementText).hide().val('').attr('required', false); |
| 28 | elementText.attr('required', 'required').show(); |
| 29 | }); |
| 30 | // send form or close it |
| 31 | $('#ck-mail-reloaded-feedback-content form').submit(function (e) { |
| 32 | e.preventDefault(); |
| 33 | |
| 34 | ck_mail_set_feedback_cookie(); |
| 35 | |
| 36 | // Send form data |
| 37 | $.post(ajaxurl, { |
| 38 | action: 'ck_mail_send_feedback', |
| 39 | data: $('#ck-mail-reloaded-feedback-content form').serialize() + "&ck_mail_security_nonce=" + cn_ck_mail_admin_data.ck_mail_security_nonce |
| 40 | }, |
| 41 | function (data) { |
| 42 | |
| 43 | if (data == 'sent') { |
| 44 | // deactivate the plugin and close the popup |
| 45 | $('#ck-mail-reloaded-feedback-overlay').remove(); |
| 46 | window.location.href = ck_mail_deactivate_link_url; |
| 47 | } else { |
| 48 | console.log('Error: ' + data); |
| 49 | alert(data); |
| 50 | } |
| 51 | } |
| 52 | ); |
| 53 | }); |
| 54 | |
| 55 | $("#ck-mail-reloaded-feedback-content .ck-mail-feedback-only-deactivate").click(function (e) { |
| 56 | e.preventDefault(); |
| 57 | |
| 58 | ck_mail_set_feedback_cookie(); |
| 59 | |
| 60 | $('#ck-mail-reloaded-feedback-overlay').remove(); |
| 61 | window.location.href = ck_mail_deactivate_link_url; |
| 62 | }); |
| 63 | |
| 64 | // close form without doing anything |
| 65 | $('.ck-mail-feedback-not-deactivate').click(function (e) { |
| 66 | $('#ck-mail-reloaded-feedback-content form')[0].reset(); |
| 67 | var elementText = $('#ck-mail-reloaded-feedback-content input[type="radio"]').parents('li').next('li').children('input[type="text"], textarea'); |
| 68 | $(elementText).parents('ul').find('input[type="text"], textarea').hide().val('').attr('required', false); |
| 69 | $('#ck-mail-reloaded-feedback-overlay').hide(); |
| 70 | }); |
| 71 | |
| 72 | function ck_mail_admin_get_cookie(name) { |
| 73 | var i, x, y, ck_mail_cookies = document.cookie.split(";"); |
| 74 | for (i = 0; i < ck_mail_cookies.length; i++) |
| 75 | { |
| 76 | x = ck_mail_cookies[i].substr(0, ck_mail_cookies[i].indexOf("=")); |
| 77 | y = ck_mail_cookies[i].substr(ck_mail_cookies[i].indexOf("=") + 1); |
| 78 | x = x.replace(/^\s+|\s+$/g, ""); |
| 79 | if (x === name) |
| 80 | { |
| 81 | return unescape(y); |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | function ck_mail_set_feedback_cookie() { |
| 87 | // set cookie for 30 days |
| 88 | var exdate = new Date(); |
| 89 | exdate.setSeconds(exdate.getSeconds() + 2592000); |
| 90 | document.cookie = "ck_mail_hide_deactivate_feedback=1; expires=" + exdate.toUTCString() + "; path=/"; |
| 91 | } |
| 92 | }); |