+ OSM.router.route("/search?lat=" + encodeURIComponent(lat) + "&lon=" + encodeURIComponent(lng));
+ });
+
+ $("#sidebar_content")
+ .on("click", ".search_more a", clickSearchMore)
+ .on("click", ".search_results_entry a.set_position", clickSearchResult)
+ .on("mouseover", "li.search_results_entry:has(a.set_position)", showSearchResult)
+ .on("mouseout", "li.search_results_entry:has(a.set_position)", hideSearchResult);
+
+ var markers = L.layerGroup().addTo(map);
+
+ function clickSearchMore(e) {
+ e.preventDefault();
+ e.stopPropagation();
+
+ var div = $(this).parents(".search_more"),
+ csrf_param = $("meta[name=csrf-param]").attr("content"),
+ csrf_token = $("meta[name=csrf-token]").attr("content"),
+ params = {};
+
+ $(this).hide();
+ div.find(".loader").show();
+
+ params[csrf_param] = csrf_token;
+
+ $.ajax({
+ url: $(this).attr("href"),
+ method: "POST",
+ data: params,
+ success: function (data) {
+ div.replaceWith(data);
+ }
+ });
+ }