diff options
| author | David Drury <ddrury@users.noreply.github.com> | 2016-06-22 16:19:22 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2016-06-22 16:19:22 +0100 |
| commit | a199a2bedee11049f20cbdac8d2c9b6848190b5c (patch) | |
| tree | a2a3e7406c7a641446bedeaf0eb80a644e7594bf /app/Module | |
| parent | 16006acab6931b647601d3f31bdd165ca528c259 (diff) | |
| download | webtrees-a199a2bedee11049f20cbdac8d2c9b6848190b5c.tar.gz webtrees-a199a2bedee11049f20cbdac8d2c9b6848190b5c.tar.bz2 webtrees-a199a2bedee11049f20cbdac8d2c9b6848190b5c.zip | |
Reinstate use data attribute instead of id (#1028)
Diffstat (limited to 'app/Module')
| -rw-r--r-- | app/Module/GoogleMapsModule.php | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/app/Module/GoogleMapsModule.php b/app/Module/GoogleMapsModule.php index 4be2450011..f353abd266 100644 --- a/app/Module/GoogleMapsModule.php +++ b/app/Module/GoogleMapsModule.php @@ -1178,7 +1178,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, infowindow.close(); infowindow.setContent(mhtml); infowindow.open(pm_map, marker); - var el = jQuery("#gm-marker_" + marker.id); + var el = jQuery(".gm-ancestor[data-marker=" + marker.id + "]"); if(el.hasClass("person_box")) { el .removeClass("person_box") @@ -1194,7 +1194,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, }); // save the info we need to use later for the side bar gmarkers[index] = marker; - gm_ancestors_html += "<div id=\"gm-marker_" + index++ + "\" class=\"gm-ancestor\">" + html +"</div>"; + gm_ancestors_html += "<div data-marker =" + index++ + " class=\"gm-ancestor\">" + html +"</div>"; return marker; }; @@ -1342,7 +1342,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, pm_map.setCenter(bounds.getCenter()); // Close the sidebar highlight when the infowindow is closed google.maps.event.addListener(infowindow, "closeclick", function() { - jQuery("#gm-marker_" + lastlinkid).toggleClass("gm-ancestor-visited person_box"); + jQuery(".gm-ancestor[data-marker=" + lastlinkid + "]").toggleClass("gm-ancestor-visited person_box"); lastlinkid = null; }); // put the assembled gm_ancestors_html contents into the gm-ancestors div @@ -1354,10 +1354,9 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, }) .on("click", function(e) { if (lastlinkid != null) { - jQuery("#gm-marker_" + lastlinkid).toggleClass("person_box gm-ancestor-visited"); + jQuery(".gm-ancestor[data-marker=" + lastlinkid + "]").toggleClass("person_box gm-ancestor-visited"); } - var el = jQuery(this).closest(".gm-ancestor"); - var target = el.attr("id").split("_").pop(); + var target = jQuery(this).closest(".gm-ancestor").data("marker"); google.maps.event.trigger(gmarkers[target], "click"); }); '; |
