Merge branch 'master' of github.com:ZoneMinder/ZoneMinder

This commit is contained in:
Isaac Connor 2019-01-18 10:30:15 -05:00
commit 4e6c1d42b1
29 changed files with 235 additions and 232 deletions

View File

@ -1,4 +1,15 @@
*.min.js
# libraries
web/api/lib web/api/lib
web/skins/classic/js/jquery-1.11.3.js web/includes/csrf/csrf-magic.js
web/js/videojs.zoomrotate.js
web/skins/classic/js/bootstrap.js
web/skins/classic/js/chosen
web/skins/classic/js/dateTimePicker
web/skins/classic/js/jquery-*.js
web/skins/classic/js/jquery-ui-*
web/skins/classic/js/jquery.js web/skins/classic/js/jquery.js
web/skins/classic/js/moment.js
web/skins/classic/js/video.js
web/tools/mootools web/tools/mootools

View File

@ -9,6 +9,7 @@ module.exports = {
"brace-style": "off", "brace-style": "off",
"camelcase": "off", "camelcase": "off",
"comma-dangle": "off", "comma-dangle": "off",
"guard-for-in": "off",
"key-spacing": "off", "key-spacing": "off",
"max-len": "off", "max-len": "off",
"new-cap": ["error", { "new-cap": ["error", {

View File

@ -38,10 +38,13 @@ function noCacheHeaders() {
function CSPHeaders($view, $nonce) { function CSPHeaders($view, $nonce) {
switch ($view) { switch ($view) {
case 'bandwidth': case 'bandwidth':
case 'blank':
case 'function': case 'function':
case 'log': case 'log':
case 'login':
case 'logout': case 'logout':
case 'options': case 'options':
case 'privacy':
case 'version': { case 'version': {
// Enforce script-src on pages where inline scripts and event handlers have been fixed. // Enforce script-src on pages where inline scripts and event handlers have been fixed.
// 'unsafe-inline' is only for backwards compatibility with browsers which // 'unsafe-inline' is only for backwards compatibility with browsers which

View File

@ -174,7 +174,6 @@ if ( isset($_REQUEST['view']) )
# Add CSP Headers # Add CSP Headers
$cspNonce = bin2hex(openssl_random_pseudo_bytes(16)); $cspNonce = bin2hex(openssl_random_pseudo_bytes(16));
CSPHeaders($view, $cspNonce);
$request = null; $request = null;
if ( isset($_REQUEST['request']) ) if ( isset($_REQUEST['request']) )
@ -231,6 +230,8 @@ if ( ZM_OPT_USE_AUTH and !isset($user) ) {
$request = null; $request = null;
} }
CSPHeaders($view, $cspNonce);
if ( $redirect ) { if ( $redirect ) {
header('Location: '.$redirect); header('Location: '.$redirect);
return; return;

View File

@ -71,10 +71,10 @@ html ul.tabs li.active, html ul.tabs li.active a:hover {
} }
--> -->
</style> </style>
<script type="text/javascript"> <script nonce="<?php echo $cspNonce;?>">
<?php include(ZM_SKIN_PATH.'/js/jquery.js') ?> <?php include(ZM_SKIN_PATH.'/js/jquery.js') ?>
</script> </script>
<script type="text/javascript" language="javascript" charset="utf-8"> <script nonce="<?php echo $cspNonce;?>">
/*==========[tab code]==========*/ /*==========[tab code]==========*/
$(document).ready(function() { $(document).ready(function() {
@ -263,10 +263,10 @@ function exportEventImages( $event, $exportDetail, $exportFrames, $myfilelist )
<div id="imagevideo" align="center"></div> <div id="imagevideo" align="center"></div>
<br> <br>
<div align="center"> <div align="center">
<button data-on-click="stepbackward">< Step</button><button <button data-on-click="stepbackward">&lt; Step</button><button
id="btnrwd" data-on-click="rewind">Rwd</button><button id="btnrwd" data-on-click="rewind">Rwd</button><button
id="btnplay" data-on-click="playstop">Stop</button><button id="btnplay" data-on-click="playstop">Stop</button><button
data-on-click="stepforward">Step ></button><button data-on-click="stepforward">Step &gt;</button><button
id="btnspeedup" data-on-click="speedup">speedup</button><button id="btnspeedup" data-on-click="speedup">speedup</button><button
id="btnspeeddown" data-on-click="speeddown">slowdown</button> id="btnspeeddown" data-on-click="speeddown">slowdown</button>
</div> </div>
@ -278,7 +278,7 @@ function exportEventImages( $event, $exportDetail, $exportFrames, $myfilelist )
<div align="center"><div class="display_holder" ><input id="imageslider_display_id" class="value_display" type="text" value="0" onfocus="blur(this);" /></div></div> <div align="center"><div class="display_holder" ><input id="imageslider_display_id" class="value_display" type="text" value="0" onfocus="blur(this);" /></div></div>
<script language="JavaScript1.2"> <script nonce="<?php echo $cspNonce;?>">
/*********************************************** /***********************************************
* Flexi Slideshow- © Dynamic Drive (www.dynamicdrive.com) * Flexi Slideshow- © Dynamic Drive (www.dynamicdrive.com)
@ -660,7 +660,7 @@ function exportEventImagesMaster( $eids ) {
</td> </td>
</tr></table> </tr></table>
<script type="text/javascript"> <script nonce="<?php echo $cspNonce;?>">
function switchevent(src) { function switchevent(src) {
if(document.all) document.all.myframe.src = src; if(document.all) document.all.myframe.src = src;
else window.frames['myframe'].location.href = src; else window.frames['myframe'].location.href = src;

View File

@ -151,6 +151,12 @@ $j(document).ready(function() {
}; };
}); });
// 'data-on-change-this' calls the global function in the attribute value with the element when a change happens.
document.querySelectorAll("select[data-on-change-this], input[data-on-change-this]").forEach(function attachOnChangeThis(el) {
var fnName = el.getAttribute("data-on-change-this");
el.onchange = window[fnName].bind(el, el);
});
// 'data-on-change' adds an event listener for the global function in the attribute value when a change happens. // 'data-on-change' adds an event listener for the global function in the attribute value when a change happens.
document.querySelectorAll("select[data-on-change], input[data-on-change]").forEach(function attachOnChange(el) { document.querySelectorAll("select[data-on-change], input[data-on-change]").forEach(function attachOnChange(el) {
var fnName = el.getAttribute("data-on-change"); var fnName = el.getAttribute("data-on-change");
@ -353,7 +359,7 @@ function convertLabelFormat(LabelFormat, monitorName){
//convert label format from strftime to moment's format (modified from //convert label format from strftime to moment's format (modified from
//https://raw.githubusercontent.com/benjaminoakes/moment-strftime/master/lib/moment-strftime.js //https://raw.githubusercontent.com/benjaminoakes/moment-strftime/master/lib/moment-strftime.js
//added %f and %N below (TODO: add %Q) //added %f and %N below (TODO: add %Q)
var replacements = { a: 'ddd', A: 'dddd', b: 'MMM', B: 'MMMM', d: 'DD', e: 'D', F: 'YYYY-MM-DD', H: 'HH', I: 'hh', j: 'DDDD', k: 'H', l: 'h', m: 'MM', M: 'mm', p: 'A', S: 'ss', u: 'E', w: 'd', W: 'WW', y: 'YY', Y: 'YYYY', z: 'ZZ', Z: 'z', 'f': 'SS', 'N': "["+monitorName+"]", '%': '%' }; var replacements = { "a": 'ddd', "A": 'dddd', "b": 'MMM', "B": 'MMMM', "d": 'DD', "e": 'D', "F": 'YYYY-MM-DD', "H": 'HH', "I": 'hh', "j": 'DDDD', "k": 'H', "l": 'h', "m": 'MM', "M": 'mm', "p": 'A', "S": 'ss', "u": 'E', "w": 'd', "W": 'WW', "y": 'YY', "Y": 'YYYY', "z": 'ZZ', "Z": 'z', 'f': 'SS', 'N': "["+monitorName+"]", '%': '%' };
var momentLabelFormat = Object.keys(replacements).reduce(function(momentFormat, key) { var momentLabelFormat = Object.keys(replacements).reduce(function(momentFormat, key) {
var value = replacements[key]; var value = replacements[key];
return momentFormat.replace("%" + key, value); return momentFormat.replace("%" + key, value);
@ -404,13 +410,13 @@ function endOfResize(e) {
} }
function scaleToFit(baseWidth, baseHeight, scaleEl, bottomEl) { function scaleToFit(baseWidth, baseHeight, scaleEl, bottomEl) {
$j(window).on('resize', endOfResize) //set delayed scaling when Scale to Fit is selected $j(window).on('resize', endOfResize); //set delayed scaling when Scale to Fit is selected
var ratio = baseWidth / baseHeight; var ratio = baseWidth / baseHeight;
var container = $j('#content'); var container = $j('#content');
var viewPort = $j(window); 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. // jquery does not provide a bottom offet, and offset dows not include margins. outerHeight true minus false gives total vertical margins.
var bottomLoc = bottomEl.offset().top + (bottomEl.outerHeight(true) - bottomEl.outerHeight()) + bottomEl.outerHeight(true); var bottomLoc = bottomEl.offset().top + (bottomEl.outerHeight(true) - bottomEl.outerHeight()) + bottomEl.outerHeight(true);
var newHeight = viewPort.height() - (bottomLoc - scaleEl.outerHeight(true)) var newHeight = viewPort.height() - (bottomLoc - scaleEl.outerHeight(true));
var newWidth = ratio * newHeight; var newWidth = ratio * newHeight;
if (newWidth > container.innerWidth()) { if (newWidth > container.innerWidth()) {
newWidth = container.innerWidth(); newWidth = container.innerWidth();

View File

@ -19,14 +19,14 @@
// //
?> ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE html>
<html> <html>
<?php <?php
if ( !empty($refreshParent) ) if ( !empty($refreshParent) )
{ {
?> ?>
<head> <head>
<script type="text/javascript"> <script nonce="<?php echo $cspNonce;?>">
//self.onerror = function() { return( true ); } //self.onerror = function() { return( true ); }
opener.location.reload(true); opener.location.reload(true);
</script> </script>
@ -34,4 +34,5 @@ opener.location.reload(true);
<?php <?php
} }
?> ?>
<body></body>
</html> </html>

View File

@ -280,7 +280,7 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
$Groups = $Group->Parents(); $Groups = $Group->Parents();
array_push( $Groups, $Group ); array_push( $Groups, $Group );
} }
return implode(' &gt; ', array_map(function($Group){ return '<a href="'. ZM_BASE_URL.$_SERVER['PHP_SELF'].'?view=montagereview&GroupId='.$Group->Id().'">'.$Group->Name().'</a>'; }, $Groups )); return implode(' &gt; ', array_map(function($Group){ return '<a href="'. ZM_BASE_URL.$_SERVER['PHP_SELF'].'?view=montagereview&amp;GroupId='.$Group->Id().'">'.$Group->Name().'</a>'; }, $Groups ));
}, $Monitor->GroupIds() ) ); }, $Monitor->GroupIds() ) );
?> ?>
</div></td> </div></td>

View File

@ -297,7 +297,7 @@ if ( $pagination ) {
</form> </form>
</div> </div>
</div> </div>
<script type="text/javascript"> <script nonce="<?php echo $cspNonce;?>">
// These are defined in the .js.php but need to be updated down here. // These are defined in the .js.php but need to be updated down here.
archivedEvents = <?php echo !empty($archived)?'true':'false' ?>; archivedEvents = <?php echo !empty($archived)?'true':'false' ?>;
unarchivedEvents = <?php echo !empty($unarchived)?'true':'false' ?>; unarchivedEvents = <?php echo !empty($unarchived)?'true':'false' ?>;

View File

@ -237,7 +237,7 @@ for ( $i=0; $i < count($terms); $i++ ) {
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td> <td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
<td> <td>
<input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" id="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo isset($term['val'])?validHtmlStr(str_replace('T', ' ', $term['val'])):'' ?>"/> <input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" id="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo isset($term['val'])?validHtmlStr(str_replace('T', ' ', $term['val'])):'' ?>"/>
<script type="text/javascript">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").datetimepicker({timeFormat: "HH:mm:ss", dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false}); </script> <script nonce="<?php echo $cspNonce;?>">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").datetimepicker({timeFormat: "HH:mm:ss", dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false}); </script>
</td> </td>
<?php <?php
} elseif ( $term['attr'] == 'Date' || $term['attr'] == 'StartDate' || $term['attr'] == 'EndDate' ) { } elseif ( $term['attr'] == 'Date' || $term['attr'] == 'StartDate' || $term['attr'] == 'EndDate' ) {
@ -245,7 +245,7 @@ for ( $i=0; $i < count($terms); $i++ ) {
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td> <td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
<td> <td>
<input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" id="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo isset($term['val'])?validHtmlStr($term['val']):'' ?>"/> <input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" id="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo isset($term['val'])?validHtmlStr($term['val']):'' ?>"/>
<script type="text/javascript">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").datepicker({dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false});</script> <script nonce="<?php echo $cspNonce;?>">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").datepicker({dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false});</script>
</td> </td>
<?php <?php
} elseif ( $term['attr'] == 'StartTime' || $term['attr'] == 'EndTime' ) { } elseif ( $term['attr'] == 'StartTime' || $term['attr'] == 'EndTime' ) {
@ -253,7 +253,7 @@ for ( $i=0; $i < count($terms); $i++ ) {
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td> <td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td> <td>
<input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" id="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo isset($term['val'])?validHtmlStr(str_replace('T', ' ', $term['val'])):'' ?>"/> <input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" id="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo isset($term['val'])?validHtmlStr(str_replace('T', ' ', $term['val'])):'' ?>"/>
<script type="text/javascript">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").timepicker({timeFormat: "HH:mm:ss", constrainInput: false}); </script> <script nonce="<?php echo $cspNonce;?>">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").timepicker({timeFormat: "HH:mm:ss", constrainInput: false}); </script>
</td> </td>
<?php <?php
} elseif ( $term['attr'] == 'StateId' ) { } elseif ( $term['attr'] == 'StateId' ) {
@ -388,7 +388,7 @@ if ( ZM_OPT_MESSAGE ) {
<p> <p>
<label><?php echo translate('FilterExecuteEvents') ?></label> <label><?php echo translate('FilterExecuteEvents') ?></label>
<input type="checkbox" name="filter[AutoExecute]" value="1"<?php if ( $filter->AutoExecute() ) { ?> checked="checked"<?php } ?>/> <input type="checkbox" name="filter[AutoExecute]" value="1"<?php if ( $filter->AutoExecute() ) { ?> checked="checked"<?php } ?>/>
<input type="text" name="filter[AutoExecuteCmd]" value="<?php echo (null !==$filter->AutoExecuteCmd())?$filter->AutoExecuteCmd():'' ?>" maxlength="255" data-on-change="updateButtons"/> <input type="text" name="filter[AutoExecuteCmd]" value="<?php echo (null !==$filter->AutoExecuteCmd())?$filter->AutoExecuteCmd():'' ?>" maxlength="255" data-on-change-this="updateButtons"/>
</p> </p>
<p> <p>
<label><?php echo translate('FilterDeleteEvents') ?></label> <label><?php echo translate('FilterDeleteEvents') ?></label>

View File

@ -126,8 +126,6 @@ echo htmlSelect('newGroup[ParentId]', $options, $newGroup->ParentId(), array('on
</form> </form>
</div> </div>
</div> </div>
<script nonce="<?php echo $cspNonce;?>">$j('.chosen').chosen();</script>
</body> </body>
<script type="text/javascript">
$j('.chosen').chosen();
</script>
</html> </html>

View File

@ -39,7 +39,6 @@ function addMonitor(element) {
} }
function cloneMonitor(element) { function cloneMonitor(element) {
var form = element.form; var form = element.form;
var dupParam; var dupParam;
var monitorId=-1; var monitorId=-1;

View File

@ -451,8 +451,8 @@ function vjsPanZoom (action, x, y) { //Pan and zoom with centering where the cli
var matrix = video.css('transform').split(','); var matrix = video.css('transform').split(',');
var currentPanX = parseFloat(matrix[4]); var currentPanX = parseFloat(matrix[4]);
var currentPanY = parseFloat(matrix[5]); var currentPanY = parseFloat(matrix[5]);
var xDist = outer.width()/2 - x //Click distance from center of view var xDist = outer.width()/2 - x; //Click distance from center of view
var yDist = outer.height()/2 - y var yDist = outer.height()/2 - y;
if (action == 'zoomOut') { if (action == 'zoomOut') {
zoom -= zoomRate; zoom -= zoomRate;
if (x && y) { if (x && y) {
@ -1003,7 +1003,7 @@ function initPage() {
vid.on('play', vjsPlay); vid.on('play', vjsPlay);
vid.on('pause', vjsPause); vid.on('pause', vjsPause);
vid.on('click', function(event) {handleClick(event);}); vid.on('click', function(event) {handleClick(event);});
vid.on('timeupdate', function (){$j('#progressValue').html(secsToTime(Math.floor(vid.currentTime())))}); vid.on('timeupdate', function() {$j('#progressValue').html(secsToTime(Math.floor(vid.currentTime())));});
if ( rate > 1 ) { if ( rate > 1 ) {
// rate should be 100 = 1x, etc. // rate should be 100 = 1x, etc.

View File

@ -121,7 +121,7 @@ function viewEvents( element, name ) {
} }
} }
if ( events.length > 0 ) { if ( events.length > 0 ) {
let filter = '&filter[Query][terms][0][attr]=Id&filter[Query][terms][0][op]=%3D%5B%5D&filter[Query][terms][0][val]='+events.join('%2C'); var filter = '&filter[Query][terms][0][attr]=Id&filter[Query][terms][0][op]=%3D%5B%5D&filter[Query][terms][0][val]='+events.join('%2C');
window.location.href = thisUrl+'?view=event&eid='+events[0]+filter+sortQuery+'&page=1&play=1'; window.location.href = thisUrl+'?view=event&eid='+events[0]+filter+sortQuery+'&page=1&play=1';
} }
} }

View File

@ -24,8 +24,7 @@ function validateForm ( form ) {
return true; return true;
} }
function updateButtons() { function updateButtons(element) {
var element = this;
var form = element.form; var form = element.form;
if ( element.type == 'checkbox' && element.checked ) { if ( element.type == 'checkbox' && element.checked ) {
@ -153,7 +152,6 @@ function parseRows (rows) {
} }
var archiveVal = inputTds.eq(4).children().val(); var archiveVal = inputTds.eq(4).children().val();
inputTds.eq(4).html(archiveSelect).children().val(archiveVal).chosen({width: "101%"}); inputTds.eq(4).html(archiveSelect).children().val(archiveVal).chosen({width: "101%"});
} else if ( attr.indexOf('Weekday') >= 0 ) { //Weekday selection } else if ( attr.indexOf('Weekday') >= 0 ) { //Weekday selection
var weekdaySelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); var weekdaySelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
for (var i = 0; i < weekdays.length; i++) { for (var i = 0; i < weekdays.length; i++) {
@ -161,7 +159,6 @@ function parseRows (rows) {
} }
var weekdayVal = inputTds.eq(4).children().val(); var weekdayVal = inputTds.eq(4).children().val();
inputTds.eq(4).html(weekdaySelect).children().val(weekdayVal).chosen({width: "101%"}); inputTds.eq(4).html(weekdaySelect).children().val(weekdayVal).chosen({width: "101%"});
} else if ( attr == 'StateId' ) { //Run state } else if ( attr == 'StateId' ) { //Run state
var stateSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); var stateSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
for (var key in states) { for (var key in states) {
@ -169,7 +166,6 @@ function parseRows (rows) {
} }
var stateVal = inputTds.eq(4).children().val(); var stateVal = inputTds.eq(4).children().val();
inputTds.eq(4).html(stateSelect).children().val(stateVal).chosen({width: "101%"}); inputTds.eq(4).html(stateSelect).children().val(stateVal).chosen({width: "101%"});
} else if ( attr == 'ServerId' || attr == 'MonitorServerId' || attr == 'StorageServerId' || attr == 'FilterServerId' ) { //Select Server } else if ( attr == 'ServerId' || attr == 'MonitorServerId' || attr == 'StorageServerId' || attr == 'FilterServerId' ) { //Select Server
var serverSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); var serverSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
for (var key in servers) { for (var key in servers) {
@ -177,7 +173,6 @@ function parseRows (rows) {
} }
var serverVal = inputTds.eq(4).children().val(); var serverVal = inputTds.eq(4).children().val();
inputTds.eq(4).html(serverSelect).children().val(serverVal).chosen({width: "101%"}); inputTds.eq(4).html(serverSelect).children().val(serverVal).chosen({width: "101%"});
} else if ( attr == 'StorageId' ) { //Choose by storagearea } else if ( attr == 'StorageId' ) { //Choose by storagearea
var storageSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); var storageSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
for ( key in storageareas ) { for ( key in storageareas ) {
@ -185,7 +180,6 @@ function parseRows (rows) {
} }
var storageVal = inputTds.eq(4).children().val(); var storageVal = inputTds.eq(4).children().val();
inputTds.eq(4).html(storageSelect).children().val(storageVal).chosen({width: "101%"}); inputTds.eq(4).html(storageSelect).children().val(storageVal).chosen({width: "101%"});
} else if ( attr == 'MonitorName' ) { //Monitor names } else if ( attr == 'MonitorName' ) { //Monitor names
var monitorSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); var monitorSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
for (var key in monitors) { for (var key in monitors) {
@ -212,7 +206,7 @@ function parseRows (rows) {
inputTds.eq(4).children().timepicker({timeFormat: "HH:mm:ss", constrainInput: false}); inputTds.eq(4).children().timepicker({timeFormat: "HH:mm:ss", constrainInput: false});
} }
attr = inputTds.find("[name$='attr\\]']") // Set attr list id and name attr = inputTds.find("[name$='attr\\]']"); // Set attr list id and name
var term = attr.attr('name').split(/[[\]]{1,2}/); var term = attr.attr('name').split(/[[\]]{1,2}/);
term.length--; term.length--;
term.shift(); term.shift();

View File

@ -1,18 +1,18 @@
function changeScale() { function changeScale() {
let scale = $j('#scale').val(); var scale = $j('#scale').val();
let img = $j('#frameImg'); var img = $j('#frameImg');
let controlsLinks = { var controlsLinks = {
next: $j('#nextLink'), next: $j('#nextLink'),
prev: $j('#prevLink'), prev: $j('#prevLink'),
first: $j('#firstLink'), first: $j('#firstLink'),
last: $j('#lastLink') last: $j('#lastLink')
} };
if ( img ) { if ( img ) {
let baseWidth = $j('#base_width').val(); var baseWidth = $j('#base_width').val();
let baseHeight = $j('#base_height').val(); var baseHeight = $j('#base_height').val();
if ( scale == 'auto' ) { if ( scale == 'auto' ) {
let newSize = scaleToFit(baseWidth, baseHeight, img, $j('#controls')); var newSize = scaleToFit(baseWidth, baseHeight, img, $j('#controls'));
newWidth = newSize.width; newWidth = newSize.width;
newHeight = newSize.height; newHeight = newSize.height;
autoScale = newSize.autoScale; autoScale = newSize.autoScale;
@ -27,7 +27,6 @@ function changeScale() {
Cookie.write( 'zmWatchScale', scale, { duration: 10*365 } ); Cookie.write( 'zmWatchScale', scale, { duration: 10*365 } );
$j.each(controlsLinks, function(k, anchor) { //Make frames respect scale choices $j.each(controlsLinks, function(k, anchor) { //Make frames respect scale choices
anchor.prop('href', anchor.prop('href').replace(/scale=.*&/, 'scale=' + scale + '&')); anchor.prop('href', anchor.prop('href').replace(/scale=.*&/, 'scale=' + scale + '&'));
}); });
} }

View File

@ -256,7 +256,6 @@ function updateFilterSelectors() {
} }
if ( filter[key] ) if ( filter[key] )
selector.set('value', filter[key]); selector.set('value', filter[key]);
} }
); );
} }

View File

@ -165,7 +165,6 @@ function Monitor( monitorData ) {
console.log("queueing for " + this.id + " " + this.connKey ); console.log("queueing for " + this.id + " " + this.connKey );
requestQueue.addRequest( "cmdReq"+this.id, this.streamCmdReq ); requestQueue.addRequest( "cmdReq"+this.id, this.streamCmdReq );
} }
} }
function selectLayout( element ) { function selectLayout( element ) {
@ -341,7 +340,6 @@ function toGrid(value) {
// Makes monitorFrames draggable. // Makes monitorFrames draggable.
function edit_layout(button) { function edit_layout(button) {
// Turn off the onclick on the image. // Turn off the onclick on the image.
for ( var i = 0; i < monitors.length; i++ ) { for ( var i = 0; i < monitors.length; i++ ) {
@ -397,7 +395,6 @@ function reloadWebSite(ndx) {
var monitors = new Array(); var monitors = new Array();
function initPage() { function initPage() {
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#hdrbutton").click(function() { jQuery("#hdrbutton").click(function() {
jQuery("#flipMontageHeader").slideToggle("slow"); jQuery("#flipMontageHeader").slideToggle("slow");

View File

@ -341,7 +341,7 @@ function drawSliderOnGraph(val) {
} }
function drawGraph() { function drawGraph() {
var divWidth=$('timelinediv').clientWidth var divWidth=$('timelinediv').clientWidth;
canvas.width = cWidth = divWidth; // Let it float and determine width (it should be sized a bit smaller percentage of window) canvas.width = cWidth = divWidth; // Let it float and determine width (it should be sized a bit smaller percentage of window)
cHeight = parseInt(window.innerHeight * 0.10); cHeight = parseInt(window.innerHeight * 0.10);
if ( cHeight < numMonitors * 20 ) { if ( cHeight < numMonitors * 20 ) {
@ -415,7 +415,6 @@ function redrawScreen() {
$('panleft').style.display="none"; $('panleft').style.display="none";
$('panright').style.display="none"; $('panright').style.display="none";
if ($('downloadVideo')) $('downloadVideo').style.display="none"; if ($('downloadVideo')) $('downloadVideo').style.display="none";
} else { } else {
// switch out of liveview mode // switch out of liveview mode
$('DateTimeDiv').style.display="inline"; $('DateTimeDiv').style.display="inline";
@ -487,7 +486,7 @@ function relMouseCoords(event){
canvasX = event.pageX - totalOffsetX; canvasX = event.pageX - totalOffsetX;
canvasY = event.pageY - totalOffsetY; canvasY = event.pageY - totalOffsetY;
return {x:canvasX, y:canvasY} return {x:canvasX, y:canvasY};
} }
HTMLCanvasElement.prototype.relMouseCoords = relMouseCoords; HTMLCanvasElement.prototype.relMouseCoords = relMouseCoords;
@ -582,7 +581,6 @@ function setLive(value) {
// The section below are to reload this program with new parameters // The section below are to reload this program with new parameters
function clicknav(minSecs, maxSecs, live) {// we use the current time if we can function clicknav(minSecs, maxSecs, live) {// we use the current time if we can
var date = new Date(); var date = new Date();
var now = Math.floor(date.getTime() / 1000); var now = Math.floor(date.getTime() / 1000);
var tz_difference = (-1 * date.getTimezoneOffset() * 60) - server_utc_offset; var tz_difference = (-1 * date.getTimezoneOffset() * 60) - server_utc_offset;
@ -861,7 +859,6 @@ function changeDateTime(e) {
// >>>>>>>>> Initialization that runs on window load by being at the bottom // >>>>>>>>> Initialization that runs on window load by being at the bottom
function initPage() { function initPage() {
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#hdrbutton").click(function() { jQuery("#hdrbutton").click(function() {
jQuery("#flipMontageHeader").slideToggle("slow"); jQuery("#flipMontageHeader").slideToggle("slow");
@ -879,8 +876,8 @@ function initPage() {
monitorCanvasCtx[monId] = monitorCanvasObj[monId].getContext('2d'); monitorCanvasCtx[monId] = monitorCanvasObj[monId].getContext('2d');
var imageObject = monitorImageObject[monId] = new Image(); var imageObject = monitorImageObject[monId] = new Image();
imageObject.monId = monId; imageObject.monId = monId;
imageObject.onload = function() {imagedone(this, this.monId, true )}; imageObject.onload = function() {imagedone(this, this.monId, true );};
imageObject.onerror = function() {imagedone(this, this.monId, false )}; imageObject.onerror = function() {imagedone(this, this.monId, false );};
loadImage2Monitor( monId, monitorImageURL[monId] ); loadImage2Monitor( monId, monitorImageURL[monId] );
} }
} }

View File

@ -24,21 +24,21 @@ $j(document).ready(function() {
// Delete a state // Delete a state
$j("#btnDelete").click(function() { $j("#btnDelete").click(function() {
StateStuff( 'delete', $j("#runState").val( )); stateStuff( 'delete', $j("#runState").val( ));
}); });
// Save a new state // Save a new state
$j("#btnSave").click(function() { $j("#btnSave").click(function() {
StateStuff( 'save', undefined, $j("#newState").val() ); stateStuff( 'save', undefined, $j("#newState").val() );
}); });
// Change state // Change state
$j("#btnApply").click(function() { $j("#btnApply").click(function() {
StateStuff( 'state', $j("#runState").val() ); stateStuff( 'state', $j("#runState").val() );
}); });
function StateStuff( action, runState, newState ){ function stateStuff( action, runState, newState ) {
var formData = { var formData = {
'view' : 'console', 'view' : 'console',
'action' : action, 'action' : action,
@ -59,7 +59,5 @@ $j(document).ready(function() {
}).done(function(data) { }).done(function(data) {
location.reload(); location.reload();
}); });
} }
}); });

View File

@ -89,7 +89,6 @@ function requestFrameData( eventId, frameId ) {
} }
function previewEvent(eventId, frameId) { function previewEvent(eventId, frameId) {
if ( events[eventId] ) { if ( events[eventId] ) {
var event = events[eventId]; var event = events[eventId];
if ( event['frames'] ) { if ( event['frames'] ) {
@ -124,7 +123,7 @@ function loadEventImage( imagePath, eid, fid, width, height, fps, videoName, dur
tracks[0].parentNode.removeChild(tracks[0]); tracks[0].parentNode.removeChild(tracks[0]);
} }
vid.load(); vid.load();
addVideoTimingTrack(vid, Monitor.LabelFormat, Monitor.Name, duration, startTime) addVideoTimingTrack(vid, Monitor.LabelFormat, Monitor.Name, duration, startTime);
vid.currentTime = fid/fps; vid.currentTime = fid/fps;
} else { } else {
if ( ! vid.seeking ) if ( ! vid.seeking )

View File

@ -30,7 +30,7 @@ function changeScale() {
var newWidth; var newWidth;
var newHeight; var newHeight;
if (scale == "auto") { if (scale == "auto") {
let newSize = scaleToFit(monitorWidth, monitorHeight, $j('#liveStream'+monitorId), $j('#replayStatus')); var newSize = scaleToFit(monitorWidth, monitorHeight, $j('#liveStream'+monitorId), $j('#replayStatus'));
newWidth = newSize.width; newWidth = newSize.width;
newHeight = newSize.height; newHeight = newSize.height;
autoScale = newSize.autoScale; autoScale = newSize.autoScale;
@ -520,7 +520,7 @@ function getEventCmdResponse( respObj, respText ) {
link.set( 'text', event.AvgScore+'/'+event.MaxScore ); link.set( 'text', event.AvgScore+'/'+event.MaxScore );
link.inject( row.getElement( 'td.colScore' ) ); 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.set( 'text', 'X' );
link.inject( row.getElement( 'td.colDelete' ) ); link.inject( row.getElement( 'td.colDelete' ) );

View File

@ -1049,8 +1049,8 @@ if ( $monitor->Type() == 'Local' ) {
</form> </form>
</div> </div>
</div> </div>
</body> <script nonce="<?php echo $cspNonce;?>">
<script type="text/javascript">
$j('.chosen').chosen(); $j('.chosen').chosen();
</script> </script>
</body>
</html> </html>

View File

@ -395,19 +395,19 @@ foreach ( array_map('basename', glob('skins/'.$current_skin.'/css/*',GLOB_ONLYDI
<?php <?php
} else if ( $value['Type'] == 'integer' ) { } else if ( $value['Type'] == 'integer' ) {
?> ?>
<input type="number" class="form-control" id="<?php echo $name ?>" name="newConfig[<?php echo $name ?>]" value="<?php echo validHtmlStr($value['Value']) ?>" class="small"<?php echo $canEdit?'':' disabled="disabled"' ?>/> <input type="number" class="form-control small" id="<?php echo $name ?>" name="newConfig[<?php echo $name ?>]" value="<?php echo validHtmlStr($value['Value']) ?>" <?php echo $canEdit?'':' disabled="disabled"' ?>/>
<?php <?php
} else if ( $value['Type'] == 'hexadecimal' ) { } else if ( $value['Type'] == 'hexadecimal' ) {
?> ?>
<input type="text" class="form-control" id="<?php echo $name ?>" name="newConfig[<?php echo $name ?>]" value="<?php echo validHtmlStr($value['Value']) ?>" class="medium"<?php echo $canEdit?'':' disabled="disabled"' ?>/> <input type="text" class="form-control medium" id="<?php echo $name ?>" name="newConfig[<?php echo $name ?>]" value="<?php echo validHtmlStr($value['Value']) ?>" <?php echo $canEdit?'':' disabled="disabled"' ?>/>
<?php <?php
} else if ( $value['Type'] == 'decimal' ) { } else if ( $value['Type'] == 'decimal' ) {
?> ?>
<input type="text" class="form-control" id="<?php echo $name ?>" name="newConfig[<?php echo $name ?>]" value="<?php echo validHtmlStr($value['Value']) ?>" class="small"<?php echo $canEdit?'':' disabled="disabled"' ?>/> <input type="text" class="form-control small" id="<?php echo $name ?>" name="newConfig[<?php echo $name ?>]" value="<?php echo validHtmlStr($value['Value']) ?>" <?php echo $canEdit?'':' disabled="disabled"' ?>/>
<?php <?php
} else { } else {
?> ?>
<input type="text" class="form-control" id="<?php echo $name ?>" name="newConfig[<?php echo $name ?>]" value="<?php echo validHtmlStr($value['Value']) ?>" class="large"<?php echo $canEdit?'':' disabled="disabled"' ?>/> <input type="text" class="form-control large" id="<?php echo $name ?>" name="newConfig[<?php echo $name ?>]" value="<?php echo validHtmlStr($value['Value']) ?>" <?php echo $canEdit?'':' disabled="disabled"' ?>/>
<?php <?php
} }
?> ?>