From 765fc78c7b13c87e06cb30ee21a2806a1b63936a Mon Sep 17 00:00:00 2001 From: j Date: Wed, 20 Oct 2021 09:31:42 +0100 Subject: [PATCH] format --- static/js/cccc.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/static/js/cccc.js b/static/js/cccc.js index 97e383c..b88c738 100644 --- a/static/js/cccc.js +++ b/static/js/cccc.js @@ -318,6 +318,18 @@ function totalDuration() { }).reduce(function(a, b) { return a+b }, 0) } +function formatDict(position) { + var pos = '' + Object.keys(position).forEach(key => { + var name = key + if (name == 'absoluteZoom') { + name = 'zoom' + } + pos += name + ': ' + position[key] + ' ' + }) + return pos.trim() +} + function updateStatus() { api('status', {}, function(response) { if (response.result) { @@ -347,7 +359,7 @@ function updateStatus() { }) } if (response.result.position) { - $('#position').html(JSON.stringify(response.result.position)) + $('#position').html(formatDict(response.result.position)) } data.forEach(function(row) { var s = (response.result.next && row.seqid == response.result.next.seqid); @@ -364,7 +376,7 @@ function updateStatus() { if (response.result.next.duration) { delete response.result.next.duration } - $('#next').html(JSON.stringify(response.result.next)) + $('#next').html('Next: ' + formatDict(response.result.next)) } if (update) { grid.invalidate(); @@ -753,7 +765,11 @@ function init_ptz() { $('
').appendTo($(ptz)) $('
').appendTo($(ptz)) var name = $('').appendTo($(ptz)) - name.val(getPreset(id).name) + var preset = getPreset(id) + if (preset) { + name.val(preset.name) + } + $('