From 2cd14580aba7f580fd0abbf96f117b672c644ba9 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Tue, 15 Feb 2022 10:54:40 +0100 Subject: [PATCH] Narweb: code simplification --- gramps/plugins/webreport/place.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/gramps/plugins/webreport/place.py b/gramps/plugins/webreport/place.py index 2b8adca2b..0be9ffde4 100644 --- a/gramps/plugins/webreport/place.py +++ b/gramps/plugins/webreport/place.py @@ -523,11 +523,10 @@ class PlacePages(BasePage): if photo_hdle in self.report.obj_dict[Media]: tracelife += str(imglnk) break # We show only the first image - scripts = Html() - if self.mapservice == "Google": - with Html("script", type="text/javascript", - indent=False) as jsc: - scripts += jsc + with Html("script", type="text/javascript", + indent=False) as jsc: + if self.mapservice == "Google": + # scripts += jsc # Google adds Latitude/ Longitude to its maps... plce = placetitle.replace("'", "\\'") jsc += MARKER_PATH % marker_path @@ -537,18 +536,14 @@ class PlacePages(BasePage): 1, tracelife]], latitude, longitude, 10) - elif self.mapservice == "OpenStreetMap": - with Html("script", type="text/javascript") as jsc: - scripts += jsc + elif self.mapservice == "OpenStreetMap": jsc += MARKER_PATH % marker_path jsc += OSM_MARKERS % ([[float(longitude), float(latitude), placetitle, tracelife]], longitude, latitude, 10) jsc += OPENLAYER - else: # STAMEN - with Html("script", type="text/javascript") as jsc: - scripts += jsc + else: # STAMEN jsc += MARKER_PATH % marker_path jsc += STAMEN_MARKERS % ([[float(longitude), float(latitude), @@ -556,7 +551,7 @@ class PlacePages(BasePage): self.stamenopts, longitude, latitude, 10) jsc += OPENLAYER - placedetail += scripts + placedetail += jsc # add clearline for proper styling # add footer section