Add eslint configuration files extending Google's rules
This commit is contained in:
parent
c24853ad11
commit
c7955cd1b6
|
@ -0,0 +1,4 @@
|
|||
web/api/lib
|
||||
web/skins/classic/js/jquery-1.11.3.js
|
||||
web/skins/classic/js/jquery.js
|
||||
web/tools/mootools
|
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"env": {
|
||||
"browser": true,
|
||||
},
|
||||
"extends": ["google"],
|
||||
"rules": {
|
||||
"brace-style": "off",
|
||||
"camelcase": "off",
|
||||
"comma-dangle": "off",
|
||||
"key-spacing": "off",
|
||||
"max-len": "off",
|
||||
"new-cap": ["error", {
|
||||
capIsNewExceptions: ["Error", "Warning", "Debug", "Polygon_calcArea", "Play", "Stop"],
|
||||
newIsCapExceptionPattern: "^Asset\.."
|
||||
}],
|
||||
"no-array-constructor": "off",
|
||||
"no-caller": "off",
|
||||
"no-new-object": "off",
|
||||
"no-unused-vars": "off",
|
||||
"no-var": "off",
|
||||
"object-curly-spacing": "off",
|
||||
"prefer-rest-params": "off",
|
||||
"quotes": "off",
|
||||
"require-jsdoc": "off",
|
||||
"spaced-comment": "off",
|
||||
},
|
||||
};
|
|
@ -115,4 +115,4 @@ window.onerror =
|
|||
function( message, url, line )
|
||||
{
|
||||
logReport( "ERR", message, url, line );
|
||||
}
|
||||
};
|
||||
|
|
|
@ -116,7 +116,7 @@ function setupOverlays()
|
|||
overlay.getElements('.overlayCloser').each(
|
||||
function( closer )
|
||||
{
|
||||
closer.addEvent( 'click', function() { overlay.element.hide(); } )
|
||||
closer.addEvent( 'click', function() { overlay.element.hide(); } );
|
||||
}
|
||||
);
|
||||
overlay.overlayShow = function() { overlay.element.show(); };
|
||||
|
|
|
@ -33,7 +33,7 @@ var popupSizes = {
|
|||
'device': { 'width': 260, 'height': 150 },
|
||||
'devices': { 'width': 400, 'height': 240 },
|
||||
'donate': { 'width': 500, 'height': 280 },
|
||||
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, minHeight: 540 },
|
||||
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
|
||||
'eventdetail': { 'width': 600, 'height': 220 },
|
||||
'events': { 'width': 960, 'height': 780 },
|
||||
'export': { 'width': 400, 'height': 340 },
|
||||
|
|
|
@ -33,7 +33,7 @@ var popupSizes = {
|
|||
'device': { 'width': 260, 'height': 150 },
|
||||
'devices': { 'width': 400, 'height': 240 },
|
||||
'donate': { 'width': 500, 'height': 280 },
|
||||
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, minHeight: 540 },
|
||||
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
|
||||
'eventdetail': { 'width': 600, 'height': 220 },
|
||||
'events': { 'width': 960, 'height': 780 },
|
||||
'export': { 'width': 400, 'height': 340 },
|
||||
|
|
|
@ -33,7 +33,7 @@ var popupSizes = {
|
|||
'device': { 'width': 260, 'height': 150 },
|
||||
'devices': { 'width': 400, 'height': 240 },
|
||||
'donate': { 'width': 500, 'height': 280 },
|
||||
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, minHeight: 540 },
|
||||
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
|
||||
'eventdetail': { 'width': 600, 'height': 220 },
|
||||
'events': { 'width': 1080, 'height': 780 },
|
||||
'export': { 'width': 400, 'height': 340 },
|
||||
|
|
|
@ -35,7 +35,7 @@ function checkSize() {
|
|||
if (w > screen.availWidth)
|
||||
w = screen.availWidth;
|
||||
if (w != prevW || h != prevH)
|
||||
window.resizeTo(w,h);
|
||||
window.resizeTo(w, h);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ function setButtonStates( element )
|
|||
|
||||
function addMonitor( element)
|
||||
{
|
||||
|
||||
var form = element.form;
|
||||
var dupParam;
|
||||
var monitorId=-1;
|
||||
|
@ -45,7 +44,7 @@ function addMonitor( element)
|
|||
}
|
||||
}
|
||||
dupParam = (monitorId == -1 ) ? '': '&dupId='+monitorId;
|
||||
createPopup( '?view=monitor'+dupParam, 'zmMonitor0','monitor' );
|
||||
createPopup( '?view=monitor'+dupParam, 'zmMonitor0', 'monitor' );
|
||||
}
|
||||
|
||||
function editMonitor( element )
|
||||
|
|
|
@ -19,6 +19,5 @@ function validateForm( form ) {
|
|||
return( false );
|
||||
}
|
||||
return( true );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ function changeReplayMode()
|
|||
{
|
||||
var replayMode = $('replayMode').get('value');
|
||||
|
||||
Cookie.write( 'replayMode', replayMode, { duration: 10*365 })
|
||||
Cookie.write( 'replayMode', replayMode, { duration: 10*365 });
|
||||
|
||||
refreshWindow();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ var lastEventId = 0;
|
|||
|
||||
function getCmdResponse( respObj, respText )
|
||||
{
|
||||
if ( checkStreamForErrors( "getCmdResponse" ,respObj ) )
|
||||
if ( checkStreamForErrors( "getCmdResponse", respObj ) )
|
||||
return;
|
||||
|
||||
if ( streamCmdTimer )
|
||||
|
@ -477,7 +477,7 @@ function checkFrames( eventId, frameId, loadImage )
|
|||
if ( !$('eventThumb'+fid) )
|
||||
{
|
||||
var img = new Element( 'img', { 'id': 'eventThumb'+fid, 'src': 'graphics/transparent.gif', 'alt': fid, 'class': 'placeholder' } );
|
||||
img.addEvent( 'click', function () { eventData['frames'][fid] = null; checkFrames( eventId, fid ) } );
|
||||
img.addEvent( 'click', function() { eventData['frames'][fid] = null; checkFrames( eventId, fid ); } );
|
||||
frameQuery( eventId, fid, loadImage && (fid == frameId) );
|
||||
var imgs = $('eventThumbs').getElements( 'img' );
|
||||
var injected = false;
|
||||
|
@ -689,7 +689,7 @@ function drawProgressBar()
|
|||
var offset = parseInt((index*eventData.Length)/$$(cells).length);
|
||||
$(cell).setProperty( 'title', '+'+secsToTime(offset)+'s' );
|
||||
$(cell).removeEvent( 'click' );
|
||||
$(cell).addEvent( 'click', function(){ streamSeek( offset ); } );
|
||||
$(cell).addEvent( 'click', function() { streamSeek( offset ); } );
|
||||
barWidth += $(cell).getCoordinates().width;
|
||||
}
|
||||
);
|
||||
|
|
|
@ -9,7 +9,6 @@ if ( refreshParent )
|
|||
}
|
||||
|
||||
function configureButtons( element ) {
|
||||
|
||||
if ( canEditGroups ) {
|
||||
var form = element.form;
|
||||
form.saveBtn.disabled = (element.value == 0);
|
||||
|
|
|
@ -22,7 +22,7 @@ var logTimeout = maxSampleTime;
|
|||
var firstLoad = true;
|
||||
var initialDisplayLimit = 200;
|
||||
var sortReversed = false;
|
||||
var filterFields = [ 'Component', 'ServerId', 'Pid', 'Level', 'File', 'Line'];
|
||||
var filterFields = ['Component', 'ServerId', 'Pid', 'Level', 'File', 'Line'];
|
||||
var options = {};
|
||||
|
||||
function buildFetchParms( parms )
|
||||
|
@ -68,7 +68,7 @@ function logResponse( respObj )
|
|||
maxLogTime = log.TimeKey;
|
||||
if ( !minLogTime || log.TimeKey < minLogTime )
|
||||
minLogTime = log.TimeKey;
|
||||
var row = logTable.push( [ { content: log.DateTime, properties: { style: 'white-space: nowrap' }}, log.Component, log.Server, log.Pid, log.Code, log.Message, log.File, log.Line ] );
|
||||
var row = logTable.push( [{ content: log.DateTime, properties: { style: 'white-space: nowrap' }}, log.Component, log.Server, log.Pid, log.Code, log.Message, log.File, log.Line] );
|
||||
delete log.Message;
|
||||
row.tr.store( 'log', log );
|
||||
if ( log.Level <= -3 )
|
||||
|
@ -81,7 +81,7 @@ function logResponse( respObj )
|
|||
row.tr.addClass( 'log-dbg' );
|
||||
if ( !firstLoad )
|
||||
{
|
||||
var color = document.defaultView.getComputedStyle(row.tr,null).getPropertyValue('color');
|
||||
var color = document.defaultView.getComputedStyle(row.tr, null).getPropertyValue('color');
|
||||
var colorParts = color.match(/^rgb.*\((\d+),\s*(\d+),\s*(\d+)/);
|
||||
rowOrigColor = '#' + parseInt(colorParts[1]).toString(16) + parseInt(colorParts[2]).toString(16) + parseInt(colorParts[3]).toString(16);
|
||||
new Fx.Tween( row.tr, { duration: 10000, transition: Fx.Transitions.Sine } ).start( 'color', '#6495ED', rowOrigColor );
|
||||
|
@ -90,15 +90,15 @@ function logResponse( respObj )
|
|||
);
|
||||
options = respObj.options;
|
||||
updateFilterSelectors();
|
||||
$('lastUpdate').set('text',respObj.updated);
|
||||
$('logState').set('text',respObj.state);
|
||||
$('lastUpdate').set('text', respObj.updated);
|
||||
$('logState').set('text', respObj.state);
|
||||
$('logState').removeClass('ok');
|
||||
$('logState').removeClass('alert');
|
||||
$('logState').removeClass('alarm');
|
||||
$('logState').addClass(respObj.state);
|
||||
$('totalLogs').set('text',respObj.total);
|
||||
$('availLogs').set('text',respObj.available);
|
||||
$('displayLogs').set('text',logCount);
|
||||
$('totalLogs').set('text', respObj.total);
|
||||
$('availLogs').set('text', respObj.available);
|
||||
$('displayLogs').set('text', logCount);
|
||||
if ( firstLoad )
|
||||
{
|
||||
if ( logCount < displayLimit )
|
||||
|
@ -151,7 +151,7 @@ function clearLog()
|
|||
logCount = 0;
|
||||
logTimeout = maxSampleTime;
|
||||
displayLimit = initialDisplayLimit;
|
||||
$('displayLogs').set('text',logCount);
|
||||
$('displayLogs').set('text', logCount);
|
||||
options = {};
|
||||
logTable.empty();
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ function updateFilterSelectors()
|
|||
);
|
||||
}
|
||||
if ( filter[key] )
|
||||
selector.set('value',filter[key]);
|
||||
selector.set('value', filter[key]);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -315,13 +315,13 @@ function initPage()
|
|||
if ( sortReversed )
|
||||
startIndex = displayLimit;
|
||||
else
|
||||
startIndex = 0;;
|
||||
startIndex = 0;
|
||||
for ( var i = startIndex; logCount > displayLimit; i++ )
|
||||
{
|
||||
rows[i].destroy();
|
||||
logCount--;
|
||||
}
|
||||
$('displayLogs').set('text',logCount);
|
||||
$('displayLogs').set('text', logCount);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -15,7 +15,7 @@ function Monitor( index, monitorData )
|
|||
this.start = function( delay )
|
||||
{
|
||||
this.streamCmdTimer = this.streamCmdQuery.delay( delay, this );
|
||||
}
|
||||
};
|
||||
|
||||
this.setStateClass = function( element, stateClass )
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ function Monitor( index, monitorData )
|
|||
element.removeClass( 'idle' );
|
||||
element.addClass( stateClass );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.getStreamCmdResponse = function( respObj, respText )
|
||||
{
|
||||
|
@ -93,15 +93,14 @@ function Monitor( index, monitorData )
|
|||
console.error( respObj.message );
|
||||
// Try to reload the image stream.
|
||||
if ( stream )
|
||||
stream.src = stream.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
|
||||
stream.src = stream.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
}
|
||||
var streamCmdTimeout = statusRefreshTimeout;
|
||||
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 )
|
||||
{
|
||||
|
@ -109,7 +108,7 @@ function Monitor( index, monitorData )
|
|||
//console.log( this.connKey+": Resending" );
|
||||
//this.streamCmdReq.cancel();
|
||||
this.streamCmdReq.send( this.streamCmdParms+"&command="+CMD_QUERY );
|
||||
}
|
||||
};
|
||||
|
||||
this.streamCmdReq = new Request.JSON( { url: this.server_url, method: 'get', timeout: AJAX_TIMEOUT, onSuccess: this.getStreamCmdResponse.bind( this ), onTimeout: this.streamCmdQuery.bind( this, true ), link: 'cancel' } );
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
function checkState( element )
|
||||
{
|
||||
|
||||
var form = element.form;
|
||||
|
||||
var minIndex = running?2:1;
|
||||
|
@ -25,7 +24,6 @@ function checkState( element )
|
|||
form.saveBtn.disabled = false;
|
||||
form.deleteBtn.disabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function saveState( element )
|
||||
|
|
|
@ -114,10 +114,10 @@ function loadEventImage( imagePath, eid, fid, width, height )
|
|||
var imageSrc = $('imageSrc');
|
||||
imageSrc.setProperty( 'src', imagePrefix+imagePath );
|
||||
imageSrc.removeEvent( 'click' );
|
||||
imageSrc.addEvent( 'click', showEvent.pass( [ eid, fid, width, height ] ) );
|
||||
imageSrc.addEvent( 'click', showEvent.pass( [eid, fid, width, height] ) );
|
||||
var eventData = $('eventData');
|
||||
eventData.removeEvent( 'click' );
|
||||
eventData.addEvent( 'click', showEvent.pass( [ eid, fid, width, height ] ) );
|
||||
eventData.addEvent( 'click', showEvent.pass( [eid, fid, width, height] ) );
|
||||
}
|
||||
|
||||
function tlZoomBounds( minTime, maxTime )
|
||||
|
|
|
@ -40,7 +40,7 @@ function changeScale()
|
|||
streamImg.style.width = newWidth + "px";
|
||||
streamImg.style.height = newHeight + "px";
|
||||
|
||||
streamImg.src = streamImg.src.replace(/scale=\d+/i,'scale='+scale);
|
||||
streamImg.src = streamImg.src.replace(/scale=\d+/i, 'scale='+scale);
|
||||
} else {
|
||||
console.error("No element found for liveStream.");
|
||||
}
|
||||
|
@ -210,11 +210,11 @@ function getStreamCmdResponse( respObj, respText )
|
|||
}
|
||||
}
|
||||
else {
|
||||
checkStreamForErrors("getStreamCmdResponse",respObj);//log them
|
||||
checkStreamForErrors("getStreamCmdResponse", respObj);//log them
|
||||
// Try to reload the image stream.
|
||||
var streamImg = document.getElementById('liveStream');
|
||||
if ( streamImg )
|
||||
streamImg.src = streamImg.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
streamImg.src = streamImg.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
}
|
||||
|
||||
var streamCmdTimeout = statusRefreshTimeout;
|
||||
|
@ -372,7 +372,7 @@ function getStatusCmdResponse( respObj, respText )
|
|||
setAlarmState( respObj.monitor.Status );
|
||||
}
|
||||
else
|
||||
checkStreamForErrors("getStatusCmdResponse",respObj);
|
||||
checkStreamForErrors("getStatusCmdResponse", respObj);
|
||||
|
||||
var statusCmdTimeout = statusRefreshTimeout;
|
||||
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
|
||||
|
@ -391,7 +391,7 @@ var alarmCmdFirst = true;
|
|||
|
||||
function getAlarmCmdResponse( respObj, respText )
|
||||
{
|
||||
checkStreamForErrors("getAlarmCmdResponse",respObj);
|
||||
checkStreamForErrors("getAlarmCmdResponse", respObj);
|
||||
}
|
||||
|
||||
function cmdDisableAlarms()
|
||||
|
@ -477,26 +477,26 @@ function getEventCmdResponse( respObj, respText )
|
|||
|
||||
var cells = row.getElements( 'td' );
|
||||
|
||||
var link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [ event.Id, '&trms=1&attr1=MonitorId&op1=%3d&val1='+monitorId+'&page=1', event.Width, event.Height ] ) } });
|
||||
var link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [event.Id, '&trms=1&attr1=MonitorId&op1=%3d&val1='+monitorId+'&page=1', event.Width, event.Height] ) } });
|
||||
link.set( 'text', event.Id );
|
||||
link.inject( row.getElement( 'td.colId' ) );
|
||||
|
||||
link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [ event.Id, '&trms=1&attr1=MonitorId&op1=%3d&val1='+monitorId+'&page=1', event.Width, event.Height ] ) } });
|
||||
link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [event.Id, '&trms=1&attr1=MonitorId&op1=%3d&val1='+monitorId+'&page=1', event.Width, event.Height] ) } });
|
||||
link.set( 'text', event.Name );
|
||||
link.inject( row.getElement( 'td.colName' ) );
|
||||
|
||||
row.getElement( 'td.colTime' ).set( 'text', event.StartTime );
|
||||
row.getElement( 'td.colSecs' ).set( 'text', event.Length );
|
||||
|
||||
link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramesPopup.pass( [ event.Id, event.Width, event.Height ] ) } });
|
||||
link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramesPopup.pass( [event.Id, event.Width, event.Height] ) } });
|
||||
link.set( 'text', event.Frames+'/'+event.AlarmFrames );
|
||||
link.inject( row.getElement( 'td.colFrames' ) );
|
||||
|
||||
link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramePopup.pass( [ event.Id, '0', event.Width, event.Height ] ) } });
|
||||
link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramePopup.pass( [event.Id, '0', event.Width, event.Height] ) } });
|
||||
link.set( 'text', event.AvgScore+'/'+event.MaxScore );
|
||||
link.inject( row.getElement( 'td.colScore' ) );
|
||||
|
||||
link = new Element( 'a', { 'href': '#', 'title': deleteString, 'events': { 'click': function( e ) { deleteEvent( e, event.Id ); }.bind( link ), 'mouseover': highlightRow.pass( row ), 'mouseout': highlightRow.pass( row ) } });
|
||||
link = new Element( 'a', { 'href': '#', 'title': deleteString, 'events': { 'click': function( e ) { deleteEvent( e, event.Id ); }, 'mouseover': highlightRow.pass( row ), 'mouseout': highlightRow.pass( row ) } });
|
||||
link.set( 'text', 'X' );
|
||||
link.inject( row.getElement( 'td.colDelete' ) );
|
||||
|
||||
|
@ -537,7 +537,7 @@ function getEventCmdResponse( respObj, respText )
|
|||
}
|
||||
}
|
||||
else
|
||||
checkStreamForErrors("getEventCmdResponse",respObj);
|
||||
checkStreamForErrors("getEventCmdResponse", respObj);
|
||||
|
||||
var eventCmdTimeout = eventsRefreshTimeout;
|
||||
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
|
||||
|
|
|
@ -384,7 +384,7 @@ function delPoint( index )
|
|||
|
||||
function limitPointValue( point, loVal, hiVal )
|
||||
{
|
||||
point.value = constrainValue(point.value, loVal, hiVal)
|
||||
point.value = constrainValue(point.value, loVal, hiVal);
|
||||
}
|
||||
|
||||
function updateArea( ) {
|
||||
|
@ -393,7 +393,6 @@ function updateArea( ) {
|
|||
var form = $('zoneForm');
|
||||
form.elements['newZone[Area]'].value = area;
|
||||
if ( form.elements['newZone[Units]'].value == 'Percent' ) {
|
||||
|
||||
form.elements['newZone[TempArea]'].value = Math.round( area/monitorArea*100 );
|
||||
} else if ( form.elements['newZone[Units]'].value == 'Pixels' ) {
|
||||
form.elements['newZone[TempArea]'].value = area;
|
||||
|
@ -568,11 +567,11 @@ function getStreamCmdResponse( respObj, respText ) {
|
|||
streamCmdPlay( false );
|
||||
}
|
||||
} else {
|
||||
checkStreamForErrors("getStreamCmdResponse",respObj);//log them
|
||||
checkStreamForErrors("getStreamCmdResponse", respObj);//log them
|
||||
// Try to reload the image stream.
|
||||
var streamImg = document.getElementById('liveStream');
|
||||
if ( streamImg )
|
||||
streamImg.src = streamImg.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
streamImg.src = streamImg.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
}
|
||||
|
||||
var streamCmdTimeout = statusRefreshTimeout;
|
||||
|
@ -630,7 +629,7 @@ function getStatusCmdResponse( respObj, respText ) {
|
|||
setAlarmState( respObj.monitor.Status );
|
||||
}
|
||||
else
|
||||
checkStreamForErrors("getStatusCmdResponse",respObj);
|
||||
checkStreamForErrors("getStatusCmdResponse", respObj);
|
||||
|
||||
var statusCmdTimeout = statusRefreshTimeout;
|
||||
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
|
||||
|
|
Loading…
Reference in New Issue