Add prettier and reformat code
This commit is contained in:
parent
68eb00bae9
commit
970a34981f
37 changed files with 3459 additions and 1969 deletions
|
|
@ -1,23 +1,36 @@
|
|||
BR.TrackStats = L.Class.extend({
|
||||
update: function (polyline, segments) {
|
||||
update: function(polyline, segments) {
|
||||
var stats = this.calcStats(polyline, segments),
|
||||
length1 = L.Util.formatNum(stats.trackLength/1000,1),
|
||||
length3 = L.Util.formatNum(stats.trackLength/1000,3),
|
||||
meanCostFactor = stats.trackLength ? L.Util.formatNum(stats.cost / stats.trackLength, 2) : '',
|
||||
formattedTime = L.Util.formatNum(stats.totalTime / 60., 1),
|
||||
formattedEnergy = L.Util.formatNum(stats.totalEnergy / 3600000., 2),
|
||||
meanEnergy = stats.trackLength ? L.Util.formatNum(stats.totalEnergy / 36. / stats.trackLength, 2) : '';
|
||||
length1 = L.Util.formatNum(stats.trackLength / 1000, 1),
|
||||
length3 = L.Util.formatNum(stats.trackLength / 1000, 3),
|
||||
meanCostFactor = stats.trackLength
|
||||
? L.Util.formatNum(stats.cost / stats.trackLength, 2)
|
||||
: '',
|
||||
formattedTime = L.Util.formatNum(stats.totalTime / 60, 1),
|
||||
formattedEnergy = L.Util.formatNum(stats.totalEnergy / 3600000, 2),
|
||||
meanEnergy = stats.trackLength
|
||||
? L.Util.formatNum(
|
||||
stats.totalEnergy / 36 / stats.trackLength,
|
||||
2
|
||||
)
|
||||
: '';
|
||||
|
||||
$('#distance').html(length1);
|
||||
// alternative 3-digit format down to meters as tooltip
|
||||
$('#distance').attr('title', length3 + ' km');
|
||||
$('#ascend').html(stats.filteredAscend + ' (' + stats.plainAscend +')');
|
||||
$('#ascend').html(
|
||||
stats.filteredAscend + ' (' + stats.plainAscend + ')'
|
||||
);
|
||||
$('#cost').html(stats.cost + ' (' + meanCostFactor + ')');
|
||||
$('#totaltime').html(formattedTime);
|
||||
$('#totalenergy').html(formattedEnergy + ' (' + meanEnergy +')');
|
||||
$('#totalenergy').html(formattedEnergy + ' (' + meanEnergy + ')');
|
||||
|
||||
document.getElementById('totaltime').parentElement.parentElement.hidden = !stats.totalTime;
|
||||
document.getElementById('totalenergy').parentElement.parentElement.hidden = !stats.totalEnergy;
|
||||
document.getElementById(
|
||||
'totaltime'
|
||||
).parentElement.parentElement.hidden = !stats.totalTime;
|
||||
document.getElementById(
|
||||
'totalenergy'
|
||||
).parentElement.parentElement.hidden = !stats.totalEnergy;
|
||||
},
|
||||
|
||||
calcStats: function(polyline, segments) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue