diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2014-07-27 21:38:50 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-08-04 10:03:09 -0700 |
commit | 4d6ff4c8d1836361900a257f25ce83d8e639745b (patch) | |
tree | eb0018f97cb78979df78e385beb114f33f1f41bf /theme | |
parent | 979ea564a058254205c2ec9594294f35658c65f0 (diff) | |
download | subsurface-4d6ff4c8d1836361900a257f25ce83d8e639745b.tar.gz |
HTML: add weight systems to the dive equipments section.
Add weights systems to the dive equipment list.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'theme')
-rw-r--r-- | theme/list_lib.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/theme/list_lib.js b/theme/list_lib.js index 094cc266a..88a621028 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -736,6 +736,28 @@ function lastNonZero() } /** +*Return the HTML string for a dive weight entry in the table. +*/ +function get_weight_HTML(weight) +{ + return '<tr><td class="Cyl">' + gram_to_km(weight.weight) + ' kg ' + '</td><td class="Cyl">' + weight.description + '</td></tr>'; +} + +/** +*Return HTML table of weights of a dive. +*/ +function get_weights_HTML(dive) +{ + var result = ""; + result += '<table><tr><td class="words">Weight</td><td class="words">Type</td></tr>'; + for (var i in dive.Weights) { + result += get_weight_HTML(dive.Weights[i]); + } + result += '</table>'; + return result; +} + +/** *Return the HTML string for a dive cylinder entry in the table. */ function get_cylinder_HTML(cylinder) @@ -890,6 +912,11 @@ function mm_to_meter(mm) return mm / (1000); } +function gram_to_km(gram) +{ + return gram / 1000; +} + function ml_to_litre(ml) { return ml / (1000); @@ -1067,6 +1094,7 @@ function showDiveDetails(dive) //draw the canvas and initialize the view document.getElementById("diveinfo").innerHTML = get_dive_HTML(items[dive_id]); document.getElementById("dive_equipments").innerHTML = get_cylinders_HTML(items[dive_id]); + document.getElementById("dive_equipments").innerHTML += get_weights_HTML(items[dive_id]); document.getElementById("bookmarks").innerHTML = get_bookmarks_HTML(items[dive_id]); document.getElementById("divestats").innerHTML = get_status_HTML(items[dive_id]); document.getElementById("slider").innerHTML = get_dive_photos(items[dive_id]); |