mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-02-01 18:11:14 -05:00
Resolve conflicts
This commit is contained in:
@@ -712,10 +712,6 @@ public static function getStatuses() {
|
||||
return $this->Server()->UrlToIndex($port);
|
||||
}
|
||||
|
||||
public function UrlToZMS($port=null) {
|
||||
return $this->Server()->UrlToZMS($port).'?mid='.$this->Id();
|
||||
}
|
||||
|
||||
public function sendControlCommand($command) {
|
||||
// command is generally a command option list like --command=blah but might be just the word quit
|
||||
|
||||
|
||||
@@ -70,199 +70,11 @@ function setSpeed(newSpeed) {
|
||||
} else if (lastSpeed != '0') {
|
||||
monitorStream.pause();
|
||||
// pause
|
||||
>>>>>>> master
|
||||
} else {
|
||||
// play
|
||||
monitorStream.play();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
this.started = true;
|
||||
};
|
||||
|
||||
this.stop = function() {
|
||||
if ( this.started ) {
|
||||
if ( this.streamCmdTimer ) {
|
||||
this.streamCmdTimer = clearTimeout(this.streamCmdTimer);
|
||||
}
|
||||
this.started = false;
|
||||
if ( this.stream ) {
|
||||
this.stream.src = this.url_to_snapshot+(auth_hash?"&auth="+auth_hash:'');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.eventHandler = function(event) {
|
||||
console.log(event);
|
||||
};
|
||||
|
||||
this.onclick = function(evt) {
|
||||
var el = evt.currentTarget;
|
||||
var tag = 'watch';
|
||||
var id = el.getAttribute("data-monitor-id");
|
||||
var width = el.getAttribute("data-width");
|
||||
var height = el.getAttribute("data-height");
|
||||
var url = '?view=watch&mid='+id;
|
||||
var name = 'zmWatch'+id;
|
||||
evt.preventDefault();
|
||||
createPopup(url, name, tag, width, height);
|
||||
};
|
||||
|
||||
this.setup_onclick = function() {
|
||||
var el = document.getElementById('imageFeed'+this.id);
|
||||
if ( el ) el.addEventListener('click', this.onclick, false);
|
||||
};
|
||||
this.disable_onclick = function() {
|
||||
document.getElementById('imageFeed'+this.id).removeEventListener('click', this.onclick);
|
||||
};
|
||||
|
||||
this.setStateClass = function(element, stateClass) {
|
||||
if ( !element.hasClass( stateClass ) ) {
|
||||
if ( stateClass != 'alarm' ) {
|
||||
element.removeClass('alarm');
|
||||
}
|
||||
if ( stateClass != 'alert' ) {
|
||||
element.removeClass('alert');
|
||||
}
|
||||
if ( stateClass != 'idle' ) {
|
||||
element.removeClass('idle');
|
||||
}
|
||||
element.addClass(stateClass);
|
||||
}
|
||||
};
|
||||
|
||||
this.onError = function(text, error) {
|
||||
console.log('onerror: ' + text + ' error:'+error);
|
||||
// Requeue, but want to wait a while.
|
||||
var streamCmdTimeout = 10*statusRefreshTimeout;
|
||||
this.streamCmdTimer = this.streamCmdQuery.delay(streamCmdTimeout, this);
|
||||
};
|
||||
this.onFailure = function(xhr) {
|
||||
console.log('onFailure: ' + this.connKey);
|
||||
console.log(xhr);
|
||||
if ( ! requestQueue.hasNext("cmdReq"+this.id) ) {
|
||||
console.log("Not requeuing because there is one already");
|
||||
requestQueue.addRequest("cmdReq"+this.id, this.streamCmdReq);
|
||||
}
|
||||
if ( 0 ) {
|
||||
// Requeue, but want to wait a while.
|
||||
if ( this.streamCmdTimer ) {
|
||||
this.streamCmdTimer = clearTimeout(this.streamCmdTimer);
|
||||
}
|
||||
var streamCmdTimeout = 1000*statusRefreshTimeout;
|
||||
this.streamCmdTimer = this.streamCmdQuery.delay(streamCmdTimeout, this, true);
|
||||
requestQueue.resume();
|
||||
}
|
||||
console.log("done failure");
|
||||
};
|
||||
|
||||
this.getStreamCmdResponse = function(respObj, respText) {
|
||||
if ( this.streamCmdTimer ) {
|
||||
this.streamCmdTimer = clearTimeout( this.streamCmdTimer );
|
||||
}
|
||||
|
||||
|
||||
var stream = $j('#liveStream'+this.id)[0];
|
||||
|
||||
if ( respObj.result == 'Ok' ) {
|
||||
if ( respObj.status ) {
|
||||
this.status = respObj.status;
|
||||
this.alarmState = this.status.state;
|
||||
|
||||
var stateClass = "";
|
||||
if ( this.alarmState == STATE_ALARM ) {
|
||||
stateClass = "alarm";
|
||||
} else if ( this.alarmState == STATE_ALERT ) {
|
||||
stateClass = "alert";
|
||||
} else {
|
||||
stateClass = "idle";
|
||||
}
|
||||
|
||||
if ( (!COMPACT_MONTAGE) && (this.type != 'WebSite') ) {
|
||||
$('fpsValue'+this.id).set('text', this.status.fps);
|
||||
$('stateValue'+this.id).set('text', stateStrings[this.alarmState]);
|
||||
this.setStateClass($('monitorState'+this.id), stateClass);
|
||||
}
|
||||
this.setStateClass($('monitor'+this.id), stateClass);
|
||||
|
||||
/*Stream could be an applet so can't use moo tools*/
|
||||
this.stream.className = stateClass;
|
||||
|
||||
var isAlarmed = ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT );
|
||||
var wasAlarmed = ( this.lastAlarmState == STATE_ALARM || this.lastAlarmState == STATE_ALERT );
|
||||
|
||||
var newAlarm = ( isAlarmed && !wasAlarmed );
|
||||
var oldAlarm = ( !isAlarmed && wasAlarmed );
|
||||
|
||||
if ( newAlarm ) {
|
||||
if ( false && SOUND_ON_ALARM ) {
|
||||
// Enable the alarm sound
|
||||
$('alarmSound').removeClass('hidden');
|
||||
}
|
||||
if ( POPUP_ON_ALARM ) {
|
||||
windowToFront();
|
||||
}
|
||||
}
|
||||
if ( false && SOUND_ON_ALARM ) {
|
||||
if ( oldAlarm ) {
|
||||
// Disable alarm sound
|
||||
$('alarmSound').addClass('hidden');
|
||||
}
|
||||
}
|
||||
if ( this.status.auth ) {
|
||||
if ( this.status.auth != auth_hash ) {
|
||||
// Try to reload the image stream.
|
||||
// DOn't need to restart the stream, zms won't give up
|
||||
//if ( this.stream ) {
|
||||
//tstream.src = stream.src.replace(/auth=\w+/i, 'auth='+this.status.auth);
|
||||
//}
|
||||
console.log("Changed auth from " + auth_hash + " to " + this.status.auth);
|
||||
auth_hash = this.status.auth;
|
||||
}
|
||||
} // end if have a new auth hash
|
||||
} // end if has state
|
||||
} else {
|
||||
console.error(respObj.message);
|
||||
// Try to reload the image stream.
|
||||
console.log('Reloading stream');
|
||||
this.stop();
|
||||
this.start();
|
||||
} // end if Ok or not
|
||||
|
||||
var streamCmdTimeout = statusRefreshTimeout;
|
||||
// The idea here is if we are alarmed, do updates faster.
|
||||
// However, there is a timeout in the php side which isn't getting modified,
|
||||
// so this may cause a problem. Also the server may only be able to update so fast.
|
||||
//if ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT ) {
|
||||
//streamCmdTimeout = streamCmdTimeout/5;
|
||||
//}
|
||||
this.streamCmdTimer = this.streamCmdQuery.delay(streamCmdTimeout, this);
|
||||
this.lastAlarmState = this.alarmState;
|
||||
};
|
||||
|
||||
this.streamCmdQuery = function(resent) {
|
||||
if ( resent ) {
|
||||
console.log(this.connKey+": timeout: Resending");
|
||||
this.streamCmdReq.cancel();
|
||||
}
|
||||
//console.log("Starting CmdQuery for " + this.connKey );
|
||||
if ( this.type != 'WebSite' ) {
|
||||
this.streamCmdReq.send(this.streamCmdParms+"&command="+CMD_QUERY);
|
||||
}
|
||||
};
|
||||
|
||||
if ( this.type != 'WebSite' ) {
|
||||
this.streamCmdReq = new Request.JSON( {
|
||||
url: this.url,
|
||||
method: 'get',
|
||||
timeout: AJAX_TIMEOUT,
|
||||
onSuccess: this.getStreamCmdResponse.bind(this),
|
||||
onTimeout: this.streamCmdQuery.bind(this, true),
|
||||
onError: this.onError.bind(this),
|
||||
onFailure: this.onFailure.bind(this),
|
||||
link: 'cancel'
|
||||
} );
|
||||
//console.log("queueing for " + this.id + " " + this.connKey + " timeout is: " + AJAX_TIMEOUT);
|
||||
requestQueue.addRequest("cmdReq"+this.id, this.streamCmdReq);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -696,13 +508,8 @@ function handleClick(evt) {
|
||||
evt.preventDefault();
|
||||
var id;
|
||||
|
||||
if (evt.target.id) { //We are looking for an object with an ID, because there may be another element in the button.
|
||||
var obj = evt.target;
|
||||
} else {
|
||||
var obj = evt.target.parentElement;
|
||||
}
|
||||
|
||||
|
||||
//We are looking for an object with an ID, because there may be another element in the button.
|
||||
const obj = evt.target.id ? evt.target : evt.target.parentElement;
|
||||
|
||||
if (mode == EDITING || obj.className.includes('btn-zoom-out') || obj.className.includes('btn-zoom-in')) return;
|
||||
if (obj.className.includes('btn-view-watch')) {
|
||||
@@ -1077,7 +884,7 @@ function on_scroll() {
|
||||
for (let i = 0, length = monitors.length; i < length; i++) {
|
||||
const monitor = monitors[i];
|
||||
|
||||
const isOut = isOutOfViewport(stream);
|
||||
const isOut = isOutOfViewport(monitor.getElement());
|
||||
if ( !isOut.all ) {
|
||||
monitor.start();
|
||||
} else if ( monitor.started ) {
|
||||
@@ -1095,13 +902,12 @@ $j(window).blur(function() {
|
||||
});
|
||||
|
||||
function isOutOfViewport(elem) {
|
||||
|
||||
// Get element's bounding
|
||||
var bounding = elem.getBoundingClientRect();
|
||||
const bounding = elem.getBoundingClientRect();
|
||||
//console.log( 'top: ' + bounding.top + ' left: ' + bounding.left + ' bottom: '+bounding.bottom + ' right: '+bounding.right);
|
||||
|
||||
// Check if it's out of the viewport on each side
|
||||
var out = {};
|
||||
const out = {};
|
||||
out.top = (bounding.top < 0) || ( bounding.top > (window.innerHeight || document.documentElement.clientHeight) );
|
||||
out.left = (bounding.left < 0) || (bounding.left > (window.innerWidth || document.documentElement.clientWidth));
|
||||
out.bottom = (bounding.bottom > (window.innerHeight || document.documentElement.clientHeight) ) || (bounding.bottom < 0);
|
||||
@@ -1405,7 +1211,6 @@ function changeMonitorStatusPositon() {
|
||||
setCookie('zmMonitorStatusPositonSelected', monitorStatusPositon);
|
||||
}
|
||||
|
||||
>>>>>>> master
|
||||
// Kick everything off
|
||||
$j(window).on('load', () => initPage());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user