wp-optimize
/
vendor
/
team-updraft
/
common-libs
/
src
/
updraft-plugin-deinstall-dialog
/
assets
/
js
/
deinstall-dialog-jqueryui.js
deinstall-dialog-jqueryui.js in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance trunk, at vendor/team-updraft/common-libs/src/updraft-plugin-deinstall-dialog/assets/js/deinstall-dialog-jqueryui.js
| 1 | jQuery(function($) { |
| 2 | window.updraft_deinstall_jqueryui_v1 = window.updraft_deinstall_jqueryui_v1 || function(e, plugin) { |
| 3 | e.preventDefault(); |
| 4 | |
| 5 | var data = window['updraft_deinstall_data_' + plugin]; |
| 6 | |
| 7 | if ($('#'+plugin+'-deinstall-dialog').length) { |
| 8 | $('#'+plugin+'-deinstall-dialog').dialog("open"); |
| 9 | } else { |
| 10 | // Instantiate a new dialog object with the specified title and buttons |
| 11 | var dialog_params = { |
| 12 | title: data.dialog_title, |
| 13 | modal: true, |
| 14 | draggable: false, |
| 15 | buttons: [ |
| 16 | { |
| 17 | text: data.deactivate_label, |
| 18 | id: plugin+'-deinstall-dialog-deactivate-button', |
| 19 | click: function() { |
| 20 | var $form = $('#' + plugin + '-deactivate-form'); |
| 21 | var form_data = $form.serializeArray(); |
| 22 | form_data.push( |
| 23 | { |
| 24 | name: '_nonce', |
| 25 | value: data.nonce |
| 26 | }, |
| 27 | { |
| 28 | name: 'action', |
| 29 | value: plugin + '_deinstall_confirm' |
| 30 | } |
| 31 | ); |
| 32 | |
| 33 | $.post(ajaxurl, form_data).always(function() { |
| 34 | window.location.href = e.target.href; |
| 35 | }); |
| 36 | |
| 37 | $(this).dialog('close'); |
| 38 | } |
| 39 | }, |
| 40 | { |
| 41 | text: data.cancel_label, |
| 42 | id: plugin+'-deinstall-dialog-cancel-button', |
| 43 | click: function() { |
| 44 | $(this).dialog('close'); |
| 45 | } |
| 46 | } |
| 47 | ] |
| 48 | }; |
| 49 | |
| 50 | if (data.custom_css) { |
| 51 | dialog_params['classes'] = {}; |
| 52 | dialog_params.classes["ui-dialog"] = plugin + "-ui-deinstall-dialog";// in jQuery UI versions prior to 1.14, the "ui-dialog" class or the "classes" property is unavailable |
| 53 | dialog_params.dialogClass = plugin + "-ui-deinstall-dialog";// deprecated in jQuery UI version 1.12 and removed in version 1.14 |
| 54 | } |
| 55 | |
| 56 | $('<div id="'+plugin+'-deinstall-dialog" />').html(data.dialog_html).dialog(dialog_params); |
| 57 | } |
| 58 | }; |
| 59 | }); |
| 60 |