From abfa4f2108080d17aec969c56b0b4d546b85365c Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Wed, 27 Aug 2014 20:19:20 +0300 Subject: 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 Signed-off-by: Dirk Hohndel --- theme/list_lib.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'theme') 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 += '

' + translate.Events + '

'; @@ -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(); -- cgit v1.2.3-70-g09d2
' + translate.Name + '' + translate.Time + '' + translate.Value + '