- function clickSearchResult(e) {
- var data = $(this).data(),
+ function showSearchResult(e) {
+ var marker = $(this).data("marker");
+
+ if (!marker) {
+ var data = $(this).find("a.set_position").data();
+
+ marker = L.marker([data.lat, data.lon]);
+
+ $(this).data("marker", marker);
+ }
+
+ map.addLayer(marker);
+
+ $(this).closest("li").addClass("selected");
+ }
+
+ function hideSearchResult(e) {
+ var marker = $(this).data("marker");
+
+ if (marker) {
+ map.removeLayer(marker);
+ }
+
+ $(this).closest("li").removeClass("selected");
+ }
+
+ function clickSearchResult(result, e) {
+ var link = $(result).find("a.set_position"),
+ data = link.data(),