| @@ -744,15 +744,15 @@ | ||
| 744 | 744 | skip_notice: true |
| 745 | 745 | }; |
| 746 | 746 | block_ui(wposmush.converting_to_webp, {}, 0, true); |
| 747 | 747 | smush_manager_send_command('convert_to_webp_format', data, function(response) { |
| 748 | - if (response.error) { | |
| 749 | - block_ui(response.error, {}, 2000); | |
| 750 | - } else { | |
| 748 | + if (response.success) { | |
| 751 | 749 | block_ui(response.success, {}, 2000); |
| 752 | 750 | $link.next().remove(); |
| 753 | 751 | if ($link.prev().is('.wpo-action-separator')) $link.prev().remove(); |
| 754 | 752 | $link.remove(); |
| 753 | + } else { | |
| 754 | + block_ui(response.error || response.error_message || wposmush.server_error , {}, 2000); | |
| 755 | 755 | } |
| 756 | 756 | }); |
| 757 | 757 | }); |
| 758 | 758 | |
| @@ -1245,9 +1245,9 @@ | ||
| 1245 | 1245 | // if no selected images then exit. |
| 1246 | 1246 | if (0 == selected_image.length) return; |
| 1247 | 1247 | |
| 1248 | 1248 | block_ui(wposmush.please_wait); |
| 1249 | - var data = { 'blog_id': blog_id, 'selected_image': selected_image }; | |
| 1249 | + var data = { 'blog_id': blog_id, 'selected_image': selected_image, skip_notice: true }; | |
| 1250 | 1250 | |
| 1251 | 1251 | smush_manager_send_command.apply({unique: false}, ['restore_single_image', data, function(resp) { |
| 1252 | 1252 | var done = function(resp_summary_alt) { |
| 1253 | 1253 | if ('undefined' != typeof(resp_summary_alt)) { |
| @@ -1443,14 +1443,16 @@ | ||
| 1443 | 1443 | * @param {string} action The action to send |
| 1444 | 1444 | * @param {[type]} data Data to send |
| 1445 | 1445 | * @param {Function} callback Will be called with the results |
| 1446 | 1446 | * @param {boolean} json_parse JSON parse the results |
| 1447 | + * @param {boolean} wait Wait for the response | |
| 1447 | 1448 | * |
| 1448 | 1449 | * @return {JSON} |
| 1449 | 1450 | */ |
| 1450 | - function smush_manager_send_command(action, data, callback, json_parse) { | |
| 1451 | + function smush_manager_send_command(action, data, callback, json_parse, wait) { | |
| 1451 | 1452 | |
| 1452 | 1453 | json_parse = ('undefined' === typeof json_parse) ? true : json_parse; |
| 1454 | + var _wait = ('undefined' === typeof wait) ? false : wait; | |
| 1453 | 1455 | |
| 1454 | 1456 | var skip_notice = data.hasOwnProperty('skip_notice'); |
| 1455 | 1457 | var data_has_only_skip_notice = skip_notice && 1 === Object.keys(data).length; |
| 1456 | 1458 | var is_data_empty = $.isEmptyObject(data); |
| @@ -1459,9 +1461,9 @@ | ||
| 1459 | 1461 | if (data_has_only_skip_notice) data.use_cache = false; |
| 1460 | 1462 | |
| 1461 | 1463 | (function(single_callback, _keep, _unique) { |
| 1462 | 1464 | heartbeat_agents.push(heartbeat.add_agent({ |
| 1463 | - _wait: false, | |
| 1465 | + _wait: _wait, | |
| 1464 | 1466 | _keep: _keep, |
| 1465 | 1467 | _unique: _unique, |
| 1466 | 1468 | command: 'updraft_smush_ajax', |
| 1467 | 1469 | command_data: {data: data, subaction: action}, |