Skip to content

Commit

Permalink
Merge pull request #4074 from IgorA100/patch-146
Browse files Browse the repository at this point in the history
currentMonitor variable is now global for the Watch page
  • Loading branch information
connortechnology authored Jun 11, 2024
2 parents e85078c + 68cbfe0 commit 6bf2c26
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions web/skins/classic/views/js/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var wrapperMonitor = $j('#wrapperMonitor');
var filterQuery = '&filter[Query][terms][0][attr]=MonitorId&filter[Query][terms][0][op]=%3d&filter[Query][terms][0][val]='+monitorId;
var idle = 0;
var monitorStream = false; /* Stream is not started */
var currentMonitor;

var classSidebarL = 'col-sm-3'; /* id="sidebar" */
var classSidebarR = 'col-sm-2'; /* id="ptzControls" */
Expand Down Expand Up @@ -1021,7 +1022,7 @@ function streamReStart(oldId, newId) {
document.getElementById('monitor').classList.add('hidden-shift');
const el = document.querySelector('.imageFeed');
const newMonitorName = document.getElementById('nav-item-cycle'+newId).querySelector('a').textContent;
const currentMonitor = monitorData.find((o) => {
currentMonitor = monitorData.find((o) => {
return parseInt(o["id"]) === newId;
});
const url = new URL(document.location.href);
Expand Down Expand Up @@ -1056,13 +1057,13 @@ function streamReStart(oldId, newId) {

table.bootstrapTable('destroy');
streamPrepareStart(currentMonitor);
applyMonitorControllable(currentMonitor);
applyMonitorControllable();
zmPanZoom.init();
loadFontFaceObserver();
//document.getElementById('monitor').classList.remove('hidden-shift');
}

function applyMonitorControllable(currentMonitor) {
function applyMonitorControllable() {
const ptzToggle = document.getElementById('ptzToggle');
if (!ptzToggle) {
console.log('ptz toggle is not present. Likely OPT_CONTROL is off');
Expand Down Expand Up @@ -1193,11 +1194,11 @@ function initPage() {
//document.getElementById('monitor').classList.remove('hidden-shift');
changeObjectClass();
streamPrepareStart();
const currentMonitor = monitorData.find((o) => {
currentMonitor = monitorData.find((o) => {
return parseInt(o["id"]) === monitorId;
});
if (currentMonitor) {
applyMonitorControllable(currentMonitor);
applyMonitorControllable();
}
} // initPage

Expand All @@ -1216,9 +1217,6 @@ function watchFullscreen() {
}

function watchAllEvents() {
const currentMonitor = monitorData.find((o) => {
return parseInt(o["id"]) === monitorId;
});
window.location.replace(currentMonitor.urlForAllEvents);
}

Expand Down

0 comments on commit 6bf2c26

Please sign in to comment.