When there isn't an event for the given moment, play the previous one. If still no events found, popup live

This commit is contained in:
Isaac Connor
2018-02-13 11:27:55 -05:00
parent 6cfce1d5f2
commit 535cdf6485

View File

@@ -706,12 +706,26 @@ function showOneMonitor(monId) {
createPopup(url, 'zmWatch', 'watch', monitorWidth[monId], monitorHeight[monId] );
} else {
for ( var i=0, len=eId.length; i<len; i++ ) {
if ( eMonId[i] == monId && currentTimeSecs >= 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] );
}
}
}