芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media.6/plg_media-action_crop/js/crop-es5.min.js
!function(){"use strict";var e,t,a=!1,r=function(r){var n=r.naturalWidth/r.naturalHeight;!Number.isNaN(n)&&Number.isFinite(n)&&(e.cropAspectRatioOption.value=n),t=new Cropper(r,{viewMode:1,responsive:!0,restore:!0,autoCrop:!0,movable:!1,zoomable:!1,rotatable:!1,autoCropArea:1,crop:function(t){e.cropX.value=Math.round(t.detail.x),e.cropY.value=Math.round(t.detail.y),e.cropWidth.value=Math.round(t.detail.width),e.cropHeight.value=Math.round(t.detail.height);var a="jpg"===Joomla.MediaManager.Edit.original.extension?"jpeg":Joomla.MediaManager.Edit.original.extension,r=e.cropQuality.value;Joomla.MediaManager.Edit.current.contents=this.cropper.getCroppedCanvas().toDataURL("image/"+a,r),window.dispatchEvent(new Event("mediaManager.history.point"))}}),a||(e.cropX.addEventListener("change",(function(e){var a=e.currentTarget;t.setData({x:parseInt(a.value,10)})})),e.cropY.addEventListener("change",(function(e){var a=e.currentTarget;t.setData({y:parseInt(a.value,10)})})),e.cropWidth.addEventListener("change",(function(e){var a=e.currentTarget;t.setData({width:parseInt(a.value,10)})})),e.cropHeight.addEventListener("change",(function(e){var a=e.currentTarget;t.setData({height:parseInt(a.value,10)})})),e.aspectRatio.addEventListener("change",(function(e){var a=e.currentTarget;t.setAspectRatio(a.value)})),a=!0),t.setAspectRatio(e.cropAspectRatioOption.value)};window.addEventListener("media-manager-edit-init",(function(){e={aspectRatio:document.getElementById("jform_aspectRatio"),cropHeight:document.getElementById("jform_crop_height"),cropWidth:document.getElementById("jform_crop_width"),cropY:document.getElementById("jform_crop_y"),cropX:document.getElementById("jform_crop_x"),cropQuality:document.getElementById("jform_crop_quality"),cropAspectRatioOption:document.querySelector(".crop-aspect-ratio-option")},Joomla.MediaManager.Edit.plugins.crop={Activate:function(e){return new Promise((function(t){r(e),t()}))},Deactivate:function(e){return new Promise((function(a){e.cropper&&(e.cropper.destroy(),t=null),a()}))}}}),{once:!0})}();