Displaying metrics is optional

This commit is contained in:
tuffnerdstuff 2021-04-02 12:04:34 +02:00
parent 082da40d57
commit 27a19597a9
4 changed files with 13 additions and 1 deletions

View file

@ -16,5 +16,7 @@ var VELOCITY_DELTA_TIME = <?php echo json_encode(getConfig("v_data_points")); ?>
var TRAIL_COLOR = <?php echo json_encode(getConfig("trail_color")); ?>;
var VELOCITY_UNIT = <?php echo json_encode(getConfig("velocity_unit")); ?>;
var ALTITUDE_UNIT = <?php echo json_encode(getConfig("altitude_unit")); ?>;
var SHOW_VELOCITY = <?php echo json_encode(getConfig("show_velocity")); ?>;
var SHOW_ALTITUDE_AMSL = <?php echo json_encode(getConfig("show_altitude_amsl")); ?>;
var OFFLINE_TIMEOUT = <?php echo json_encode(getConfig("offline_timeout")); ?>;
var REQUEST_TIMEOUT = <?php echo json_encode(getConfig("request_timeout")); ?>;

View file

@ -278,6 +278,12 @@
// METERS, FEET
"altitude_unit" => METERS,
// Display velocity below marker
"show_velocity" => true,
// Display altitude AMSL below marker
"show_altitude_amsl"=> true,
// The publicly accessible URL to reach Hauk, with trailing slash.
"public_url" => 'https://example.com/'

View file

@ -160,6 +160,8 @@ const DEFAULTS = array(
"trail_color" => '#d80037',
"velocity_unit" => KILOMETERS_PER_HOUR,
"altitude_unit" => METERS,
"show_velocity" => true,
"show_altitude_amsl" => true,
"public_url" => 'https://example.com/'
);

View file

@ -711,11 +711,13 @@ function processUpdate(data, init) {
'<div class="arrow still-' + shares[user].state + '" id="arrow-' + shares[user].id + '"></div>' +
'<p class="' + shares[user].state + '" id="label-' + shares[user].id + '">' +
'<span id="nickname-' + shares[user].id + '"></span>' +
'<span class="metric">' +
'<span class="metric' + (SHOW_VELOCITY ? "" : " hidden") + '">' +
'<span class="metric-label">vel:</span>' +
'<span class="metric-value"><span id="velocity-' + shares[user].id + '">0.0</span> ' +
VELOCITY_UNIT.unit + '</span>' +
'<br>' +
'</span>' +
'<span class="metric'+ (SHOW_ALTITUDE_AMSL ? "" : " hidden") + '">' +
'<span class="metric-label">alt:</span>' +
'<span class="metric-value"><span id="altitude-' + shares[user].id + '">0.0</span> ' +
ALTITUDE_UNIT.unit + '</span>' +