core-jgi/org.adempiere.ui.zk/js/photobooth_min.js

17 lines
16 KiB
JavaScript
Raw Normal View History

/**
*
* Photobooth.js version 0.7-rsd3
*
* build Wed Aug 14 2019 16:44:09 GMT-0300 (Brasilia Standard Time)
*
* CSS
*/
window.addEventListener("load",function(){var s = document.createElement("style"); s.innerHTML=".photobooth{position:relative;font:11px arial,sans-serif;overflow:hidden;user-select:none;-webkit-user-select:none;-moz-user-select:none;-o-user-select:none}.photobooth canvas{position:absolute;left:0;top:0}.photobooth .blind{position:absolute;left:0;top:0;opacity:0;width:100%;height:100%;background:#fff;z-index:1}.photobooth .blind.anim{transition:opacity 1500ms ease-out;-o-transition:opacity 1500ms ease-out;-moz-transition:opacity 1500ms ease-out;-webkit-transition:opacity 1500ms ease-out}.photobooth .warning{position:absolute;top:45%;background:#ffebeb;color:#cf0000;border:1px solid #cf0000;width:60%;left:50%;margin-left:-30%;display:none;padding:5px;z-index:10;text-align:center}.photobooth .warning span{text-decoration:underline;cursor:pointer;color:#333}.photobooth ul{width:30px;position:absolute;right:0;top:0;background:rgba( 0,0,0,.6 );height:230px;z-index:2;border-bottom-left-radius:5px;list-style:none;padding-left:0}.photobooth ul li{width:30px;height:38px;background-repeat:no-repeat;background-position:center center;cursor:pointer;position:relative}.photobooth ul li:hover{background-color:#aaa}.photobooth ul li.selected{background-color:#ccc}.photobooth ul.noHSB{height:120px}.photobooth ul.noFlip{height:190px}.photobooth ul.noHSB.noFlip{height:80px}.photobooth ul.noFlip li.flip,.photobooth ul.noHSB li.hue,.photobooth ul.noHSB li.saturation,.photobooth ul.noHSB li.brightness{display:none}.photobooth ul li.flip{background-image:url(data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAWCAYAAADTlvzyAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAADyUlEQVRIx71Vz2ujVRQ95+WHaG0bWlCEcaHV7vyxsD8ogjSkiaIdmIUyigPiILhQRN2I8xc4UBU3Iqj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ldYjsNjfXZVGe5PxgqjX69cB0FtgTtKcJAVPhm9j2iR1b/toZIo5DFs+fKyUTXqIT+/HOKKln16XPRyOlsvlyXABh/Nx5RIQpu6BFN8kvgiFaaYvYJKjAX0TwAj+n/j1b3e/jAKG43odAAAAAElFTkSuQmCC)}.photobooth ul li.hue{background-image:url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAZAAA/+4ADkFkb2JlAGTAAAAAAf/bAIQAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQICAgICAgICAgICAwMDAwMDAwMDAwEBAQEBAQECAQECAgIBAgIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD/8AAEQgACAAYAwERAAIRAQMRAf/EAHgAAQEAAAAAAAAAAAAAAAAAAAkIAQEAAwAAAAAAAAAAAAAAAAAKBggLEAAAAwQLAAAAAAAAAAAAAAAAMQZBAjQ4A3MEdMQFdQcICTkRAAEBBAcGBwAAAAAAAAAAABExAAEhElECMjMEBQlhwgNzFDgVNRY3CBgK/9oADAMBAAIRAxEAPwBGOKPmqmNdT5FD2YgarLO67OVueIqrxF2tI/1Kn0jjjKfFcJZEt+5BAUCAaKuw+ThT3vC0wbFof+U4Dnv3WGl8Pu47A8vecwabKy8ZRVNKFdF3dY72fztbVdFu67axelcfrPkYlPTutCW7qqYCkwDf/9k=)}.photobooth ul li.saturation{background-image:url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAZAAA/+4ADkFkb2JlAGTAAAAAAf/bAIQAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQICAgICAgICAgICAwMDAwMDAwMDAwEBAQEBAQECAQECAgIBAgIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD/8AAEQgACAAYAwERAAIRAQMRAf/EAGMAAAMAAAAAAAAAAAAAAAAAAAYICQEBAQEAAAAAAAAAAAAAAAAACAkKE
/**
* JS
*/
Photobooth=function(t){var e=this;t.length&&(t=t[0]);var i=navigator.mediaDevices.getUserMedia||navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.oGetUserMedia||navigator.msieGetUserMedia||!1;this.onImage=function(){},this.getHueOffset=function(){return a},this.setHueOffset=function(t){v(t,"hue")&&(a=t)},this.getBrightnessOffset=function(){return c},this.setBrightnessOffset=function(t){v(t,"brightness")&&(c=t)},this.getSaturationOffset=function(){return r},this.setSaturationOffset=function(t){v(t,"saturation")&&(r=t)},this.setCrop=function(){S.toggle(),"crop"===B.className?B.className="crop selected":B.className="crop"},this.crop=function(t,e,i,n){S.cropMove(t,e),S.cropResize(i,n)},this.pause=function(){!1===h&&(h=!0,d&&d.stop?d.stop():d.getTracks().forEach(t=>t.stop()))},this.resume=function(){!0===h&&(h=!1,U())},this.destroy=function(){this.pause(),t.removeChild(w)},this.forceHSB=!0,this.flipCammera=!0,this.mimeType="image/png",this.quality=1,this.isSupported=!!i,this.resize=function(t,e){if(0==e&&(e=N.videoHeight/(N.videoWidth/t),isNaN(e)&&(e=t/(4/3))),t<200||e<200)throw"Error: Not enough space for Photobooth. Min height / width is 200 px";p=t,f=e,S.setMax(p,f),w.style.width=t+"px",w.style.height=e+"px",b.width=t,b.height=e,M.width=t,M.height=e,N.width=t,N.height=e},this.capture=function(){H.className="blind",H.style.opacity=1,setTimeout(function(){H.className="blind anim",H.style.opacity=0},50);var t={};t=S.isActive()?S.getData():l?{x:(p-N.videoWidth)/2,y:(f-N.videoHeight)/2,width:N.videoWidth,height:N.videoHeight}:{x:0,y:0,width:p,height:f};var e=y("canvas");if(e.width=t.width,e.height=t.height,l)e.getContext("2d").drawImage(N,Math.max(0,t.x-(p-N.videoWidth)/2),Math.max(t.y-(f-N.videoHeight)/2),t.width,t.height,0,0,t.width,t.height);else{var i=E.getImageData(t.x,t.y,t.width,t.height);e.getContext("2d").putImageData(i,0,0)}u.onImage(e.toDataURL(u.mimeType,u.quality))};var n=function(t){t.stopPropagation(),t.cancelBubble=!0},o=function(t){this.startX=0,this.startY=0,t.addEventListener("mousedown",this,!1)};o.prototype.onStart=function(t,e){},o.prototype.onMove=function(t,e){},o.prototype.onStop=function(t,e){},o.prototype.handleEvent=function(t){this["fon"+t.type](t)},o.prototype.fonmousedown=function(t){t.preventDefault(),this.startX=t.clientX,this.startY=t.clientY,this.onStart(this.startX,this.startY),document.addEventListener("mousemove",this,!1),document.addEventListener("mouseup",this,!1)},o.prototype.fonmousemove=function(t){this.onMove(t.clientX-this.startX,t.clientY-this.startY)},o.prototype.fonmouseup=function(t){this.onStop(t.clientX-this.startX,t.clientY-this.startY),document.removeEventListener("mousemove",this),document.removeEventListener("mouseup",this)};var s=function(t,e){t.innerHTML='<div class="submenu"><div class="tip"></div><div class="slider"><div class="track"></div><div class="handle" style="left:50px"><div></div></div></div></div>';var i=50,s=50,a=t.getElementsByClassName("handle")[0],r=t.getElementsByClassName("slider")[0],c=new o(a);c.onMove=function(t){l(i+t)},c.onStop=function(t){i=s};var l=function(t){t>0&&t<100&&(s=t,a.style.left=t+"px",e((t-50)/100))};r.addEventListener("click",function(t){l(t.layerX),i=s},!1),a.addEventListener("click",n,!1)},a=0,r=0,c=0,l=!1,h=!1,d=null,u=this,p=0===t.offsetWidth?$(t).width():t.offsetWidth,f=0===t.offsetHeight?$(t).height():t.offsetHeight,v=function(t,e){if(t<-.5||t>.5)throw"Invalid value: "+e+" must be between 0 and 1";return!0},m=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)},g=function(t){return w.getElementsByClassName(t)[0]},y=function(t){return document.createElement(t)},w=y("div");w.className="photobooth",w.innerHTML='<div class="blind"></div><canvas></canvas><div class="warning notSupported">Sorry, Photobooth.js is not supported by your browser</div><div class="warning noWebcam">Please give Photobooth permission to use your Webcam. <span>Try again</
/**
* jQuery integration. (It's safe to delete this line if you're not using jQuery)
*/
window.jQuery&&($.fn.photobooth=function(){return this.each(function(o,t){var n=new Photobooth(t);$(t).data("photobooth",n),n.onImage=function(o){$(t).trigger("image",o)}})});