From bbaad4f8b36b19c31f6633dcd9229add2b459193 Mon Sep 17 00:00:00 2001 From: Gautier P Date: Mon, 25 May 2020 20:19:30 +0200 Subject: [PATCH] Hide stats footer by default and collapse elevation chart if needed --- css/style.css | 10 +++++----- js/control/TrackStats.js | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/css/style.css b/css/style.css index cf015bd..8ed470e 100644 --- a/css/style.css +++ b/css/style.css @@ -83,16 +83,16 @@ footer { } #stats-container { - display: flex; + display: none; +} +#stats-container[style*='display: block'] { + display: flex !important; } #stats-info { align-items: center; height: 46px; - display: none; -} -#stats-info[style*='display: block'] { - display: flex !important; + display: flex; } #stats-info > div { margin: auto; diff --git a/js/control/TrackStats.js b/js/control/TrackStats.js index f5b281b..4178c39 100644 --- a/js/control/TrackStats.js +++ b/js/control/TrackStats.js @@ -3,11 +3,16 @@ BR.TrackStats = L.Class.extend({ if (segments.length == 0) { $('#stats-container').hide(); $('#stats-info').show(); + this.shouldRestoreChart = $('#elevation-chart').hasClass('show'); + $('#elevation-chart').collapse('hide'); return; } $('#stats-container').show(); $('#stats-info').hide(); + if (this.shouldRestoreChart === true) $('#elevation-chart').collapse('show'); + this.shouldRestoreChart = undefined; + var stats = this.calcStats(polyline, segments), length1 = L.Util.formatNum(stats.trackLength / 1000, 1).toLocaleString(), length3 = L.Util.formatNum(stats.trackLength / 1000, 3).toLocaleString(undefined, {