wp_back/wp-content/plugins/wp-smushit/app/assets/js/smush-admin.min.js

2 lines
255 KiB
JavaScript
Raw Normal View History

2024-05-20 15:37:46 +03:00
!function(){var e={8283:function(e,t,n){"use strict";n.d(t,{O:function(){return s},h:function(){return i}});var s={maybeShowCDNActivationNotice:function(){wp_smush_msgs.smush_cdn_activation_notice&&WP_Smush.helpers.renderActivationCDNNotice(wp_smush_msgs.smush_cdn_activation_notice)},maybeShowCDNUpsellForPreSiteOnStart:function(){var e=document.querySelector(".wp-smush-upsell-cdn");e&&(e.querySelector("p").innerHTML=wp_smush_msgs.processing_cdn_for_free,e.classList.remove("sui-hidden"))},maybeShowCDNUpsellForPreSiteOnCompleted:function(){var e=document.querySelector(".wp-smush-upsell-cdn");e&&(e.querySelector("p").innerHTML=wp_smush_msgs.processed_cdn_for_free,e.classList.remove("sui-hidden"))}},i=function(){var e=document.querySelector.bind(document),t=e(".sui-summary-smush-metabox");if(!t)return{};var n=window.wp_smushit_data.bo_stats,i={count_images:0,count_total:0,count_resize:0,count_skipped:0,count_smushed:0,savings_bytes:0,savings_resize:0,size_after:0,size_before:0,savings_percent:0,percent_grade:"sui-grade-dismissed",percent_metric:0,percent_optimized:0,remaining_count:0,human_bytes:"",savings_conversion_human:"",savings_conversion:0},r=e("#smush-image-score"),o=e(".smush-final-log .smush-bulk-errors"),a=e("#wp-smush-bulk-content"),u={},c=function(e){window.wp_smushit_data=Object.assign(window.wp_smushit_data,e||{}),i=Object.keys(i).reduce((function(e,t){return t in window.wp_smushit_data&&(e[t]=window.wp_smushit_data[t]),e}),{})};return c(window.wp_smushit_data),{isChangedStats:function(e){return["total_items","processed_items","failed_items","is_cancelled","is_completed"].some((function(t){return e[t]!==n[t]}))},setBoStats:function(e){return n=Object.assign(n,e||{}),this},getBoStats:function(){return n},setGlobalStats:function(e){return i=Object.assign(i,e||{}),this},getGlobalStats:function(){return i},renderScoreProgress:function(){r.className=r.className.replace(/(^|\s)sui-grade-\S+/g,""),r.classList.add(i.percent_grade),r.dataset.score=i.percent_optimized,r.querySelector(".sui-circle-score-label").innerHTML=i.percent_optimized,r.querySelector("circle:last-child").setAttribute("style","--metric-array:"+2.63893782902*i.percent_metric+" "+(263.893782902-i.percent_metric))},renderSummaryDetail:function(){this.renderTotalStats(),this.renderResizedStats(),this.renderConversionSavings()},renderTotalStats:function(){t.querySelector(".sui-summary-large.wp-smush-stats-human").innerHTML=i.human_bytes,t.querySelector(".wp-smush-savings .wp-smush-stats-percent").innerHTML=i.savings_percent,t.querySelector(".wp-smush-count-total .wp-smush-total-optimised").innerHTML=i.count_images},renderResizedStats:function(){var e=t.querySelector(".wp-smush-count-resize-total");e&&(i.count_resize>0?e.classList.remove("sui-hidden"):e.classList.add("sui-hidden"),e.querySelector(".wp-smush-total-optimised").innerHTML=i.count_resize)},renderConversionSavings:function(){var e=t.querySelector(".smush-conversion-savings .wp-smush-stats");e&&(e.innerHTML=i.savings_conversion_human,i.savings_conversion>0?e.parentElement.classList.remove("sui-hidden"):e.parentElement.classList.add("sui-hidden"))},renderBoxSummary:function(){this.renderScoreProgress(),this.renderSummaryDetail()},setErrors:function(e){u=e||{}},getErrors:function(){return u},renderErrors:function(){if(Object.keys(u).length&&n.is_completed){var t=[],i=Object.keys(u),r=!1;i.map((function(e,n){var s=u[e].error_code;n<5&&"animated"===s&&(r=!0),t.push(WP_Smush.helpers.prepareBulkSmushErrorRow(u[e].error_message,u[e].file_name,u[e].thumbnail,e,"media",u[e].error_code))})),o.innerHTML=t.join(""),o.parentElement.classList.remove("sui-hidden"),o.parentElement.style.display=null,i.length>1&&e(".smush-bulk-errors-actions").classList.remove("sui-hidden"),r&&s.maybeShowCDNActivationNotice()}},resetAndHideBulkErrors:function(){o&&(this.resetErrors(),o.parentElement.classList.add("sui-hidden"),o.innerHTML="")},resetErrors:function(){u={}},renderStats:function(){this.renderBoxSummary(),this.renderErrors()},maybeUpdateBulkSmushCountContent:function(e){e&&a&&(a.innerHTML=e)},updateGlobalStatsFromS
//# sourceMappingURL=smush-admin.min.js.map