From 7c024f12d2123e08c272cefb2991623bc1da107a Mon Sep 17 00:00:00 2001 From: willemferguson Date: Tue, 3 Dec 2019 08:58:09 +0200 Subject: Desktop: add export to html Add the export of environmental parameters in star widgets to .html format. The dive rating is always shown both in the condensed as well as in the expanded view. The other five environmental variables are only shown in the expanded view. Only those star widgets with a rating are shown: if a star widget has not been rated in the UI, then it is assumed unrated and is not indicated in the expanded view. Signed-off-by: willemferguson Signed-off-by: Dirk Hohndel --- theme/list_lib.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'theme') diff --git a/theme/list_lib.js b/theme/list_lib.js index 143bfd492..05ac98d2a 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -224,11 +224,10 @@ function getExpanded(dive) var res = '
' + translate.Date + ': ' + dive.date + '     ' + translate.Time + ': ' + dive.time + '     ' + translate.Location + ': ' + '' + dive.location + '' + getDiveCoor(dive) + - '
' + translate.Rating + ':' + putRating(dive.rating) + - '   ' + translate.Visibility + ':' + putRating(dive.visibility) + '
' + '
' + translate.Air_Temp + ': ' + dive.temperature.air + '    ' + translate.Water_Temp + ': ' + dive.temperature.water + + '    ' + translate.Rating + ':' + putRating(dive.rating) + '
' + translate.Max_Depth + ': ' + put_depth_unit(dive.maxdepth) + " " + depth_unit + '
' + translate.Duration + ': ' + dive.dive_duration + '
' + translate.DiveMaster + ': ' + dive.divemaster + '

' + translate.Buddy + ':

' + dive.buddy + @@ -964,13 +963,23 @@ function getDiveCoor(dive) */ function get_dive_HTML(dive) { - var res = '

' + translate.Dive_information + '

' + translate.Date + ': ' + dive.date + + var table1 = '

' + translate.Dive_information + '

' + getDiveCoor(dive) + - '
' + translate.Date + ': ' + dive.date + '     ' + translate.Time + ': ' + dive.time + '     ' + translate.Location + ': ' + '' + dive.location + '
' + translate.Rating + ':' + putRating(dive.rating) + - '   ' + translate.Visibility + ':' + putRating(dive.visibility) + - '
' + - '
' + translate.Air_Temp + ': ' + dive.temperature.air + + '
'; + var table2 = ''; + if (dive.wavesize > 0) + table2 += ''; + if (dive.visibility > 0) + table2 += ''; + if (dive.current > 0) + table2 += ''; + if (dive.surge > 0) + table2 += ''; + if (dive.chill > 0) + table2 += ''; + table2 += '
' + translate.Rating + ':' + putRating(dive.rating) + '   ' + translate.WaveSize + ':' + putRating(dive.wavesize) + '   ' + translate.Visibility + ':' + putRating(dive.visibility) + '   ' + translate.Current + ':' + putRating(dive.current) + '   ' + translate.Surge + ':' + putRating(dive.surge) + '   ' + translate.Chill + ':' + putRating(dive.chill) + '
'; + var table3 = '
' + translate.Air_Temp + ': ' + dive.temperature.air + '    ' + translate.Water_Temp + ': ' + dive.temperature.water + '
' + translate.Max_Depth + ': ' + put_depth_unit(dive.maxdepth) + " " + depth_unit + '
' + translate.Duration + ': ' + dive.dive_duration + '
' + translate.DiveMaster + ': ' + dive.divemaster + @@ -978,7 +987,7 @@ function get_dive_HTML(dive) '
' + translate.Suit + ': ' + dive.suit + '
' + translate.Tags + ': ' + putTags(dive.tags) + '
'+ put_divecomputer_details(dive.divecomputers) +'

' + translate.Notes + ':

' + dive.notes + '
'; - return res; + return table1 + table2 + table3; }; function put_divecomputer_details(dc) -- cgit v1.2.3-70-g09d2