Файловый менеджер - Редактировать - /home/lmsyaran/public_html/joomla5/media/com_fabrik/js/dist/canvas-extra.js
Назад
/*! Fabrik */ CanvasRenderingContext2D.prototype.__defineGetter__("width",function(){return this.canvas.width}),CanvasRenderingContext2D.prototype.__defineGetter__("height",function(){return this.canvas.height}),CanvasRenderingContext2D.prototype.blackAndWhite=function(){for(var t=this.getImageData(0,0,this.width,this.height),e=0;e<t.data.length;e+=4){var n=t.data[e+0]+t.data[e+1]+t.data[e+2];n/=3,t.data[e+0]=n,t.data[e+1]=n,t.data[e+2]=n}this.putImageData(t,0,0)},CanvasRenderingContext2D.prototype.flipVertically=function(){this.save(),this.scale(1,-1),this.translate(0,-this.height),this.drawImage(this.canvas,0,0),this.restore()},CanvasRenderingContext2D.prototype.flipHorizontally=function(){this.save(),this.scale(-1,1),this.translate(-this.width,0),this.drawImage(this.canvas,0,0),this.restore()},CanvasRenderingContext2D.prototype.turn=function(t){var e=document.createElement("canvas"),n=(e.width=this.width,e.height=this.height,e.style.display="none",document.body.appendChild(e),e.getContext("2d").drawImage(this.canvas,0,0),this.canvas.width=e.height,this.canvas.height=e.width,this.save(),t?this.translate(this.width,0):this.translate(0,this.height),Math.PI/2);t||(n*=-1),this.rotate(n),this.drawImage(e,0,0),this.restore(),document.body.removeChild(e)},CanvasRenderingContext2D.prototype.resize=function(t){var e=document.createElement("canvas");e.width=this.width,e.height=this.height,e.style.display="none",document.body.appendChild(e),e.getContext("2d").drawImage(this.canvas,0,0),this.canvas.width*=t,this.canvas.height*=t,this.save(),this.scale(t,t),this.drawImage(e,0,0),document.body.removeChild(e),this.restore()},CanvasRenderingContext2D.prototype.isPortrait=function(){return this.width<this.height},CanvasRenderingContext2D.prototype._urlDropped=function(t,n,i,o){var s=this,a=document.createElement("img");a.style.display="none",a.addEventListener("load",function(){var t=1,e=1;a.width>s.width/3&&(t=s.width/3/a.width),a.height>s.height/3&&(e=s.height/3/a.height),t=Math.min(t,e),s.save(),s.translate(n-a.width*t/2,i-a.height*t/2),s.scale(t,t),s.drawImage(a,0,0),o&&(s.strokeStyle="white",s.lineWidth=5/t,s.strokeRect(0,0,a.width,a.height)),s.restore(),document.body.removeChild(a)},!0),a.src=t,document.body.appendChild(a)},CanvasRenderingContext2D.prototype.initDnD=function(){var s=this;this.canvas.addEventListener("dragover",function(t){t.preventDefault()},!0),this.canvas.addEventListener("drop",function(t){t.preventDefault();var e=t.dataTransfer,n=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,t=t.clientY+document.body.scrollTop+document.documentElement.scrollTop,i=n-s.canvas.offsetLeft-s.canvas.parentNode.offsetLeft,o=t-s.canvas.offsetTop-s.canvas.parentNode.offsetTop,n=e.files;0===n.length?e.types.contains(t="application/x-moz-file-promise-url")&&s._urlDropped(e.getData(t),i,o,!1):(e=n[0],(t=new FileReader).onload=function(t){s._urlDropped(t.target.result,i,o,!0)},t.readAsDataURL(e))},!0)},CanvasRenderingContext2D.prototype.poster=function(t){var e=Math.min(this.width,this.height);e/=10,this.fillStyle="black",this.fillRect(0,0,this.width,e),this.fillRect(0,this.height-2*e,this.width,2*e),this.fillRect(0,0,e,this.height),this.fillRect(this.width-e,0,e,this.height),this.strokeStyle="white";this.strokeRect(e-5,e-5,this.width-2*e+10,this.height-3*e+10),this.fillStyle="white",this.textAlign="center",this.textBaseline="middle",this.font=e+"px marketing",this.fillText(t,this.width/2,this.height-e,this.width)},CanvasRenderingContext2D.prototype.initCrop=function(){isMobile?this.initCrop_mobile():this.initCrop_desktop()},CanvasRenderingContext2D.prototype.initCrop_mobile=function(){var o,s,a=this,h=this.canvas;function d(t){h.removeEventListener("click",d,!0);var e=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,t=t.clientY+document.body.scrollTop+document.documentElement.scrollTop,n=e-o,i=t-s,e=o,t=s;n<0&&(e+=n,n*=-1),i<0&&(t+=i,i*=-1),e-=h.offsetLeft+h.parentNode.offsetLeft,t-=h.offsetTop+h.parentNode.offsetTop,a.crop(e,t,n,i)}h.addEventListener("click",function t(e){o=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,s=e.clientY+document.body.scrollTop+document.documentElement.scrollTop,h.removeEventListener("click",t,!0),h.addEventListener("click",d,!0)},!0)},CanvasRenderingContext2D.prototype.initCrop_desktop=function(){var o,s,a=document.createElement("div"),h=(a.id="cropbox",a.style.display="none",document.body.appendChild(a),this),d=this.canvas;function r(t){o=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,s=t.clientY+document.body.scrollTop+document.documentElement.scrollTop,d.addEventListener("mousemove",c,!0)}function c(t){var e=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,t=t.clientY+document.body.scrollTop+document.documentElement.scrollTop,n=o,i=s,e=e-o,t=t-s;e<0&&(n+=e,e*=-1),t<0&&(i+=t,t*=-1),a.style.display="block",a.style.left=n+"px",a.style.top=i+"px",a.style.width=e+"px",a.style.height=t+"px"}d.addEventListener("mousedown",r,!0),d.addEventListener("mouseup",function t(e){d.removeEventListener("mousemove",c,!0),d.removeEventListener("mousedown",r,!0),d.removeEventListener("mouseup",t,!0);var n=a.offsetLeft-d.offsetLeft-d.parentNode.offsetLeft,i=a.offsetTop-d.offsetTop-d.parentNode.offsetTop,o=a.offsetWidth,s=a.offsetHeight;document.body.removeChild(a),h.crop(n,i,o,s)},!0)},CanvasRenderingContext2D.prototype.crop=function(t,e,n,i){var o=document.createElement("canvas");o.width=this.width,o.height=this.height,o.style.display="none",document.body.appendChild(o),o.getContext("2d").drawImage(this.canvas,0,0),this.canvas.width=n,this.canvas.height=i,this.save(),this.drawImage(o,-t,-e),this.restore(),document.body.removeChild(o)};
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0.02 |
proxy
|
phpinfo
|
Настройка