diff options
author | Gehad <gehadelrobey@gmail.com> | 2014-04-04 16:39:39 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-04-04 08:23:26 -0700 |
commit | a6fcd4f99f22342da67dadb149d66f3f4ecec061 (patch) | |
tree | 3f29eef830b507a11d82667f8d348dc62c26be84 /worldmap-save.c | |
parent | 9a0e40b456351f3895f46ae51c4d3ba0b62c74f2 (diff) | |
download | subsurface-a6fcd4f99f22342da67dadb149d66f3f4ecec061.tar.gz |
Javascript exported code throws errors when dives are missing
The world map exported Javascript sometimes fail because dives with
no coarinates are neglected during exporting which leaves some array
indexes missing and corrupt the javascript.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'worldmap-save.c')
-rw-r--r-- | worldmap-save.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/worldmap-save.c b/worldmap-save.c index b1a8ce68d..c193d72c1 100644 --- a/worldmap-save.c +++ b/worldmap-save.c @@ -85,7 +85,7 @@ void put_HTML_notes(struct membuffer *b, struct dive *dive) void writeMarkers(struct membuffer *b) { - int i; + int i, dive_no = 0; struct dive *dive; for_each_dive(i, dive) { @@ -102,8 +102,9 @@ void writeMarkers(struct membuffer *b) put_HTML_temp(b, dive); put_HTML_notes(b, dive); put_string(b, "</p>'+'</div>'+'</div>'});\ninfowindows.push(tempinfowindow);\n"); - put_format(b, "google.maps.event.addListener(markers[%d], 'mouseover', function() {\ninfowindows[%d].open(map,markers[%d]);}", i, i, i); - put_format(b, ");google.maps.event.addListener(markers[%d], 'mouseout', function() {\ninfowindows[%d].close();});\n", i, i); + put_format(b, "google.maps.event.addListener(markers[%d], 'mouseover', function() {\ninfowindows[%d].open(map,markers[%d]);}", dive_no, dive_no, dive_no); + put_format(b, ");google.maps.event.addListener(markers[%d], 'mouseout', function() {\ninfowindows[%d].close();});\n", dive_no, dive_no); + dive_no++; } } |