]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/search.js
Rejig changeset details in the style of danstowell
[rails.git] / app / assets / javascripts / index / search.js
index 132447ec5b3e81bfa386355bb5b7f2c2f24aefd7..52920d8bb90fbaf3eb176344f7ddf5721c4d859c 100644 (file)
@@ -7,10 +7,27 @@ OSM.Search = function(map) {
       $("#describe_location").fadeIn(100);
     });
 
-  $("#sidebar_content").on("click", ".search_results_entry a.set_position", clickSearchResult);
+  $("#sidebar_content")
+    .on("click", ".search_more a", clickSearchMore)
+    .on("click", ".search_results_entry a.set_position", clickSearchResult);
+
+  function clickSearchMore(e) {
+    e.preventDefault();
+    e.stopPropagation();
+
+    var div = $(this).parents(".search_more");
+
+    $(this).hide();
+    div.find(".loader").show();
+
+    $.get($(this).attr("href"), function(data) {
+      div.replaceWith(data);
+    });
+  }
 
   function clickSearchResult(e) {
     e.preventDefault();
+    e.stopPropagation();
 
     var data = $(this).data(),
       center = L.latLng(data.lat, data.lon);