diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2014-08-27 20:19:20 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-08-28 07:43:14 -0700 |
commit | abfa4f2108080d17aec969c56b0b4d546b85365c (patch) | |
tree | 6c4917df6bd1b572511b526b4df7bca58ddb88cf /theme | |
parent | 4099aca82d3e70add15f0c5a770e6ec1c8bcf790 (diff) | |
download | subsurface-abfa4f2108080d17aec969c56b0b4d546b85365c.tar.gz |
HTML: export valid JSON.
Remove the trailing commas from the exported JSON file as some json
parsers just don't like it. The file 'file.json' is valid acording to
the JSON spesification.
Note: its a javascript file containing a JS variable 'trips' and not a
JSON file. Because loading a pure JSON file from local disk is not
accepted by the web-browsers itself. Actually I think changing the file
extension to .js is now makes more sense.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'theme')
-rw-r--r-- | theme/list_lib.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/theme/list_lib.js b/theme/list_lib.js index d3f9f8cac..775d83e4b 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -897,7 +897,7 @@ function get_bookmark_HTML(event) */ function get_bookmarks_HTML(dive) { - if (dive.events <= 0) + if (!dive.events || dive.events <= 0) return ""; var result = ""; result += '<h2 class="det_hed">' + translate.Events + '</h2><table><tr><td class="words">' + translate.Name + '</td><td class="words">' + translate.Time + '</td><td class="words">' + translate.Value + '</td></tr>'; @@ -976,7 +976,7 @@ function get_status_HTML(dive) function get_dive_photos(dive) { - if (dive.photos.length <= 0) { + if (!dive.photos || dive.photos.length <= 0) { document.getElementById("divephotos").style.display = 'none'; return ""; } @@ -1092,11 +1092,13 @@ function canvas_draw() } } } - for (var i = 0; i < items[dive_id].events.length; i++) { - eventsData.push([ - items[dive_id].events[i].time / 60, - 0 - ]); + if (items[dive_id].events) { + for (var i = 0; i < items[dive_id].events.length; i++) { + eventsData.push([ + items[dive_id].events[i].time / 60, + 0 + ]); + } } if (plot1) { $('chart1').unbind(); |