fix whitespace

This commit is contained in:
Isaac Connor 2017-05-18 14:06:13 -04:00
parent e15fdf9ac3
commit 8b0f319834
1 changed files with 445 additions and 445 deletions

View File

@ -321,14 +321,14 @@ function delPoint( index ) {
<<<<<<< HEAD
function limitPointValue( point, loVal, hiVal ) {
=======
function limitPointValue( point, loVal, hiVal )
{
>>>>>>> master
=======
function limitPointValue( point, loVal, hiVal )
{
>>>>>>> master
point.value = constrainValue(point.value, loVal, hiVal);
}
}
function updateArea( ) {
function updateArea( ) {
area = Polygon_calcArea( zone['Points'] );
zone.Area = area;
var form = $('zoneForm');
@ -340,9 +340,9 @@ function updateArea( ) {
} else {
alert("Unknown units: " + form.elements['newZone[Units]'].value );
}
}
}
function updateX( index ) {
function updateX( index ) {
limitPointValue( $('newZone[Points]['+index+'][x]'), 0, maxX );
var point = $('point'+index);
@ -352,9 +352,9 @@ function updateX( index ) {
zone['Points'][index].x = x;
var Point = $('zonePoly').points.getItem(index);
Point.x = x;
}
}
function updateY( index ) {
function updateY( index ) {
limitPointValue( $('newZone[Points]['+index+'][y]'), 0, maxY );
var point = $('point'+index);
@ -364,9 +364,9 @@ function updateY( index ) {
zone['Points'][index].y = y;
var Point = $('zonePoly').points.getItem(index);
Point.y = y;
}
}
function saveChanges( element ) {
function saveChanges( element ) {
var form = element.form;
if ( validateForm( form ) ) {
submitForm( form );
@ -376,9 +376,9 @@ function saveChanges( element ) {
return( true );
}
return( false );
}
}
function drawZonePoints() {
function drawZonePoints() {
$('imageFrame').getElements( 'div.zonePoint' ).each( function( element ) { element.destroy(); } );
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 } } );
@ -424,16 +424,16 @@ function drawZonePoints() {
}
// Sets up the SVG polygon
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 lastAlarmState = STATE_IDLE;
var alarmState = STATE_IDLE;
var lastAlarmState = STATE_IDLE;
function setAlarmState( currentAlarmState ) {
function setAlarmState( currentAlarmState ) {
alarmState = currentAlarmState;
var stateString = "Unknown";
@ -477,15 +477,15 @@ function setAlarmState( currentAlarmState ) {
}
}
lastAlarmState = alarmState;
}
}
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 streamCmdTimer = null;
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 streamCmdTimer = null;
var streamStatus;
var streamStatus;
function getStreamCmdResponse( respObj, respText ) {
function getStreamCmdResponse( respObj, respText ) {
watchdogOk("stream");
if ( streamCmdTimer )
streamCmdTimer = clearTimeout( streamCmdTimer );
@ -516,11 +516,11 @@ function getStreamCmdResponse( respObj, respText ) {
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
streamCmdTimeout = streamCmdTimeout/5;
streamCmdTimer = streamCmdQuery.delay( streamCmdTimeout );
}
}
var streamPause = false;
var streamPause = false;
function streamCmdPauseToggle() {
function streamCmdPauseToggle() {
if ( streamPause == true ) {
streamCmdPlay( true );
streamPause = false;
@ -530,33 +530,33 @@ function streamCmdPauseToggle() {
streamPause = true;
document.getElementById("pauseBtn").value = playString;
}
}
}
function streamCmdPause( action ) {
function streamCmdPause( action ) {
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_PAUSE );
}
}
function streamCmdPlay( action )
{
function streamCmdPlay( action )
{
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_PLAY );
}
}
function streamCmdStop( action ) {
function streamCmdStop( action ) {
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_STOP );
}
}
function streamCmdQuery() {
function streamCmdQuery() {
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUERY );
}
}
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 statusCmdTimer = null;
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 statusCmdTimer = null;
function getStatusCmdResponse( respObj, respText ) {
function getStatusCmdResponse( respObj, respText ) {
watchdogOk("status");
if ( statusCmdTimer )
statusCmdTimer = clearTimeout( statusCmdTimer );
@ -573,17 +573,17 @@ function getStatusCmdResponse( respObj, respText ) {
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
statusCmdTimeout = statusCmdTimeout/5;
statusCmdTimer = statusCmdQuery.delay( statusCmdTimeout );
}
}
function statusCmdQuery() {
function statusCmdQuery() {
statusCmdReq.send();
}
}
function fetchImage( streamImage ) {
function fetchImage( streamImage ) {
streamImage.src = streamImage.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
}
}
function appletRefresh() {
function appletRefresh() {
if ( streamStatus && (!streamStatus.paused && !streamStatus.delayed) ) {
var streamImg = $('liveStream');
var parent = streamImg.getParent();
@ -594,20 +594,20 @@ function appletRefresh() {
} else {
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,
'status': false
};
};
var watchdogFunctions = {
var watchdogFunctions = {
'stream': streamCmdQuery,
'status': statusCmdQuery
};
};
//Make sure the various refreshes are still taking effect
function watchdogCheck( type ) {
//Make sure the various refreshes are still taking effect
function watchdogCheck( type ) {
if ( watchdogInactive[type] ) {
console.log( "Detected streamWatch of type: " + type + " stopped, restarting" );
watchdogFunctions[type]();
@ -615,13 +615,13 @@ function watchdogCheck( type ) {
} else {
watchdogInactive[type] = true;
}
}
}
function watchdogOk( type ) {
function watchdogOk( type ) {
watchdogInactive[type] = false;
}
}
function initPage() {
function initPage() {
var form = document.zoneForm;
//form.elements['newZone[Name]'].disabled = true;
@ -655,9 +655,9 @@ function initPage() {
applyCheckMethod();
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" ) {
statusCmdTimer = statusCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
@ -679,9 +679,9 @@ function initPage() {
if ( refreshApplet && appletRefreshTime )
appletRefresh.delay( appletRefreshTime*1000 );
}
}
function Polygon_calcArea( coords ) {
function Polygon_calcArea( coords ) {
var n_coords = coords.length;
var float_area = 0.0;
@ -691,6 +691,6 @@ function Polygon_calcArea( coords ) {
//printf( "%.2f (%.2f)\n", float_area, trap_area );
}
return Math.round( Math.abs( float_area ) );
}
}
window.addEvent( 'domready', initPage );
window.addEvent( 'domready', initPage );