芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media/plg_media-action_rotate/js/rotate-es5.min.js
!function(){"use strict";var t=!1,e=function(t,e){var a=document.createElement("canvas");t>=0&&t<45||t>=135&&t<225||t>=315&&t<=360?(a.width=e.naturalWidth,a.height=e.naturalHeight):(a.width=e.naturalHeight,a.height=e.naturalWidth);var n=a.getContext("2d");n.clearRect(0,0,a.width,a.height),n.translate(a.width/2,a.height/2),n.rotate(t*Math.PI/180),n.drawImage(e,-e.naturalWidth/2,-e.naturalHeight/2);var i="jpg"===Joomla.MediaManager.Edit.original.extension?"jpeg":"jpg",r=document.getElementById("jform_rotate_quality").value;Joomla.MediaManager.Edit.current.contents=a.toDataURL("image/"+i,r),e.width=a.width,e.height=a.height,e.src="",requestAnimationFrame((function(){return requestAnimationFrame((function(){e.src=Joomla.MediaManager.Edit.current.contents}))})),document.getElementById("jform_rotate_a").value=t,window.dispatchEvent(new Event("mediaManager.history.point")),a=null};window.addEventListener("media-manager-edit-init",(function(){Joomla.MediaManager.Edit.plugins.rotate={Activate:function(a){return new Promise((function(n){!function(a){t||(document.getElementById("jform_rotate_a").addEventListener("change",(function(t){var n=t.target;e(parseInt(n.value,10),a),n.value=0,[].slice.call(document.querySelectorAll("#jform_rotate_distinct label")).forEach((function(t){t.classList.remove("active"),t.classList.remove("focus")}))})),[].slice.call(document.querySelectorAll("#jform_rotate_distinct [type=radio]")).forEach((function(t){t.addEventListener("click",(function(t){var n=t.target;e(parseInt(n.value,10),a),[].slice.call(document.querySelectorAll("#jform_rotate_distinct label")).forEach((function(t){t.classList.remove("active"),t.classList.remove("focus")}))}))})),t=!0)}(a),n()}))},Deactivate:function(){return new Promise((function(t){t()}))}}}),{once:!0})}();