diff --git a/public/scripts/agent-desktop-0.0.2-min.js b/public/scripts/agent-desktop-0.0.2-min.js index c8bd0a0f..6fec9e42 100644 --- a/public/scripts/agent-desktop-0.0.2-min.js +++ b/public/scripts/agent-desktop-0.0.2-min.js @@ -1 +1 @@ -var CreateAgentRemoteDesktop=function(e,n){var h={};"string"==typeof(h.CanvasId=e)&&(h.CanvasId=Q(e)),h.Canvas=h.CanvasId.getContext("2d"),h.scrolldiv=n,h.State=0,h.PendingOperations=[],h.tilesReceived=0,h.TilesDrawn=0,h.KillDraw=0,h.ipad=!1,h.tabletKeyboardVisible=!1,h.LastX=0,h.LastY=0,h.touchenabled=0,h.submenuoffset=0,h.touchtimer=null,h.TouchArray={},h.connectmode=0,h.connectioncount=0,h.rotation=0,h.protocol=2,h.debugmode=0,h.firstUpKeys=[],h.stopInput=!1,h.localKeyMap=!0,h.pressedKeys=[],h.sessionid=0,h.username,h.oldie=!1,h.CompressionLevel=50,h.ScalingLevel=1024,h.FrameRateTimer=100,h.FirstDraw=!1,h.ScreenWidth=960,h.ScreenHeight=700,h.width=960,h.height=960,h.displays=null,h.selectedDisplay=null,h.onScreenSizeChange=null,h.onMessage=null,h.onConnectCountChanged=null,h.onDebugMessage=null,h.onTouchEnabledChanged=null,h.onDisplayinfo=null;var g=!(h.accumulator=null),p="default";h.mouseCursorActive=function(e){g!=e&&(g=e,h.CanvasId.style.cursor=1==e?p:"default")};var v=["default","progress","crosshair","pointer","help","text","no-drop","move","nesw-resize","ns-resize","nwse-resize","w-resize","alias","wait","none","not-allowed","col-resize","row-resize","copy","zoom-in","zoom-out"];h.Start=function(){h.State=0,h.accumulator=null},h.Stop=function(){h.setRotation(0),h.UnGrabKeyInput(),h.UnGrabMouseInput(),h.touchenabled=0,null!=h.onScreenSizeChange&&h.onScreenSizeChange(h,h.ScreenWidth,h.ScreenHeight,h.CanvasId),h.Canvas.clearRect(0,0,h.CanvasId.width,h.CanvasId.height)},h.xxStateChange=function(e){if(h.State!=e)switch(h.State=e,h.CanvasId.style.cursor="default",e){case 0:h.Stop()}},h.send=function(e){1>32)+h.intToStr(32&o)):(h.recordedSize+=t.length,h.shortToStr(e)+h.shortToStr(n)+h.intToStr(t.length)+h.intToStr(o>>32)+h.intToStr(32&o)+t)}return h.SendKeyMsg=function(e,n){var t;null!=e&&((n=n||window.event).code&&0==h.localKeyMap?null!=(t=function(e){return e.code.startsWith("Key")&&4==e.code.length?e.code.charCodeAt(3):e.code.startsWith("Digit")&&6==e.code.length?e.code.charCodeAt(5):e.code.startsWith("Numpad")&&7==e.code.length?e.code.charCodeAt(6)+48:o[e.code]}(n))&&h.SendKeyMsgKC(e,t):(59==(t=n.keyCode)?t=186:173==t?t=189:61==t&&(t=187),h.SendKeyMsgKC(e,t)))},h.SendMessage=function(e){3==h.State&&h.send(String.fromCharCode(0,17)+h.shortToStr(4+e.length)+e)},h.SendKeyMsgKC=function(e,n){if(3==h.State)if("object"==typeof e)for(var t in e)h.SendKeyMsgKC(e[t][0],e[t][1]);else{if(1==e)-1==h.pressedKeys.indexOf(n)&&h.pressedKeys.unshift(n);else if(2==e){-1!=(t=h.pressedKeys.indexOf(n))&&h.pressedKeys.splice(t,1)}h.send(String.fromCharCode(0,h.InputType.KEY,0,6,e-1,n))}},h.sendcad=function(){h.SendCtrlAltDelMsg()},h.SendCtrlAltDelMsg=function(){3==h.State&&h.send(String.fromCharCode(0,h.InputType.CTRLALTDEL,0,4))},h.SendEscKey=function(){3==h.State&&h.send(String.fromCharCode(0,h.InputType.KEY,0,6,0,27,0,h.InputType.KEY,0,6,1,27))},h.SendStartMsg=function(){h.SendKeyMsgKC(h.KeyAction.EXDOWN,91),h.SendKeyMsgKC(h.KeyAction.EXUP,91)},h.SendCharmsMsg=function(){h.SendKeyMsgKC(h.KeyAction.EXDOWN,91),h.SendKeyMsgKC(h.KeyAction.DOWN,67),h.SendKeyMsgKC(h.KeyAction.UP,67),h.SendKeyMsgKC(h.KeyAction.EXUP,91)},h.SendTouchMsg1=function(e,n,t,o){3==h.State&&h.send(String.fromCharCode(0,h.InputType.TOUCH)+h.shortToStr(14)+String.fromCharCode(1,e)+h.intToStr(n)+h.shortToStr(t)+h.shortToStr(o))},h.SendTouchMsg2=function(e,n){var t,o="";for(var a in h.TouchArray)a==e?t=n:1==h.TouchArray[a].f?(t=65542,h.TouchArray[a].f=3,"START"+a):2==h.TouchArray[a].f?(t=262144,"STOP"+a):t=131078,o+=String.fromCharCode(a)+h.intToStr(t)+h.shortToStr(h.TouchArray[a].x)+h.shortToStr(h.TouchArray[a].y),2==h.TouchArray[a].f&&delete h.TouchArray[a];3==h.State&&h.send(String.fromCharCode(0,h.InputType.TOUCH)+h.shortToStr(5+o.length)+String.fromCharCode(2)+o),0==Object.keys(h.TouchArray).length&&null!=h.touchtimer&&(clearInterval(h.touchtimer),h.touchtimer=null)},h.SendMouseMsg=function(e,n){if(3==h.State&&null!=e&&null!=h.Canvas){if(!n)n=window.event;var t=h.Canvas.canvas.height/h.CanvasId.clientHeight,o=h.Canvas.canvas.width/h.CanvasId.clientWidth,a=h.GetPositionOfControl(h.Canvas.canvas),r=(n.pageX-a[0])*o,s=(n.pageY-a[1])*t;if(n.addx&&(r+=n.addx),n.addy&&(s+=n.addy),0<=r&&r<=h.Canvas.canvas.width&&0<=s&&s<=h.Canvas.canvas.height){var i=0,c=0;e==h.KeyAction.UP||e==h.KeyAction.DOWN?n.which?i=1==n.which?h.MouseButton.LEFT:2==n.which?h.MouseButton.MIDDLE:h.MouseButton.RIGHT:n.button&&(i=0==n.button?h.MouseButton.LEFT:1==n.button?h.MouseButton.MIDDLE:h.MouseButton.RIGHT):e==h.KeyAction.SCROLL&&(n.detail?c=120*n.detail*-1:n.wheelDelta&&(c=3*n.wheelDelta));var u="";if(e==h.KeyAction.DBLCLICK)u=String.fromCharCode(0,h.InputType.MOUSE,0,10,0,136,r/256&255,255&r,s/256&255,255&s);else if(e==h.KeyAction.SCROLL){var l=0,d=0;d=c<0?(l=255-(Math.abs(c)>>8),255-(255&Math.abs(c))):(l=c>>8,255&c),u=String.fromCharCode(0,h.InputType.MOUSE,0,12,0,0,r/256&255,255&r,s/256&255,255&s,l,d)}else u=String.fromCharCode(0,h.InputType.MOUSE,0,10,0,e==h.KeyAction.DOWN?i:2*i&255,r/256&255,255&r,s/256&255,255&s);h.Action==h.KeyAction.NONE?0==h.Alternate||h.ipad?(h.send(u),h.Alternate=1):h.Alternate=0:h.send(u)}}},h.GetDisplayNumbers=function(){h.send(String.fromCharCode(0,11,0,4))},h.SetDisplay=function(e){h.send(String.fromCharCode(0,12,0,6,e>>8,255&e))},h.intToStr=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},h.shortToStr=function(e){return String.fromCharCode(e>>8&255,255&e)},h.onResize=function(){0!=h.ScreenWidth&&0!=h.ScreenHeight&&(h.Canvas.canvas.width==h.ScreenWidth&&h.Canvas.canvas.height==h.ScreenHeight||(h.FirstDraw&&(h.Canvas.canvas.width=h.ScreenWidth,h.Canvas.canvas.height=h.ScreenHeight,h.Canvas.fillRect(0,0,h.ScreenWidth,h.ScreenHeight),null!=h.onScreenSizeChange&&h.onScreenSizeChange(h,h.ScreenWidth,h.ScreenHeight,h.CanvasId)),h.FirstDraw=!1))},h.xxMouseInputGrab=!1,h.xxKeyInputGrab=!1,h.xxMouseMove=function(e){return 3==h.State&&h.SendMouseMsg(h.KeyAction.NONE,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.xxMouseUp=function(e){return 3==h.State&&h.SendMouseMsg(h.KeyAction.UP,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.xxMouseDown=function(e){return 3==h.State&&h.SendMouseMsg(h.KeyAction.DOWN,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.xxMouseDblClick=function(e){return 3==h.State&&h.SendMouseMsg(h.KeyAction.DBLCLICK,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.xxDOMMouseScroll=function(e){return 3!=h.State||(h.SendMouseMsg(h.KeyAction.SCROLL,e),!1)},h.xxMouseWheel=function(e){return 3!=h.State||(h.SendMouseMsg(h.KeyAction.SCROLL,e),!1)},h.xxKeyUp=function(e){return 3==h.State&&h.SendKeyMsg(h.KeyAction.UP,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.xxKeyDown=function(e){return 3==h.State&&h.SendKeyMsg(h.KeyAction.DOWN,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.xxKeyPress=function(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.handleKeys=function(e){return 1!=h.stopInput&&3==desktop.State&&h.xxKeyPress(e)},h.handleKeyUp=function(e){if(1==h.stopInput||3!=desktop.State)return!1;if(h.firstUpKeys.length<5&&(h.firstUpKeys.push(e.keyCode),5==h.firstUpKeys.length)){var n=h.firstUpKeys.join(",");"16,17,91,91,16"!=n&&"16,17,18,91,92"!=n||(h.stopInput=!0)}return h.xxKeyUp(e)},h.handleKeyDown=function(e){return 1!=h.stopInput&&3==desktop.State&&h.xxKeyDown(e)},h.handleReleaseKeys=function(){var e=JSON.parse(JSON.stringify(h.pressedKeys));for(var n in e)h.SendKeyMsgKC(h.KeyAction.UP,e[n])},h.mousedblclick=function(e){return 1!=h.stopInput&&h.xxMouseDblClick(e)},h.mousedown=function(e){return 1!=h.stopInput&&h.xxMouseDown(e)},h.mouseup=function(e){return 1!=h.stopInput&&h.xxMouseUp(e)},h.mousemove=function(e){return 1!=h.stopInput&&h.xxMouseMove(e)},h.mousewheel=function(e){return 1!=h.stopInput&&h.xxMouseWheel(e)},h.xxMsTouchEvent=function(e){if(4!=e.originalEvent.pointerType){if(e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),"MSPointerDown"==e.type||"MSPointerMove"==e.type||"MSPointerUp"==e.type){var n=0,t=e.originalEvent.pointerId%256,o=e.offsetX*(Canvas.canvas.width/h.CanvasId.clientWidth),a=e.offsetY*(Canvas.canvas.height/h.CanvasId.clientHeight);"MSPointerDown"==e.type?n=65542:"MSPointerMove"==e.type?n=131078:"MSPointerUp"==e.type&&(n=262144),h.TouchArray[t]||(h.TouchArray[t]={x:o,y:a}),h.SendTouchMsg2(t,n),"MSPointerUp"==e.type&&delete h.TouchArray[t]}else alert(e.type);return!0}},h.xxTouchStart=function(e){if(3==h.State)if(e.preventDefault&&e.preventDefault(),0==h.touchenabled||1==h.touchenabled){if(1>32)+h.intToStr(32&o)):(h.recordedSize+=t.length,h.shortToStr(e)+h.shortToStr(n)+h.intToStr(t.length)+h.intToStr(o>>32)+h.intToStr(32&o)+t)}return h.SendKeyMsg=function(e,n){var t;null!=e&&((n=n||window.event).code&&0==h.localKeyMap?null!=(t=function(e){return e.code.startsWith("Key")&&4==e.code.length?e.code.charCodeAt(3):e.code.startsWith("Digit")&&6==e.code.length?e.code.charCodeAt(5):e.code.startsWith("Numpad")&&7==e.code.length?e.code.charCodeAt(6)+48:o[e.code]}(n))&&h.SendKeyMsgKC(e,t):(59==(t=n.keyCode)?t=186:173==t?t=189:61==t&&(t=187),h.SendKeyMsgKC(e,t)))},h.SendMessage=function(e){3==h.State&&h.send(String.fromCharCode(0,17)+h.shortToStr(4+e.length)+e)},h.SendKeyMsgKC=function(e,n){if(3==h.State)if("object"==typeof e)for(var t in e)h.SendKeyMsgKC(e[t][0],e[t][1]);else{if(1==e)-1==h.pressedKeys.indexOf(n)&&h.pressedKeys.unshift(n);else if(2==e){-1!=(t=h.pressedKeys.indexOf(n))&&h.pressedKeys.splice(t,1)}h.send(String.fromCharCode(0,h.InputType.KEY,0,6,e-1,n))}},h.sendcad=function(){h.SendCtrlAltDelMsg()},h.SendCtrlAltDelMsg=function(){3==h.State&&h.send(String.fromCharCode(0,h.InputType.CTRLALTDEL,0,4))},h.SendEscKey=function(){3==h.State&&h.send(String.fromCharCode(0,h.InputType.KEY,0,6,0,27,0,h.InputType.KEY,0,6,1,27))},h.SendStartMsg=function(){h.SendKeyMsgKC(h.KeyAction.EXDOWN,91),h.SendKeyMsgKC(h.KeyAction.EXUP,91)},h.SendCharmsMsg=function(){h.SendKeyMsgKC(h.KeyAction.EXDOWN,91),h.SendKeyMsgKC(h.KeyAction.DOWN,67),h.SendKeyMsgKC(h.KeyAction.UP,67),h.SendKeyMsgKC(h.KeyAction.EXUP,91)},h.SendTouchMsg1=function(e,n,t,o){3==h.State&&h.send(String.fromCharCode(0,h.InputType.TOUCH)+h.shortToStr(14)+String.fromCharCode(1,e)+h.intToStr(n)+h.shortToStr(t)+h.shortToStr(o))},h.SendTouchMsg2=function(e,n){var t,o="";for(var a in h.TouchArray)a==e?t=n:1==h.TouchArray[a].f?(t=65542,h.TouchArray[a].f=3,"START"+a):2==h.TouchArray[a].f?(t=262144,"STOP"+a):t=131078,o+=String.fromCharCode(a)+h.intToStr(t)+h.shortToStr(h.TouchArray[a].x)+h.shortToStr(h.TouchArray[a].y),2==h.TouchArray[a].f&&delete h.TouchArray[a];3==h.State&&h.send(String.fromCharCode(0,h.InputType.TOUCH)+h.shortToStr(5+o.length)+String.fromCharCode(2)+o),0==Object.keys(h.TouchArray).length&&null!=h.touchtimer&&(clearInterval(h.touchtimer),h.touchtimer=null)},h.SendMouseMsg=function(e,n){if(3==h.State&&null!=e&&null!=h.Canvas){if(!n)n=window.event;var t=h.Canvas.canvas.height/h.CanvasId.clientHeight,o=h.Canvas.canvas.width/h.CanvasId.clientWidth,a=h.GetPositionOfControl(h.Canvas.canvas),r=(n.pageX-a[0])*o,i=(n.pageY-a[1])*t;if(n.addx&&(r+=n.addx),n.addy&&(i+=n.addy),0<=r&&r<=h.Canvas.canvas.width&&0<=i&&i<=h.Canvas.canvas.height){var s=0,c=0;e==h.KeyAction.UP||e==h.KeyAction.DOWN?n.which?s=1==n.which?h.MouseButton.LEFT:2==n.which?h.MouseButton.MIDDLE:h.MouseButton.RIGHT:n.button&&(s=0==n.button?h.MouseButton.LEFT:1==n.button?h.MouseButton.MIDDLE:h.MouseButton.RIGHT):e==h.KeyAction.SCROLL&&(n.detail?c=120*n.detail*-1:n.wheelDelta&&(c=3*n.wheelDelta));var u="";if(e==h.KeyAction.DBLCLICK)u=String.fromCharCode(0,h.InputType.MOUSE,0,10,0,136,r/256&255,255&r,i/256&255,255&i);else if(e==h.KeyAction.SCROLL){var l=0,d=0;d=c<0?(l=255-(Math.abs(c)>>8),255-(255&Math.abs(c))):(l=c>>8,255&c),u=String.fromCharCode(0,h.InputType.MOUSE,0,12,0,0,r/256&255,255&r,i/256&255,255&i,l,d)}else u=String.fromCharCode(0,h.InputType.MOUSE,0,10,0,e==h.KeyAction.DOWN?s:2*s&255,r/256&255,255&r,i/256&255,255&i);h.Action==h.KeyAction.NONE?0==h.Alternate||h.ipad?(h.send(u),h.Alternate=1):h.Alternate=0:h.send(u)}}},h.GetDisplayNumbers=function(){h.send(String.fromCharCode(0,11,0,4))},h.SetDisplay=function(e){h.send(String.fromCharCode(0,12,0,6,e>>8,255&e))},h.intToStr=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},h.shortToStr=function(e){return String.fromCharCode(e>>8&255,255&e)},h.onResize=function(){0!=h.ScreenWidth&&0!=h.ScreenHeight&&(h.Canvas.canvas.width==h.ScreenWidth&&h.Canvas.canvas.height==h.ScreenHeight||(h.FirstDraw&&(h.Canvas.canvas.width=h.ScreenWidth,h.Canvas.canvas.height=h.ScreenHeight,h.Canvas.fillRect(0,0,h.ScreenWidth,h.ScreenHeight),null!=h.onScreenSizeChange&&h.onScreenSizeChange(h,h.ScreenWidth,h.ScreenHeight,h.CanvasId)),h.FirstDraw=!1))},h.xxMouseInputGrab=!1,h.xxKeyInputGrab=!1,h.xxMouseMove=function(e){return 3==h.State&&h.SendMouseMsg(h.KeyAction.NONE,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.xxMouseUp=function(e){return 3==h.State&&h.SendMouseMsg(h.KeyAction.UP,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.xxMouseDown=function(e){return 3==h.State&&h.SendMouseMsg(h.KeyAction.DOWN,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.xxMouseDblClick=function(e){return 3==h.State&&h.SendMouseMsg(h.KeyAction.DBLCLICK,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.xxDOMMouseScroll=function(e){return 3!=h.State||(h.SendMouseMsg(h.KeyAction.SCROLL,e),!1)},h.xxMouseWheel=function(e){return 3!=h.State||(h.SendMouseMsg(h.KeyAction.SCROLL,e),!1)},h.xxKeyUp=function(e){return 3==h.State&&h.SendKeyMsg(h.KeyAction.UP,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.xxKeyDown=function(e){return 3==h.State&&h.SendKeyMsg(h.KeyAction.DOWN,e),e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.xxKeyPress=function(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1},h.handleKeys=function(e){return 1!=h.stopInput&&3==desktop.State&&h.xxKeyPress(e)},h.handleKeyUp=function(e){if(1==h.stopInput||3!=desktop.State)return!1;if(h.firstUpKeys.length<5&&(h.firstUpKeys.push(e.keyCode),5==h.firstUpKeys.length)){var n=h.firstUpKeys.join(",");"16,17,91,91,16"!=n&&"16,17,18,91,92"!=n||(h.stopInput=!0)}return h.xxKeyUp(e)},h.handleKeyDown=function(e){return 1!=h.stopInput&&3==desktop.State&&h.xxKeyDown(e)},h.handleReleaseKeys=function(){var e=JSON.parse(JSON.stringify(h.pressedKeys));for(var n in e)h.SendKeyMsgKC(h.KeyAction.UP,e[n])},h.mousedblclick=function(e){return 1!=h.stopInput&&h.xxMouseDblClick(e)},h.mousedown=function(e){return 1!=h.stopInput&&h.xxMouseDown(e)},h.mouseup=function(e){return 1!=h.stopInput&&h.xxMouseUp(e)},h.mousemove=function(e){return 1!=h.stopInput&&h.xxMouseMove(e)},h.mousewheel=function(e){return 1!=h.stopInput&&h.xxMouseWheel(e)},h.xxMsTouchEvent=function(e){if(4!=e.originalEvent.pointerType){if(e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),"MSPointerDown"==e.type||"MSPointerMove"==e.type||"MSPointerUp"==e.type){var n=0,t=e.originalEvent.pointerId%256,o=e.offsetX*(Canvas.canvas.width/h.CanvasId.clientWidth),a=e.offsetY*(Canvas.canvas.height/h.CanvasId.clientHeight);"MSPointerDown"==e.type?n=65542:"MSPointerMove"==e.type?n=131078:"MSPointerUp"==e.type&&(n=262144),h.TouchArray[t]||(h.TouchArray[t]={x:o,y:a}),h.SendTouchMsg2(t,n),"MSPointerUp"==e.type&&delete h.TouchArray[t]}else alert(e.type);return!0}},h.xxTouchStart=function(e){if(3==h.State)if(e.preventDefault&&e.preventDefault(),0==h.touchenabled||1==h.touchenabled){if(1