CoreFiles by mySites.guru
rotate.min.js4 lines, 1,846 bytes, from Joomla_5.4.9-Stable-Full_Package.zip
Raw History Compare with 5.4.8
md5
cefa2b93666fb6c7ab2714586f873351
sha1
a6f29b32f5f34cded14ec38a1e09890fa3a94b1a
sha256
22f65e43afdf849ae4ad9700c8aef8eddf6925ec3647b8e993a7f03a039da281
/**
 * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */let activated=!1;const rotate=(a,e)=>{let t=document.createElement("canvas");a>=0&&a<45||a>=135&&a<225||a>=315&&a<=360?(t.width=e.naturalWidth,t.height=e.naturalHeight):(t.width=e.naturalHeight,t.height=e.naturalWidth);const r=t.getContext("2d");r.clearRect(0,0,t.width,t.height),r.translate(t.width/2,t.height/2),r.rotate(a*Math.PI/180),r.drawImage(e,-e.naturalWidth/2,-e.naturalHeight/2);const n=Joomla.MediaManager.Edit.original.extension.toLowerCase()==="jpg"?"jpeg":Joomla.MediaManager.Edit.original.extension.toLowerCase(),o=document.getElementById("jform_rotate_quality").value;Joomla.MediaManager.Edit.current.contents=t.toDataURL(`image/${n}`,o),e.width=t.width,e.height=t.height,e.src="",requestAnimationFrame(()=>requestAnimationFrame(()=>{e.src=Joomla.MediaManager.Edit.current.contents})),document.getElementById("jform_rotate_a").value=a,window.dispatchEvent(new Event("mediaManager.history.point")),t=null},initRotate=a=>{activated||(document.getElementById("jform_rotate_a").addEventListener("change",({target:e})=>{const t=parseInt(e.value,10);Number.isNaN(t)||(rotate(t,a),document.querySelectorAll("#jform_rotate_distinct label").forEach(r=>r.classList.remove("active","focus")))}),document.querySelectorAll("#jform_rotate_distinct [type=radio]").forEach(e=>{e.addEventListener("click",({target:t})=>{rotate(parseInt(t.value,10),a),document.querySelectorAll("#jform_rotate_distinct label").forEach(r=>r.classList.remove("active","focus"))})}),activated=!0)};window.addEventListener("media-manager-edit-init",()=>{Joomla.MediaManager.Edit.plugins.rotate={Activate(a){return new Promise(e=>{initRotate(a),e()})},Deactivate(){return new Promise(a=>{a()})}}},{once:!0});

The same content is in 42 releases, Joomla 5.4.5-rc1 to 6.3.0-alpha1. See them all, or every version of this file.