Chart.min.js
5 months ago
bulk-conversion.js
5 months ago
bulk-optimization.js
5 months ago
calculate-attachments.js
1 year ago
index.php
3 years ago
meta-migrations.js
3 years ago
modals.js
6 months ago
notices.js
2 months ago
restore-backup.js
6 months ago
settings-premium.js
6 months ago
single-optimization.js
6 months ago
statistic.js
6 months ago
sweetalert2.js
3 years ago
wrio-license-manager.js
6 months ago
single-optimization.js
103 lines
| 1 | jQuery(function($) { |
| 2 | var ajaxUrl = ajaxurl; |
| 3 | |
| 4 | $(document).on('click', '.wio-reoptimize', function() { |
| 5 | var ai_data = { |
| 6 | 'action' : $(this).attr('data-action'), |
| 7 | 'id' : $(this).attr('data-id'), |
| 8 | 'level' : $(this).attr('data-level'), |
| 9 | '_wpnonce' : $(this).attr('data-nonce') |
| 10 | }; |
| 11 | var td = $(this).closest('td'); |
| 12 | var msg = $(this).attr( 'data-waiting-label' ); |
| 13 | td.html('<p>'+msg+'</p>'); |
| 14 | wio_reoptimize( ai_data, td ); |
| 15 | return false; |
| 16 | }); |
| 17 | |
| 18 | $(document).on('click', '.wio-convert', function() { |
| 19 | var ai_data = { |
| 20 | 'action' : $(this).attr('data-action'), |
| 21 | 'id' : $(this).attr('data-id'), |
| 22 | 'format' : $(this).attr('data-format'), |
| 23 | '_wpnonce' : $(this).attr('data-nonce') |
| 24 | }; |
| 25 | var td = $(this).closest('td'); |
| 26 | var msg = $(this).attr( 'data-waiting-label' ); |
| 27 | td.html('<p>'+msg+'</p>'); |
| 28 | wio_convert( ai_data, td ); |
| 29 | return false; |
| 30 | }); |
| 31 | |
| 32 | function wio_reoptimize( ai_data, td ) { |
| 33 | $.post(ajaxUrl, ai_data, function(response) { |
| 34 | if ( response === 'processing' ) { |
| 35 | wio_reoptimize( ai_data, td ); |
| 36 | return false; |
| 37 | } |
| 38 | td.html(response); |
| 39 | var btn = $('.wio-reoptimize').first(); |
| 40 | |
| 41 | if ( btn.closest('.media-frame-content').length ) { |
| 42 | if ( btn.closest('table').find('.wio-datas-list').length ) { |
| 43 | var diminsionName = $('.dimensions').find('strong').clone(); |
| 44 | var fileSizeName = $('.file-size').find('strong').clone(); |
| 45 | var diminsionSize = btn.closest('table').find('.wio-datas-list').data('dimensions'); |
| 46 | var fileSize = btn.closest('table').find('.wio-datas-list').data('size'); |
| 47 | $('.dimensions').html(diminsionName.get(0).outerHTML + ' ' + diminsionSize); |
| 48 | $('.file-size').html(fileSizeName.get(0).outerHTML + ' ' + fileSize); |
| 49 | } |
| 50 | } |
| 51 | }); |
| 52 | } |
| 53 | |
| 54 | function wio_convert( ai_data, td ) { |
| 55 | $.post(ajaxUrl, ai_data, function(response) { |
| 56 | if ( response === 'processing' ) { |
| 57 | wio_convert( ai_data, td ); |
| 58 | return false; |
| 59 | } |
| 60 | td.html(response); |
| 61 | var btn = $('.wio-convert').first(); |
| 62 | |
| 63 | if ( btn.closest('.media-frame-content').length ) { |
| 64 | if ( btn.closest('table').find('.wio-datas-list').length ) { |
| 65 | var diminsionName = $('.dimensions').find('strong').clone(); |
| 66 | var fileSizeName = $('.file-size').find('strong').clone(); |
| 67 | var diminsionSize = btn.closest('table').find('.wio-datas-list').data('dimensions'); |
| 68 | var fileSize = btn.closest('table').find('.wio-datas-list').data('size'); |
| 69 | $('.dimensions').html(diminsionName.get(0).outerHTML + ' ' + diminsionSize); |
| 70 | $('.file-size').html(fileSizeName.get(0).outerHTML + ' ' + fileSize); |
| 71 | } |
| 72 | } |
| 73 | }); |
| 74 | } |
| 75 | |
| 76 | $(document).on('click', '.button-wio-restore', function() { |
| 77 | var ai_data = { |
| 78 | 'action' : $(this).attr('data-action'), |
| 79 | 'id' : $(this).attr('data-id'), |
| 80 | '_wpnonce' : $(this).attr('data-nonce') |
| 81 | }; |
| 82 | var td = $(this).closest('td'); |
| 83 | var msg = $(this).attr( 'data-waiting-label' ); |
| 84 | td.html('<p>'+msg+'</p>'); |
| 85 | $.post(ajaxUrl, ai_data, function(response) { |
| 86 | td.html(response); |
| 87 | var btn = $('.wio-reoptimize'); |
| 88 | if ( btn.closest('.media-frame-content').length ) { |
| 89 | if ( btn.length ) { |
| 90 | btn = btn.first(); |
| 91 | var diminsionName = $('.dimensions').find('strong').clone(); |
| 92 | var fileSizeName = $('.file-size').find('strong').clone(); |
| 93 | var diminsionSize = btn.data('dimensions'); |
| 94 | var fileSize = btn.data('size'); |
| 95 | $('.dimensions').html(diminsionName.get(0).outerHTML + ' ' + diminsionSize); |
| 96 | $('.file-size').html(fileSizeName.get(0).outerHTML + ' ' + fileSize); |
| 97 | } |
| 98 | } |
| 99 | }); |
| 100 | return false; |
| 101 | }); |
| 102 | }); |
| 103 |