fix lint, remove debug

pull/2759/head
Isaac Connor 2019-11-19 11:37:45 -05:00
parent e4c23c3100
commit 207e5918c8
3 changed files with 83 additions and 90 deletions

View File

@ -181,7 +181,6 @@ window.addEventListener("DOMContentLoaded", function onSkinDCL() {
console.error("Nothing found to bind to " + fnName);
return;
}
console.log('Setting onlick to ' + fnName + ' for ' + el.name);
el.onclick = function() {
window[fnName]();
};
@ -194,7 +193,6 @@ window.addEventListener("DOMContentLoaded", function onSkinDCL() {
console.error("Nothing found to bind to " + fnName);
return;
}
console.log('Setting onclick-true to ' + fnName + ' for ' + el.name);
el.onclick = function() {
window[fnName](true);
};
@ -207,7 +205,6 @@ window.addEventListener("DOMContentLoaded", function onSkinDCL() {
console.error("Nothing found to bind to " + fnName);
return;
}
console.log('Setting onchange-this to ' + fnName + ' for ' + el.name);
el.onchange = window[fnName].bind(el, el);
});
@ -218,7 +215,6 @@ window.addEventListener("DOMContentLoaded", function onSkinDCL() {
console.error("Nothing found to bind to " + fnName);
return;
}
console.log('Setting onchange to ' + fnName + ' for ' + el.name);
el.onchange = window[fnName];
});
@ -229,7 +225,6 @@ window.addEventListener("DOMContentLoaded", function onSkinDCL() {
console.error("Nothing found to bind to " + fnName);
return;
}
console.log('Setting oninput to ' + fnName + ' for ' + el.name);
el.oninput = window[fnName];
});
@ -240,7 +235,6 @@ window.addEventListener("DOMContentLoaded", function onSkinDCL() {
console.error("Nothing found to bind to " + fnName);
return;
}
console.log('Setting oninput-this to ' + fnName + ' for ' + el.name);
el.onchange = window[fnName].bind(el, el);
});
});

View File

@ -26,8 +26,9 @@ function changeScale() {
}
Cookie.write( 'zmWatchScale', scale, {duration: 10*365} );
$j.each(controlsLinks, function(k, anchor) { //Make frames respect scale choices
if ( anchor )
if ( anchor ) {
anchor.prop('href', anchor.prop('href').replace(/scale=.*&/, 'scale=' + scale + '&'));
}
});
}

View File

