CoreFiles by mySites.guru
crop.min.js4 lines, 2,095 bytes, from Joomla_5.0.2-Stable-Full_Package.zip
Raw History Compare with 5.0.1
md5
7b166ad446f7402e33a187094459ba48
sha1
f982feb5e6fcc5f87b8c3550cb97dcd9ef3ef327
sha256
67eca85a3d69a6383fd8113b06706f1654164d66867a6ff828e51c216b63c39b
import p from"cropper-module";/**
 * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */let t,n=!1,a;const d=()=>{t.cropX.addEventListener("change",({currentTarget:e})=>{a.setData({x:parseInt(e.value,10)})}),t.cropY.addEventListener("change",({currentTarget:e})=>{a.setData({y:parseInt(e.value,10)})}),t.cropWidth.addEventListener("change",({currentTarget:e})=>{a.setData({width:parseInt(e.value,10)})}),t.cropHeight.addEventListener("change",({currentTarget:e})=>{a.setData({height:parseInt(e.value,10)})}),t.aspectRatio.addEventListener("change",({currentTarget:e})=>{a.setAspectRatio(e.value)}),n=!0},s=e=>{const o=e.naturalWidth/e.naturalHeight;!Number.isNaN(o)&&Number.isFinite(o)&&(t.cropAspectRatioOption.value=o),a=new p(e,{viewMode:1,responsive:!0,restore:!0,autoCrop:!0,movable:!1,zoomable:!1,rotatable:!1,autoCropArea:1,crop(r){t.cropX.value=Math.round(r.detail.x),t.cropY.value=Math.round(r.detail.y),t.cropWidth.value=Math.round(r.detail.width),t.cropHeight.value=Math.round(r.detail.height);const i=Joomla.MediaManager.Edit.original.extension==="jpg"?"jpeg":Joomla.MediaManager.Edit.original.extension,c=t.cropQuality.value;Joomla.MediaManager.Edit.current.contents=this.cropper.getCroppedCanvas().toDataURL(`image/${i}`,c),window.dispatchEvent(new Event("mediaManager.history.point"))}}),n||d(),a.setAspectRatio(t.cropAspectRatioOption.value)};window.addEventListener("media-manager-edit-init",()=>{t={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(e){return new Promise(o=>{s(e),o()})},Deactivate(e){return new Promise(o=>{e.cropper&&(e.cropper.destroy(),a=null),o()})}}},{once:!0});

The same content is in 17 releases, Joomla 5.0.1-rc1 to 5.1.0. See them all, or every version of this file.