flexible-shipping
/
vendor_prefixed
/
wpdesk
/
wp-wpdesk-tracker
/
src
/
assets
/
js
Last commit date
admin.js
2 weeks ago
admin_notices.js
2 weeks ago
admin_plugins.js
2 weeks ago
admin.js
67 lines
| 1 | jQuery(function() { |
| 2 | |
| 3 | jQuery('input[type=radio]').click(function () { |
| 4 | var reason = jQuery('input[name=selected-reason]:checked').val(); |
| 5 | console.log(reason); |
| 6 | jQuery('.reason-input').hide(); |
| 7 | if (reason == 'found_better_plugin') { |
| 8 | jQuery('#found_better_plugin').show(); |
| 9 | } |
| 10 | if (reason == 'other') { |
| 11 | jQuery('#other').show(); |
| 12 | } |
| 13 | jQuery('.wpdesk_tracker_deactivate .button-deactivate').html(wpdesk_tracker_localize.submit_txt); |
| 14 | }); |
| 15 | |
| 16 | jQuery('.button-deactivate').click(function (e) { |
| 17 | e.preventDefault(); |
| 18 | console.log('deactivate'); |
| 19 | var reason = jQuery('input[name=selected-reason]:checked').val(); |
| 20 | var additional_info = ''; |
| 21 | if (reason == 'found_better_plugin') { |
| 22 | additional_info = jQuery('#found_better_plugin input').val(); |
| 23 | } |
| 24 | if (reason == 'other') { |
| 25 | additional_info = jQuery('#other input').val(); |
| 26 | } |
| 27 | console.log(reason); |
| 28 | if (typeof reason != 'undefined') { |
| 29 | console.log('not undefined'); |
| 30 | jQuery('.button').attr('disabled', true); |
| 31 | jQuery.ajax(wpdesk_tracker_localize.ajax_url, |
| 32 | { |
| 33 | type: 'POST', |
| 34 | data: { |
| 35 | action: wpdesk_tracker_localize.action, |
| 36 | security: wpdesk_tracker_localize.nonce, |
| 37 | reason: reason, |
| 38 | plugin: wpdesk_tracker_localize.plugin, |
| 39 | plugin_name: wpdesk_tracker_localize.plugin_name, |
| 40 | additional_info: additional_info, |
| 41 | } |
| 42 | } |
| 43 | ).always(function () { |
| 44 | window.location.href = wpdesk_tracker_localize.tracker_page; |
| 45 | }); |
| 46 | } |
| 47 | else { |
| 48 | window.location.href = wpdesk_tracker_localize.tracker_page; |
| 49 | } |
| 50 | }); |
| 51 | |
| 52 | jQuery('.button-close').click(function (e) { |
| 53 | e.preventDefault(); |
| 54 | window.history.back(); |
| 55 | }); |
| 56 | |
| 57 | jQuery('.trigger').click(function(e) { |
| 58 | e.preventDefault(); |
| 59 | if (jQuery(this).parent().hasClass('open')) { |
| 60 | jQuery(this).parent().removeClass('open') |
| 61 | } |
| 62 | else { |
| 63 | jQuery(this).parent().addClass('open'); |
| 64 | } |
| 65 | }); |
| 66 | |
| 67 | }); |