diff --git a/web/skins/classic/js/skin.js b/web/skins/classic/js/skin.js index e4eed0597..ded2d8ca4 100644 --- a/web/skins/classic/js/skin.js +++ b/web/skins/classic/js/skin.js @@ -319,11 +319,11 @@ function convertLabelFormat(LabelFormat, monitorName){ function addVideoTimingTrack(video, LabelFormat, monitorName, duration, startTime){ //This is a hacky way to handle changing the texttrack. If we ever upgrade vjs in a revamp replace this. Old method preserved because it's the right way. - let cues = vid.textTracks()[0].cues(); - let labelFormat = convertLabelFormat(LabelFormat, monitorName); + var cues = vid.textTracks()[0].cues(); + var labelFormat = convertLabelFormat(LabelFormat, monitorName); startTime = moment(startTime); - for (let i = 0; i <= duration; i++) { + for (var i = 0; i <= duration; i++) { cues[i] = {id: i, index: i, startTime: i, Ca: i+1, text: startTime.format(labelFormat)}; startTime.add(1, 's'); } @@ -361,21 +361,21 @@ function endOfResize(e) { function scaleToFit (baseWidth, baseHeight, scaleEl, bottomEl) { $j(window).on('resize', endOfResize) //set delayed scaling when Scale to Fit is selected - let ratio = baseWidth / baseHeight; - let container = $j('#content'); - let viewPort = $j(window); + var ratio = baseWidth / baseHeight; + var container = $j('#content'); + var viewPort = $j(window); // jquery does not provide a bottom offet, and offset dows not include margins. outerHeight true minus false gives total vertical margins. - let bottomLoc = bottomEl.offset().top + (bottomEl.outerHeight(true) - bottomEl.outerHeight()) + bottomEl.outerHeight(true); - let newHeight = viewPort.height() - (bottomLoc - scaleEl.outerHeight(true)) - let newWidth = ratio * newHeight; + var bottomLoc = bottomEl.offset().top + (bottomEl.outerHeight(true) - bottomEl.outerHeight()) + bottomEl.outerHeight(true); + var newHeight = viewPort.height() - (bottomLoc - scaleEl.outerHeight(true)) + var newWidth = ratio * newHeight; if (newWidth > container.innerWidth()) { newWidth = container.innerWidth(); newHeight = newWidth / ratio; } - let autoScale = Math.round(newWidth / baseWidth * SCALE_BASE); - let scales = $j('#scale option').map(function() {return parseInt($j(this).val());}).get(); + var autoScale = Math.round(newWidth / baseWidth * SCALE_BASE); + var scales = $j('#scale option').map(function() {return parseInt($j(this).val());}).get(); scales.shift(); - let closest; + var closest; $j(scales).each(function () { //Set zms scale to nearest regular scale. Zoom does not like arbitrary scale values. if (closest == null || Math.abs(this - autoScale) < Math.abs(closest - autoScale)) { closest = this.valueOf(); diff --git a/web/skins/classic/views/js/event.js b/web/skins/classic/views/js/event.js index 9981b1458..e2f913ede 100644 --- a/web/skins/classic/views/js/event.js +++ b/web/skins/classic/views/js/event.js @@ -1,7 +1,7 @@ var vid = null; function vjsReplay() { - let endTime = (Date.parse(eventData.EndTime)).getTime(); + var endTime = (Date.parse(eventData.EndTime)).getTime(); switch(replayMode.value) { case 'none': break; @@ -10,22 +10,22 @@ function vjsReplay() { break; case 'all': if (nextEventId == 0) { - let overLaid = $j("#videoobj"); + var overLaid = $j("#videoobj"); overLaid.append('

No more events

'); } else { - let nextStartTime = nextEventStartTime.getTime(); //nextEventStartTime.getTime() is a mootools workaround, highjacks Date.parse + var nextStartTime = nextEventStartTime.getTime(); //nextEventStartTime.getTime() is a mootools workaround, highjacks Date.parse if (nextStartTime <= endTime) { streamNext( true ); return; } - let overLaid = $j("#videoobj"); + var overLaid = $j("#videoobj"); vid.pause(); overLaid.append('

'); - let gapDuration = (new Date().getTime()) + (nextStartTime - endTime); - let messageP = $j(".vjsMessage"); - let x = setInterval(function() { - let now = new Date().getTime(); - let remainder = new Date(Math.round(gapDuration - now)).toISOString().substr(11,8); + var gapDuration = (new Date().getTime()) + (nextStartTime - endTime); + var messageP = $j(".vjsMessage"); + var x = setInterval(function() { + var now = new Date().getTime(); + var remainder = new Date(Math.round(gapDuration - now)).toISOString().substr(11,8); messageP.html(remainder + ' to next event.'); if (remainder < 0) { clearInterval(x); @@ -70,7 +70,7 @@ function renderAlarmCues (containerEl) { var pixSkew = 0; var skip = 0; var num_cueFrames = cueFrames.length; - for ( let i = 0; i < num_cueFrames; i++ ) { + for ( var i = 0; i < num_cueFrames; i++ ) { skip = 0; frame = cueFrames[i]; if (frame.Type == "Alarm" && alarmed == 0) { //From nothing to alarm. End nothing and start alarm. @@ -78,7 +78,7 @@ var num_cueFrames = cueFrames.length; if (frame.Delta == 0) continue; //If event starts with an alarm or too few for a nonespan spanTimeEnd = frame.Delta * 100; spanTime = spanTimeEnd - spanTimeStart; - let pix = cueRatio * spanTime; + var pix = cueRatio * spanTime; pixSkew += pix - Math.round(pix);//average out the rounding errors. pix = Math.round(pix); if ((pixSkew > 1 || pixSkew < -1) && pix + Math.round(pixSkew) > 0) { //add skew if it's a pixel and won't zero out span. @@ -143,20 +143,20 @@ function setButtonState( element, butClass ) { } function changeScale() { - let scale = $j('#scale').val(); - let newWidth; - let newHeight; - let autoScale; - let eventViewer; - let alarmCue = $j('div.alarmCue'); - let bottomEl = streamMode == 'stills' ? $j('#eventImageNav') : $j('#replayStatus'); + var scale = $j('#scale').val(); + var newWidth; + var newHeight; + var autoScale; + var eventViewer; + var alarmCue = $j('div.alarmCue'); + var bottomEl = streamMode == 'stills' ? $j('#eventImageNav') : $j('#replayStatus'); if (streamMode == 'stills') { eventViewer = $j('#eventThumbs'); } else { eventViewer = $j(vid ? '#videoobj' : '#evtStream'); } if ( scale == "auto" ) { - let newSize = scaleToFit(eventData.Width, eventData.Height, eventViewer, bottomEl); + var newSize = scaleToFit(eventData.Width, eventData.Height, eventViewer, bottomEl); newWidth = newSize.width; newHeight = newSize.height; autoScale = newSize.autoScale; @@ -419,8 +419,8 @@ function streamNext(action) { $j(".vjsMessage").remove();//This shouldn't happen if ( nextEventId == 0 ) { //handles deleting last event. pauseClicked(); - let hideContainer = $j('#eventVideo'); - let hideStream = $j(vid ? "#videoobj" : "#evtStream").height() + (vid ? 0 :$j("#progressBar").height()); + var hideContainer = $j('#eventVideo'); + var hideStream = $j(vid ? "#videoobj" : "#evtStream").height() + (vid ? 0 :$j("#progressBar").height()); hideContainer.prepend('

No more events

'); if ( vid == null ) zmsBroke = true; return; @@ -443,15 +443,15 @@ function streamNext(action) { } function vjsPanZoom (action, x, y) { //Pan and zoom with centering where the click occurs - let outer = $j('#videoobj'); - let video = outer.children().first(); - let zoom = parseFloat($j('#zoomValue').html()); - let zoomRate = .5; - let matrix = video.css('transform').split(','); - let currentPanX = parseFloat(matrix[4]); - let currentPanY = parseFloat(matrix[5]); - let xDist = outer.width()/2 - x //Click distance from center of view - let yDist = outer.height()/2 - y + var outer = $j('#videoobj'); + var video = outer.children().first(); + var zoom = parseFloat($j('#zoomValue').html()); + var zoomRate = .5; + var matrix = video.css('transform').split(','); + var currentPanX = parseFloat(matrix[4]); + var currentPanY = parseFloat(matrix[5]); + var xDist = outer.width()/2 - x //Click distance from center of view + var yDist = outer.height()/2 - y if (action == 'zoomOut') { zoom -= zoomRate; if (x && y) { @@ -476,8 +476,8 @@ function vjsPanZoom (action, x, y) { //Pan and zoom with centering where the cli x = xDist + currentPanX; y = yDist + currentPanY; } - let limitX = ((zoom*outer.width()) - outer.width())/2; //Calculate outer bounds of video - let limitY = ((zoom*outer.height()) - outer.height())/2; + var limitX = ((zoom*outer.width()) - outer.width())/2; //Calculate outer bounds of video + var limitY = ((zoom*outer.height()) - outer.height())/2; x = Math.min(Math.max((x),-limitX),limitX); //Limit pan to outer bounds of video y = Math.min(Math.max((y),-limitY),limitY); video.css('transform', 'matrix('+zoom+', 0, 0, '+zoom+', '+x+', '+y+')'); @@ -950,7 +950,7 @@ function videoEvent() { // Called on each event load because each event can be a different width function drawProgressBar() { - let barWidth = $j('#evtStream').width(); + var barWidth = $j('#evtStream').width(); $j('#progressBar').css( 'width', barWidth ); } diff --git a/web/skins/classic/views/js/filter.js b/web/skins/classic/views/js/filter.js index f752dbff7..461025b1a 100644 --- a/web/skins/classic/views/js/filter.js +++ b/web/skins/classic/views/js/filter.js @@ -1,8 +1,8 @@ function validateForm ( form ) { - let rows = $j(form).find('tbody').eq(0).find('tr'); - let obrCount = 0; - let cbrCount = 0; - for ( let i = 0; i < rows.length; i++ ) { + var rows = $j(form).find('tbody').eq(0).find('tr'); + var obrCount = 0; + var cbrCount = 0; + for ( var i = 0; i < rows.length; i++ ) { if (rows.length > 2) { obrCount += parseInt(form.elements['filter[Query][terms][' + i + '][obr]'].value); cbrCount += parseInt(form.elements['filter[Query][terms][' + i + '][cbr]'].value); @@ -59,7 +59,7 @@ function updateButtons( element ) { } function checkValue ( element ) { - let rows = $j(element).closest('tbody').children(); + var rows = $j(element).closest('tbody').children(); parseRows(rows); //clearValue(element); } @@ -103,32 +103,32 @@ function deleteFilter( element, name ) { } function parseRows (rows) { - for (let rowNum = 0; rowNum < rows.length; rowNum++) { //Each row is a term - let queryPrefix = 'filter[Query][terms]['; - let inputTds = rows.eq(rowNum).children(); + for (var rowNum = 0; rowNum < rows.length; rowNum++) { //Each row is a term + var queryPrefix = 'filter[Query][terms]['; + var inputTds = rows.eq(rowNum).children(); if (rowNum == 0) inputTds.eq(0).html(' '); //Remove and from first term if (rowNum > 0) { //add and/or to 1+ - let cnjVal = inputTds.eq(0).children().val(); - let conjSelect = $j('').attr('name', queryPrefix + rowNum + '][cnj]').attr('id', queryPrefix + rowNum + '][cnj]'); + var cnjVal = inputTds.eq(0).children().val(); + var conjSelect = $j('').attr('name', queryPrefix + rowNum + '][cnj]').attr('id', queryPrefix + rowNum + '][cnj]'); $j.each(conjTypes, function (i) { conjSelect.append(''); }); inputTds.eq(0).html(conjSelect).children().val(cnjVal === undefined ? 'and' : cnjVal); } - let brackets = rows.length - 2; + var brackets = rows.length - 2; if (brackets > 0) { //add bracket select to all rows - let obrSelect = $j('').attr('name', queryPrefix + rowNum + '][obr]').attr('id', queryPrefix + rowNum + '][obr]'); - let cbrSelect = $j('').attr('name', queryPrefix + rowNum + '][cbr]').attr('id', queryPrefix + rowNum + '][cbr]'); + var obrSelect = $j('').attr('name', queryPrefix + rowNum + '][obr]').attr('id', queryPrefix + rowNum + '][obr]'); + var cbrSelect = $j('').attr('name', queryPrefix + rowNum + '][cbr]').attr('id', queryPrefix + rowNum + '][cbr]'); obrSelect.append(''); cbrSelect.append(''); } - let obrVal = inputTds.eq(1).children().val() != undefined ? inputTds.eq(1).children().val() : 0; //Save currently selected bracket option - let cbrVal = inputTds.eq(5).children().val() != undefined ? inputTds.eq(5).children().val() : 0; + var obrVal = inputTds.eq(1).children().val() != undefined ? inputTds.eq(1).children().val() : 0; //Save currently selected bracket option + var cbrVal = inputTds.eq(5).children().val() != undefined ? inputTds.eq(5).children().val() : 0; inputTds.eq(1).html(obrSelect).children().val(obrVal); //Set bracket contents and assign saved value inputTds.eq(5).html(cbrSelect).children().val(cbrVal); } else { @@ -146,61 +146,61 @@ function parseRows (rows) { if ( attr == "Archived") { //Archived types inputTds.eq(3).html('equal to'); - let archiveSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); - for (let i = 0; i < archiveTypes.length; i++) { + var archiveSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); + for (var i = 0; i < archiveTypes.length; i++) { archiveSelect.append(''); } - let archiveVal = inputTds.eq(4).children().val(); + var archiveVal = inputTds.eq(4).children().val(); inputTds.eq(4).html(archiveSelect).children().val(archiveVal).chosen({width: "101%"}); } else if ( attr.indexOf('Weekday') >= 0 ) { //Weekday selection - let weekdaySelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); - for (let i = 0; i < weekdays.length; i++) { + var weekdaySelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); + for (var i = 0; i < weekdays.length; i++) { weekdaySelect.append(''); } - let weekdayVal = inputTds.eq(4).children().val(); + var weekdayVal = inputTds.eq(4).children().val(); inputTds.eq(4).html(weekdaySelect).children().val(weekdayVal).chosen({width: "101%"}); } else if ( attr == 'StateId' ) { //Run state - let stateSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); - for (let key in states) { + var stateSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); + for (var key in states) { stateSelect.append(''); } - let stateVal = inputTds.eq(4).children().val(); + var stateVal = inputTds.eq(4).children().val(); inputTds.eq(4).html(stateSelect).children().val(stateVal).chosen({width: "101%"}); } else if ( attr == 'ServerId' || attr == 'MonitorServerId' || attr == 'StorageServerId' || attr == 'FilterServerId' ) { //Select Server - let serverSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); - for (let key in servers) { + var serverSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); + for (var key in servers) { serverSelect.append(''); } - let serverVal = inputTds.eq(4).children().val(); + var serverVal = inputTds.eq(4).children().val(); inputTds.eq(4).html(serverSelect).children().val(serverVal).chosen({width: "101%"}); } else if ( attr == 'StorageId' ) { //Choose by storagearea - let storageSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); + var storageSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); for ( key in storageareas ) { storageSelect.append(''); } - let storageVal = inputTds.eq(4).children().val(); + var storageVal = inputTds.eq(4).children().val(); inputTds.eq(4).html(storageSelect).children().val(storageVal).chosen({width: "101%"}); } else if ( attr == 'MonitorName' ) { //Monitor names - let monitorSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); - for (let key in monitors) { + var monitorSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); + for (var key in monitors) { monitorSelect.append(''); } - let monitorVal = inputTds.eq(4).children().val(); + var monitorVal = inputTds.eq(4).children().val(); inputTds.eq(4).html(monitorSelect).children().val(monitorVal); } else { //Reset to regular text field and operator for everything that isn't special - let opSelect = $j('').attr('name', queryPrefix + rowNum + '][op]').attr('id', queryPrefix + rowNum + '][op]'); - for (let key in opTypes) { + var opSelect = $j('').attr('name', queryPrefix + rowNum + '][op]').attr('id', queryPrefix + rowNum + '][op]'); + for (var key in opTypes) { opSelect.append(''); } - let opVal = inputTds.eq(3).children().val(); + var opVal = inputTds.eq(3).children().val(); inputTds.eq(3).html(opSelect).children().val(opVal).chosen({width: "101%"}); - let textInput = $j('').attr('type', 'text').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); - let textVal = inputTds.eq(4).children().val(); + var textInput = $j('').attr('type', 'text').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); + var textVal = inputTds.eq(4).children().val(); inputTds.eq(4).html(textInput).children().val(textVal); } if ( attr.endsWith('DateTime') ) { //Start/End DateTime @@ -212,7 +212,7 @@ function parseRows (rows) { } attr = inputTds.find("[name$='attr\\]']") // Set attr list id and name - let term = attr.attr('name').split(/[[\]]{1,2}/); + var term = attr.attr('name').split(/[[\]]{1,2}/); term.length--; term.shift(); term[2] = rowNum; @@ -223,7 +223,7 @@ function parseRows (rows) { } function stringFilter (term) { - let termString = ''; + var termString = ''; term.forEach(function(item) { termString += '[' + item + ']'; }); @@ -231,23 +231,23 @@ function stringFilter (term) { } function addTerm( element ) { - let row = $j(element).closest('tr'); + var row = $j(element).closest('tr'); row.find('select').chosen("destroy"); - let newRow = row.clone().insertAfter(row); + var newRow = row.clone().insertAfter(row); row.find('select').chosen({width: "101%"}); newRow.find('select').each( function () { //reset new row to default this[0].selected = 'selected'; }).chosen({width: "101%"}); newRow.find('input[type="text"]').val(''); - let rows = $j(row).parent().children(); + var rows = $j(row).parent().children(); parseRows(rows); } function delTerm( element ) { - let row = $j(element).closest('tr'); - let rowParent = $j(row).parent(); + var row = $j(element).closest('tr'); + var rowParent = $j(row).parent(); row.remove(); - let rows = rowParent.children(); + var rows = rowParent.children(); parseRows(rows); }