]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index.js
Make directions endpoints own the value and not care which input box they get it...
[rails.git] / app / assets / javascripts / index.js
index b89d6c71d55cf9e56b5d53a40fc788c5803e7d67..afb6b3d6546b3de788bf0a834c0c6db72ac3b494 100644 (file)
@@ -6,6 +6,7 @@
 //= require leaflet.note
 //= require leaflet.share
 //= require leaflet.polyline
+//= require leaflet.query
 //= require index/search
 //= require index/browse
 //= require index/export
@@ -15,6 +16,7 @@
 //= require index/new_note
 //= require index/directions
 //= require index/changeset
+//= require index/query
 //= require router
 
 $(document).ready(function () {
@@ -126,6 +128,11 @@ $(document).ready(function () {
     sidebar: sidebar
   }).addTo(map);
 
+  L.OSM.query({
+    position: position,
+    sidebar: sidebar
+  }).addTo(map);
+
   L.control.scale()
     .addTo(map);
 
@@ -157,15 +164,6 @@ $(document).ready(function () {
     $.cookie("_osm_location", OSM.locationCookie(map), { expires: expiry, path: "/" });
   });
 
-  if ($.cookie('_osm_sotm') == 'hide') {
-    $('#sotm').hide();
-  }
-
-  $('#sotm .close').on('click', function() {
-    $('#sotm').hide();
-    $.cookie("_osm_sotm", 'hide', { expires: expiry });
-  });
-
   if ($.cookie('_osm_welcome') == 'hide') {
     $('.welcome').hide();
   }
@@ -238,6 +236,10 @@ $(document).ready(function () {
     };
 
     page.load = function() {
+      var params = querystring.parse(location.search.substring(1));
+      if (params.query) {
+        $("#sidebar .search_form input[name=query]").value(params.query);
+      }
       if (!("autofocus" in document.createElement("input"))) {
         $("#sidebar .search_form input[name=query]").focus();
       }
@@ -294,7 +296,8 @@ $(document).ready(function () {
     "/node/:id(/history)":         OSM.Browse(map, 'node'),
     "/way/:id(/history)":          OSM.Browse(map, 'way'),
     "/relation/:id(/history)":     OSM.Browse(map, 'relation'),
-    "/changeset/:id":              OSM.Changeset(map)
+    "/changeset/:id":              OSM.Changeset(map),
+    "/query":                      OSM.Query(map)
   });
 
   if (OSM.preferred_editor == "remote" && document.location.pathname == "/edit") {