From 535cdf6485d7ca8d707dfae0a5b8baf33d0d1d69 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 13 Feb 2018 11:27:55 -0500 Subject: [PATCH] When there isn't an event for the given moment, play the previous one. If still no events found, popup live --- web/skins/classic/views/js/montagereview.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/views/js/montagereview.js b/web/skins/classic/views/js/montagereview.js index 90a8d71b7..1d1b6fb60 100644 --- a/web/skins/classic/views/js/montagereview.js +++ b/web/skins/classic/views/js/montagereview.js @@ -706,12 +706,26 @@ function showOneMonitor(monId) { createPopup(url, 'zmWatch', 'watch', monitorWidth[monId], monitorHeight[monId] ); } else { for ( var i=0, len=eId.length; i= eStartSecs[i] && currentTimeSecs <= eEndSecs[i] ) { + if ( eMonId[i] != monId ) + continue; + + if ( currentTimeSecs >= eStartSecs[i] && currentTimeSecs <= eEndSecs[i] ) { url="?view=event&eid=" + eId[i] + '&fid=' + parseInt(Math.max(1, Math.min(eventFrames[i], eventFrames[i] * (currentTimeSecs - eStartSecs[i]) / (eEndSecs[i] - eStartSecs[i] + 1) ) )); break; + } else if ( currentTimeSecs <= eStartSecs[i] ) { + if ( i ) { + // Didn't find an exact event, so go with the one before. + url="?view=event&eid=" + eId[i] + '&fid=' + parseInt(Math.max(1, Math.min(eventFrames[i], eventFrames[i] * (currentTimeSecs - eStartSecs[i]) / (eEndSecs[i] - eStartSecs[i] + 1) ) )); + } + break; } } - createPopup(url, 'zmEvent', 'event', monitorWidth[monId], monitorHeight[monId]); + if ( url ) { + createPopup(url, 'zmEvent', 'event', monitorWidth[monId], monitorHeight[monId]); + } else { + url="?view=watch&mid=" + monId.toString(); + createPopup(url, 'zmWatch', 'watch', monitorWidth[monId], monitorHeight[monId] ); + } } }