aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--save-html.c13
-rw-r--r--theme/list_lib.js24
2 files changed, 37 insertions, 0 deletions
diff --git a/save-html.c b/save-html.c
index 6ce0f3ab7..bad1ef41c 100644
--- a/save-html.c
+++ b/save-html.c
@@ -11,6 +11,18 @@ void write_attribute(struct membuffer *b, const char *att_name, const char *valu
put_string(b, "\",");
}
+void put_HTML_bookmarks(struct membuffer *b, struct dive *dive)
+{
+ struct event *ev = dive->dc.events;
+ put_string(b, "\"events\":[");
+ while (ev) {
+ put_format(b, "{\"name\":\"%s\",", ev->name);
+ put_format(b, "\"time\":\"%d:%02d min\",},", FRACTION(ev->time.seconds, 60));
+ ev = ev->next;
+ }
+ put_string(b, "],");
+}
+
static void put_cylinder_HTML(struct membuffer *b, struct dive *dive)
{
int i, nr;
@@ -155,6 +167,7 @@ void write_one_dive(struct membuffer *b, struct dive *dive, int *dive_no, const
if (!list_only) {
put_cylinder_HTML(b, dive);
put_HTML_samples(b, dive);
+ put_HTML_bookmarks(b, dive);
}
put_string(b, "},\n");
(*dive_no)++;
diff --git a/theme/list_lib.js b/theme/list_lib.js
index 20dc5a79e..e1ea5644f 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -826,6 +826,29 @@ function get_cylinders_HTML(dive)
}
/**
+Return the HTML string for a bookmark entry in the table.
+*/
+function get_bookmark_HTML(event)
+{
+ return '<tr><td class="Cyl">' + event.name + '</td><td class="Cyl">' + event.time + '</td></tr>';
+}
+
+/**
+*Return HTML table of bookmarks of a dive.
+*/
+function get_bookmarks_HTML(dive)
+{
+ var result = "";
+ result += '<h2 class="det_hed">Events</h2><table><tr><td class="words">Name</td><td class="words">Time</td></tr>';
+ for (var i in dive.events) {
+ result += get_bookmark_HTML(dive.events[i]);
+ }
+ result += '</table>';
+ return result;
+}
+
+
+/**
*Return HTML main data of a dive
*/
function get_dive_HTML(dive)
@@ -886,6 +909,7 @@ function showDiveDetails(dive)
canvas_draw();
document.getElementById("diveinfo").innerHTML = get_dive_HTML(items[dive_id]);
document.getElementById("dive_equipments").innerHTML = get_cylinders_HTML(items[dive_id]);
+ document.getElementById("bookmarks").innerHTML=get_bookmarks_HTML(items[dive_id]);
//hide the list of dives and show the canvas.
document.getElementById("diveListPanel").style.display = 'none';