Skip to content

Commit

Permalink
Reinstate use data attribute instead of id (#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddrury authored and fisharebest committed Jun 22, 2016
1 parent 16006ac commit a199a2b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions app/Module/GoogleMapsModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ function createMarker(point, name, html, mhtml, icontype) {
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")
Expand All @@ -1194,7 +1194,7 @@ function createMarker(point, name, html, mhtml, icontype) {
});
// 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;
};
Expand Down Expand Up @@ -1342,7 +1342,7 @@ function createMarker(point, name, html, mhtml, icontype) {
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
Expand All @@ -1354,10 +1354,9 @@ function createMarker(point, name, html, mhtml, icontype) {
})
.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");
});
';
Expand Down

0 comments on commit a199a2b

Please sign in to comment.