fix whitespace
This commit is contained in:
parent
e15fdf9ac3
commit
8b0f319834
|
@ -321,14 +321,14 @@ function delPoint( index ) {
|
||||||
|
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
function limitPointValue( point, loVal, hiVal ) {
|
function limitPointValue( point, loVal, hiVal ) {
|
||||||
=======
|
=======
|
||||||
function limitPointValue( point, loVal, hiVal )
|
function limitPointValue( point, loVal, hiVal )
|
||||||
{
|
{
|
||||||
>>>>>>> master
|
>>>>>>> master
|
||||||
point.value = constrainValue(point.value, loVal, hiVal);
|
point.value = constrainValue(point.value, loVal, hiVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateArea( ) {
|
function updateArea( ) {
|
||||||
area = Polygon_calcArea( zone['Points'] );
|
area = Polygon_calcArea( zone['Points'] );
|
||||||
zone.Area = area;
|
zone.Area = area;
|
||||||
var form = $('zoneForm');
|
var form = $('zoneForm');
|
||||||
|
@ -340,9 +340,9 @@ function updateArea( ) {
|
||||||
} else {
|
} else {
|
||||||
alert("Unknown units: " + form.elements['newZone[Units]'].value );
|
alert("Unknown units: " + form.elements['newZone[Units]'].value );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateX( index ) {
|
function updateX( index ) {
|
||||||
limitPointValue( $('newZone[Points]['+index+'][x]'), 0, maxX );
|
limitPointValue( $('newZone[Points]['+index+'][x]'), 0, maxX );
|
||||||
|
|
||||||
var point = $('point'+index);
|
var point = $('point'+index);
|
||||||
|
@ -352,9 +352,9 @@ function updateX( index ) {
|
||||||
zone['Points'][index].x = x;
|
zone['Points'][index].x = x;
|
||||||
var Point = $('zonePoly').points.getItem(index);
|
var Point = $('zonePoly').points.getItem(index);
|
||||||
Point.x = x;
|
Point.x = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateY( index ) {
|
function updateY( index ) {
|
||||||
limitPointValue( $('newZone[Points]['+index+'][y]'), 0, maxY );
|
limitPointValue( $('newZone[Points]['+index+'][y]'), 0, maxY );
|
||||||
|
|
||||||
var point = $('point'+index);
|
var point = $('point'+index);
|
||||||
|
@ -364,9 +364,9 @@ function updateY( index ) {
|
||||||
zone['Points'][index].y = y;
|
zone['Points'][index].y = y;
|
||||||
var Point = $('zonePoly').points.getItem(index);
|
var Point = $('zonePoly').points.getItem(index);
|
||||||
Point.y = y;
|
Point.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveChanges( element ) {
|
function saveChanges( element ) {
|
||||||
var form = element.form;
|
var form = element.form;
|
||||||
if ( validateForm( form ) ) {
|
if ( validateForm( form ) ) {
|
||||||
submitForm( form );
|
submitForm( form );
|
||||||
|
@ -376,9 +376,9 @@ function saveChanges( element ) {
|
||||||
return( true );
|
return( true );
|
||||||
}
|
}
|
||||||
return( false );
|
return( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawZonePoints() {
|
function drawZonePoints() {
|
||||||
$('imageFrame').getElements( 'div.zonePoint' ).each( function( element ) { element.destroy(); } );
|
$('imageFrame').getElements( 'div.zonePoint' ).each( function( element ) { element.destroy(); } );
|
||||||
for ( var i = 0; i < zone['Points'].length; i++ ) {
|
for ( var i = 0; i < zone['Points'].length; i++ ) {
|
||||||
var div = new Element( 'div', { 'id': 'point'+i, 'class': 'zonePoint', 'title': 'Point '+(i+1), 'styles': { 'left': zone['Points'][i].x, 'top': zone['Points'][i].y } } );
|
var div = new Element( 'div', { 'id': 'point'+i, 'class': 'zonePoint', 'title': 'Point '+(i+1), 'styles': { 'left': zone['Points'][i].x, 'top': zone['Points'][i].y } } );
|
||||||
|
@ -424,16 +424,16 @@ function drawZonePoints() {
|
||||||
}
|
}
|
||||||
// Sets up the SVG polygon
|
// Sets up the SVG polygon
|
||||||
updateZoneImage();
|
updateZoneImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Imported from watch.js and modified for new zone edit view
|
// Imported from watch.js and modified for new zone edit view
|
||||||
//
|
//
|
||||||
|
|
||||||
var alarmState = STATE_IDLE;
|
var alarmState = STATE_IDLE;
|
||||||
var lastAlarmState = STATE_IDLE;
|
var lastAlarmState = STATE_IDLE;
|
||||||
|
|
||||||
function setAlarmState( currentAlarmState ) {
|
function setAlarmState( currentAlarmState ) {
|
||||||
alarmState = currentAlarmState;
|
alarmState = currentAlarmState;
|
||||||
|
|
||||||
var stateString = "Unknown";
|
var stateString = "Unknown";
|
||||||
|
@ -477,15 +477,15 @@ function setAlarmState( currentAlarmState ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastAlarmState = alarmState;
|
lastAlarmState = alarmState;
|
||||||
}
|
}
|
||||||
|
|
||||||
var streamCmdParms = "view=request&request=stream&connkey="+connKey;
|
var streamCmdParms = "view=request&request=stream&connkey="+connKey;
|
||||||
var streamCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStreamCmdResponse } );
|
var streamCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStreamCmdResponse } );
|
||||||
var streamCmdTimer = null;
|
var streamCmdTimer = null;
|
||||||
|
|
||||||
var streamStatus;
|
var streamStatus;
|
||||||
|
|
||||||
function getStreamCmdResponse( respObj, respText ) {
|
function getStreamCmdResponse( respObj, respText ) {
|
||||||
watchdogOk("stream");
|
watchdogOk("stream");
|
||||||
if ( streamCmdTimer )
|
if ( streamCmdTimer )
|
||||||
streamCmdTimer = clearTimeout( streamCmdTimer );
|
streamCmdTimer = clearTimeout( streamCmdTimer );
|
||||||
|
@ -516,11 +516,11 @@ function getStreamCmdResponse( respObj, respText ) {
|
||||||
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
|
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
|
||||||
streamCmdTimeout = streamCmdTimeout/5;
|
streamCmdTimeout = streamCmdTimeout/5;
|
||||||
streamCmdTimer = streamCmdQuery.delay( streamCmdTimeout );
|
streamCmdTimer = streamCmdQuery.delay( streamCmdTimeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
var streamPause = false;
|
var streamPause = false;
|
||||||
|
|
||||||
function streamCmdPauseToggle() {
|
function streamCmdPauseToggle() {
|
||||||
if ( streamPause == true ) {
|
if ( streamPause == true ) {
|
||||||
streamCmdPlay( true );
|
streamCmdPlay( true );
|
||||||
streamPause = false;
|
streamPause = false;
|
||||||
|
@ -530,33 +530,33 @@ function streamCmdPauseToggle() {
|
||||||
streamPause = true;
|
streamPause = true;
|
||||||
document.getElementById("pauseBtn").value = playString;
|
document.getElementById("pauseBtn").value = playString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function streamCmdPause( action ) {
|
function streamCmdPause( action ) {
|
||||||
if ( action )
|
if ( action )
|
||||||
streamCmdReq.send( streamCmdParms+"&command="+CMD_PAUSE );
|
streamCmdReq.send( streamCmdParms+"&command="+CMD_PAUSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
function streamCmdPlay( action )
|
function streamCmdPlay( action )
|
||||||
{
|
{
|
||||||
if ( action )
|
if ( action )
|
||||||
streamCmdReq.send( streamCmdParms+"&command="+CMD_PLAY );
|
streamCmdReq.send( streamCmdParms+"&command="+CMD_PLAY );
|
||||||
}
|
}
|
||||||
|
|
||||||
function streamCmdStop( action ) {
|
function streamCmdStop( action ) {
|
||||||
if ( action )
|
if ( action )
|
||||||
streamCmdReq.send( streamCmdParms+"&command="+CMD_STOP );
|
streamCmdReq.send( streamCmdParms+"&command="+CMD_STOP );
|
||||||
}
|
}
|
||||||
|
|
||||||
function streamCmdQuery() {
|
function streamCmdQuery() {
|
||||||
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUERY );
|
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUERY );
|
||||||
}
|
}
|
||||||
|
|
||||||
var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate";
|
var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate";
|
||||||
var statusCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'post', data: statusCmdParms, timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStatusCmdResponse } );
|
var statusCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'post', data: statusCmdParms, timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStatusCmdResponse } );
|
||||||
var statusCmdTimer = null;
|
var statusCmdTimer = null;
|
||||||
|
|
||||||
function getStatusCmdResponse( respObj, respText ) {
|
function getStatusCmdResponse( respObj, respText ) {
|
||||||
watchdogOk("status");
|
watchdogOk("status");
|
||||||
if ( statusCmdTimer )
|
if ( statusCmdTimer )
|
||||||
statusCmdTimer = clearTimeout( statusCmdTimer );
|
statusCmdTimer = clearTimeout( statusCmdTimer );
|
||||||
|
@ -573,17 +573,17 @@ function getStatusCmdResponse( respObj, respText ) {
|
||||||
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
|
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
|
||||||
statusCmdTimeout = statusCmdTimeout/5;
|
statusCmdTimeout = statusCmdTimeout/5;
|
||||||
statusCmdTimer = statusCmdQuery.delay( statusCmdTimeout );
|
statusCmdTimer = statusCmdQuery.delay( statusCmdTimeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusCmdQuery() {
|
function statusCmdQuery() {
|
||||||
statusCmdReq.send();
|
statusCmdReq.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchImage( streamImage ) {
|
function fetchImage( streamImage ) {
|
||||||
streamImage.src = streamImage.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
|
streamImage.src = streamImage.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
function appletRefresh() {
|
function appletRefresh() {
|
||||||
if ( streamStatus && (!streamStatus.paused && !streamStatus.delayed) ) {
|
if ( streamStatus && (!streamStatus.paused && !streamStatus.delayed) ) {
|
||||||
var streamImg = $('liveStream');
|
var streamImg = $('liveStream');
|
||||||
var parent = streamImg.getParent();
|
var parent = streamImg.getParent();
|
||||||
|
@ -594,20 +594,20 @@ function appletRefresh() {
|
||||||
} else {
|
} else {
|
||||||
appletRefresh.delay( 15*1000 ); //if we are paused or delayed check every 15 seconds if we are live yet...
|
appletRefresh.delay( 15*1000 ); //if we are paused or delayed check every 15 seconds if we are live yet...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var watchdogInactive = {
|
var watchdogInactive = {
|
||||||
'stream': false,
|
'stream': false,
|
||||||
'status': false
|
'status': false
|
||||||
};
|
};
|
||||||
|
|
||||||
var watchdogFunctions = {
|
var watchdogFunctions = {
|
||||||
'stream': streamCmdQuery,
|
'stream': streamCmdQuery,
|
||||||
'status': statusCmdQuery
|
'status': statusCmdQuery
|
||||||
};
|
};
|
||||||
|
|
||||||
//Make sure the various refreshes are still taking effect
|
//Make sure the various refreshes are still taking effect
|
||||||
function watchdogCheck( type ) {
|
function watchdogCheck( type ) {
|
||||||
if ( watchdogInactive[type] ) {
|
if ( watchdogInactive[type] ) {
|
||||||
console.log( "Detected streamWatch of type: " + type + " stopped, restarting" );
|
console.log( "Detected streamWatch of type: " + type + " stopped, restarting" );
|
||||||
watchdogFunctions[type]();
|
watchdogFunctions[type]();
|
||||||
|
@ -615,13 +615,13 @@ function watchdogCheck( type ) {
|
||||||
} else {
|
} else {
|
||||||
watchdogInactive[type] = true;
|
watchdogInactive[type] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function watchdogOk( type ) {
|
function watchdogOk( type ) {
|
||||||
watchdogInactive[type] = false;
|
watchdogInactive[type] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function initPage() {
|
function initPage() {
|
||||||
var form = document.zoneForm;
|
var form = document.zoneForm;
|
||||||
|
|
||||||
//form.elements['newZone[Name]'].disabled = true;
|
//form.elements['newZone[Name]'].disabled = true;
|
||||||
|
@ -655,9 +655,9 @@ function initPage() {
|
||||||
applyCheckMethod();
|
applyCheckMethod();
|
||||||
drawZonePoints();
|
drawZonePoints();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Imported from watch.js and modified for new zone edit view
|
// Imported from watch.js and modified for new zone edit view
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( streamMode == "single" ) {
|
if ( streamMode == "single" ) {
|
||||||
statusCmdTimer = statusCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
|
statusCmdTimer = statusCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
|
||||||
|
@ -679,9 +679,9 @@ function initPage() {
|
||||||
|
|
||||||
if ( refreshApplet && appletRefreshTime )
|
if ( refreshApplet && appletRefreshTime )
|
||||||
appletRefresh.delay( appletRefreshTime*1000 );
|
appletRefresh.delay( appletRefreshTime*1000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
function Polygon_calcArea( coords ) {
|
function Polygon_calcArea( coords ) {
|
||||||
var n_coords = coords.length;
|
var n_coords = coords.length;
|
||||||
var float_area = 0.0;
|
var float_area = 0.0;
|
||||||
|
|
||||||
|
@ -691,6 +691,6 @@ function Polygon_calcArea( coords ) {
|
||||||
//printf( "%.2f (%.2f)\n", float_area, trap_area );
|
//printf( "%.2f (%.2f)\n", float_area, trap_area );
|
||||||
}
|
}
|
||||||
return Math.round( Math.abs( float_area ) );
|
return Math.round( Math.abs( float_area ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEvent( 'domready', initPage );
|
window.addEvent( 'domready', initPage );
|
||||||
|
|
Loading…
Reference in New Issue