From 695ad03b2bc236465cea5d3ded64364a96b4469c Mon Sep 17 00:00:00 2001 From: Moe Alam Date: Tue, 1 Dec 2020 07:53:47 -0800 Subject: [PATCH] fix monitor pop button on stream window and on event execution --- web/libs/js/dash2.elementbuilder.js | 2 +- web/libs/js/dash2.elements.js | 20 +------------------- web/libs/js/dash2.monitorUtils.js | 25 +++++++++++++++++++++++++ web/libs/js/dash2.socketio.js | 2 +- web/pages/home.ejs | 1 + 5 files changed, 29 insertions(+), 21 deletions(-) create mode 100644 web/libs/js/dash2.monitorUtils.js diff --git a/web/libs/js/dash2.elementbuilder.js b/web/libs/js/dash2.elementbuilder.js index a158759b..faf373d7 100644 --- a/web/libs/js/dash2.elementbuilder.js +++ b/web/libs/js/dash2.elementbuilder.js @@ -154,7 +154,7 @@ $.ccio.tm=function(x,d,z,user){ "class": "default", "icon": "external-link" }, - "Pop": { + "Zoom In": { "label": lang['Zoom In'], "attr": "monitor=\"zoomStreamWithMouse\"", "class": "default", diff --git a/web/libs/js/dash2.elements.js b/web/libs/js/dash2.elements.js index ed69bd51..4602ceab 100644 --- a/web/libs/js/dash2.elements.js +++ b/web/libs/js/dash2.elements.js @@ -409,25 +409,7 @@ $(document).ready(function(e){ } break; case'pop': - e.fin=function(img){ - if($.ccio.mon[e.ke+e.mid+user.auth_token].popOut){ - $.ccio.mon[e.ke+e.mid+user.auth_token].popOut.close() - } - $.ccio.mon[e.ke+e.mid+user.auth_token].popOut = window.open(getApiPrefix() + '/embed/'+e.ke+'/'+e.mid+'/fullscreen|jquery|relative|gui','pop_'+e.mid+user.auth_token,'height='+img.height+',width='+img.width); - } - if(e.mon.watch===1){ - $.ccio.snapshot(e,function(url){ - $('#temp').html('') - var img=$('#temp img')[0] - img.onload=function(){ - e.fin(img) - } - img.src=url - }) - }else{ - var img={height:720,width:1280} - e.fin(img) - } + popOutMonitor(e.mid) break; case'mode': e.mode=e.e.attr('mode') diff --git a/web/libs/js/dash2.monitorUtils.js b/web/libs/js/dash2.monitorUtils.js new file mode 100644 index 00000000..37e69470 --- /dev/null +++ b/web/libs/js/dash2.monitorUtils.js @@ -0,0 +1,25 @@ +var popOutMonitor = function(monitorId){ + var monitor = $.ccio.mon[$user.ke + monitorId + $user.auth_token] + var finish = function(img){ + if(monitor.popOut){ + monitor.popOut.close() + } + monitor.popOut = window.open(getApiPrefix() + '/embed/' + $user.ke + '/' + monitorId + '/fullscreen|jquery|relative|gui','pop_' + monitorId + $user.auth_token,'height='+img.height+',width='+img.width); + } + if(monitor.watch === 1){ + $.ccio.snapshot(monitor,function(url){ + $('#temp').html('') + var img=$('#temp img')[0] + img.onload=function(){ + finish(img) + } + img.src=url + }) + }else{ + var img={ + height: 720, + width: 1280 + } + finish(img) + } +} diff --git a/web/libs/js/dash2.socketio.js b/web/libs/js/dash2.socketio.js index 7103d9c1..4b45d2f1 100644 --- a/web/libs/js/dash2.socketio.js +++ b/web/libs/js/dash2.socketio.js @@ -91,7 +91,7 @@ $.ccio.globalWebsocket=function(d,user){ } } if(user.details.event_mon_pop === '1' && (!$.ccio.mon[d.ke+d.id+user.auth_token].popOut || $.ccio.mon[d.ke+d.id+user.auth_token].popOut.closed === true)){ - d.e.find('[monitor="pop"]').click() + popOutMonitor(d.id) } } break; diff --git a/web/pages/home.ejs b/web/pages/home.ejs index 8c52c061..acbfa574 100644 --- a/web/pages/home.ejs +++ b/web/pages/home.ejs @@ -183,6 +183,7 @@ +