lib
1 year ago
admin-fields.js
1 year ago
admin-form.js
1 year ago
admin-global.js
1 year ago
admin-order.js
1 year ago
custom-spinner.js
1 year ago
help.js
1 year ago
rating-edit.js
1 year ago
selectize.js
1 year ago
st-uninstall.js
1 year ago
strong-testimonials-elementor-editor.js
1 year ago
view-category-filter.js
1 year ago
views.js
1 month ago
st-uninstall.js
72 lines
| 1 | jQuery(document).ready(function ($) { |
| 2 | var uninstall = $("a.uninstall-st"), |
| 3 | formContainer = $('#st-uninstall-form'); |
| 4 | |
| 5 | formContainer.on('click', '#st-delete_all', function () { |
| 6 | if ( $('#st-delete_all').is(':checked') ) { |
| 7 | $('#st-delete_options').prop('checked', true); |
| 8 | $('#st-delete_transients').prop('checked', true); |
| 9 | $('#st-delete_cpt').prop('checked', true); |
| 10 | $('#st-delete_st_tables').prop('checked', true); |
| 11 | $('#st-delete_terms').prop('checked', true); |
| 12 | } else { |
| 13 | $('#st-delete_options').prop('checked', false); |
| 14 | $('#st-delete_transients').prop('checked', false); |
| 15 | $('#st-delete_cpt').prop('checked', false); |
| 16 | $('#st-delete_st_tables').prop('checked', false); |
| 17 | $('#st-delete_terms').prop('checked', false); |
| 18 | } |
| 19 | }); |
| 20 | |
| 21 | $(uninstall).on("click", function () { |
| 22 | |
| 23 | $('body').toggleClass('st-uninstall-form-active'); |
| 24 | formContainer.fadeIn(); |
| 25 | |
| 26 | formContainer.on('click', '#st-uninstall-submit-form', function (e) { |
| 27 | formContainer.addClass('toggle-spinner'); |
| 28 | var selectedOptions = { |
| 29 | delete_options: ($('#st-delete_options').is(':checked')) ? 1 : 0, |
| 30 | delete_transients: ($('#st-delete_transients').is(':checked')) ? 1 : 0, |
| 31 | delete_cpt: ($('#st-delete_cpt').is(':checked')) ? 1 : 0, |
| 32 | delete_st_tables: ($('#st-delete_st_tables').is(':checked')) ? 1 : 0, |
| 33 | delete_terms : ($('#st-delete_terms').is(':checked')) ? 1 : 0, |
| 34 | }; |
| 35 | |
| 36 | var data = { |
| 37 | 'action': 'st_uninstall_plugin', |
| 38 | 'security': wpStUninstall.nonce, |
| 39 | 'dataType': "json", |
| 40 | 'options': selectedOptions |
| 41 | }; |
| 42 | |
| 43 | $.post( |
| 44 | ajaxurl, |
| 45 | data, |
| 46 | function (response) { |
| 47 | // Redirect to plugins page |
| 48 | window.location.href = wpStUninstall.redirect_url; |
| 49 | } |
| 50 | ); |
| 51 | }); |
| 52 | |
| 53 | // If we click outside the form, the form will close |
| 54 | // Stop propagation from form |
| 55 | formContainer.on('click', function (e) { |
| 56 | e.stopPropagation(); |
| 57 | }); |
| 58 | |
| 59 | $('.st-uninstall-form-wrapper, .close-uninstall-form').on('click', function (e) { |
| 60 | e.stopPropagation(); |
| 61 | formContainer.fadeOut(); |
| 62 | $('body').removeClass('st-uninstall-form-active'); |
| 63 | }); |
| 64 | |
| 65 | $(document).on("keyup", function (e) { |
| 66 | if ( e.key === "Escape" ) { |
| 67 | formContainer.fadeOut(); |
| 68 | $('body').removeClass('st-uninstall-form-active'); |
| 69 | } |
| 70 | }); |
| 71 | }); |
| 72 | }); |