@ -213,10 +213,10 @@ function applyZoneUnits() {
function limitRange(field, minValue, maxValue) {
if ( field.value != '' ) {
field.value = constrainValue(
parseInt(field.value),
parseInt(minValue),
parseInt(maxValue)
);
parseInt(field.value),
parseInt(minValue),
parseInt(maxValue)
);
}
}
@ -393,9 +393,9 @@ function saveChanges(element) {
function drawZonePoints() {
$('imageFrame').getElements('div.zonePoint').each(
function(element) {
element.destroy();
});
function(element) {
element.destroy();
});
for ( var i = 0; i < zone['Points'].length; i++ ) {
var div = new Element('div', {
'id': 'point'+i,
@ -423,31 +423,31 @@ function drawZonePoints() {
} );
for ( var i = 0; i < zone['Points'].length; i++ ) {
var row;
row = new Element('tr', {'id': 'row'+i});
row.addEvents({'mouseover': highlightOn.pass(i), 'mouseout': highlightOff.pass(i)});
var row;
row = new Element('tr', {'id': 'row'+i});
row.addEvents({'mouseover': highlightOn.pass(i), 'mouseout': highlightOff.pass(i)});
var cell = new Element('td');
cell.set('text', i+1);
cell.inject(row);
cell = new Element('td');
var input = new Element('input', {
'id': 'newZone[Points]['+i+'][x]',
'name': 'newZone[Points]['+i+'][x]',
'value': zone['Points'][i].x,
'size': 5
});
'id': 'newZone[Points]['+i+'][x]',
'name': 'newZone[Points]['+i+'][x]',
'value': zone['Points'][i].x,
'size': 5
});
input.addEvent('input', updateX.pass(i));
input.inject(cell);
cell.inject(row);
cell = new Element('td');
input = new Element('input', {
'id': 'newZone[Points]['+i+'][y]',
'name': 'newZone[Points]['+i+'][y]',
'value': zone['Points'][i].y,
'size': 5
} );
'id': 'newZone[Points]['+i+'][y]',
'name': 'newZone[Points]['+i+'][y]',
'value': zone['Points'][i].y,
'size': 5
} );
input.addEvent('input', updateY.pass(i));
input.inject(cell);
cell.inject(row);
@ -467,7 +467,7 @@ function drawZonePoints() {
}
cell.inject(row);
row.inject(tables[i%tables.length].getElement('tbody'));
row.inject(tables[i%tables.length].getElement('tbody'));
}
// Sets up the SVG polygon
updateZoneImage();
@ -703,58 +703,56 @@ function initPage() {
//form.elements['newZone[Type]'].disabled = true;
form.presetSelector.disabled = true;
//form.elements['newZone[Units]'].disabled = true;
if ( CheckMethod = form.elements['newZone[CheckMethod]'] ) {
CheckMethod.disabled = true;
CheckMethod.onchange = window['applyCheckMethod'].bind(CheckMethod, CheckMethod);
}
[
'newZone[MinPixelThreshold]',
'newZone[MaxPixelThreshold]',
'newAlarmRgbR',
'newAlarmRgbG',
'newAlarmRgbB',
].forEach(
function(element_name, index) {
var el = form.elements[element_name];
if ( el ) {
el.oninput = window['limitRangeToUnsignedByte'].bind(el, el);
el.disabled = true;
} else {
console.error("Element " + element_name + " not found in zone edit form");
}
});
[
'newZone[FilterX]',
'newZone[FilterY]'
].forEach(
function(element_name, index) {
var el = form.elements[element_name];
if ( el ) {
el.oninput = window['limitFilter'].bind(el, el);
el.disabled = true;
} else {
console.error("Element " + element_name + " not found in zone edit form");
}
}
);
[
'newZone[MinAlarmPixels]',
'newZone[MaxAlarmPixels]',
'newZone[MinFilterPixels]',
'newZone[MaxFilterPixels]'
].forEach(
function(element_name, index) {
var el = form.elements[element_name];
if ( el ) {
el.oninput = window['limitArea'].bind(el, el);
el.disabled = true;
} else {
console.error("Element " + element_name + " not found in zone edit form");
}
}
);
if ( CheckMethod = form.elements['newZone[CheckMethod]'] ) {
CheckMethod.disabled = true;
CheckMethod.onchange = window['applyCheckMethod'].bind(CheckMethod, CheckMethod);
}
[
'newZone[MinPixelThreshold]',
'newZone[MaxPixelThreshold]',
'newAlarmRgbR',
'newAlarmRgbG',
'newAlarmRgbB',
].forEach(
function(element_name, index) {
var el = form.elements[element_name];
if ( el ) {
el.oninput = window['limitRangeToUnsignedByte'].bind(el, el);
el.disabled = true;
} else {
console.error("Element " + element_name + " not found in zone edit form");
}
});
[
'newZone[FilterX]',
'newZone[FilterY]'
].forEach(
function(element_name, index) {
var el = form.elements[element_name];
if ( el ) {
el.oninput = window['limitFilter'].bind(el, el);
el.disabled = true;
} else {
console.error("Element " + element_name + " not found in zone edit form");
}
}
);
[
'newZone[MinAlarmPixels]',
'newZone[MaxAlarmPixels]',
'newZone[MinFilterPixels]',
'newZone[MaxFilterPixels]'
].forEach(function(element_name, index) {
var el = form.elements[element_name];
if ( el ) {
el.oninput = window['limitArea'].bind(el, el);
el.disabled = true;
} else {
console.error("Element " + element_name + " not found in zone edit form");
}
}
);
form.elements['newZone[MinBlobPixels]'].disabled = true;
form.elements['newZone[MaxBlobPixels]'].disabled = true;
@ -771,18 +769,18 @@ function initPage() {
applyCheckMethod();
drawZonePoints();
$('pauseBtn').onclick = function() {
streamCmdPauseToggle();
$('pauseBtn').onclick = function() {
streamCmdPauseToggle();
};
if ( el = $('saveBtn') ) {
el.onclick = window['saveChanges'].bind(el, el);
}
if ( el = $('cancelBtn') ) {
el.onclick = function() {
refreshParentWindow();
closeWindow();
};
if ( el = $('saveBtn') ) {
el.onclick = window['saveChanges'].bind(el, el);
}
if ( el = $('cancelBtn') ) {
el.onclick = function() {
refreshParentWindow();
closeWindow();
}
}
}
//
// Imported from watch.js and modified for new zone edit view