-
- $(".search_form").on("submit", function(e) {
- e.preventDefault();
- if ($(".query_wrapper.routing").is(":visible")) {
- // Routing
- OSM.routing.requestRoute();
- } else {
- // Search
- $("header").addClass("closed");
- var query = $(this).find("input[name=query]").val();
- if (query) {
- OSM.router.route("/search?query=" + encodeURIComponent(query) + OSM.formatHash(map));
- } else {
- OSM.router.route("/" + OSM.formatHash(map));
- }
- }
- });
-
- $(".describe_location").on("click", function(e) {
- e.preventDefault();
- var precision = zoomPrecision(map.getZoom());
- OSM.router.route("/search?query=" + encodeURIComponent(
- map.getCenter().lat.toFixed(precision) + "," +
- map.getCenter().lng.toFixed(precision)));
- });
-
- $(".get_directions").on("click",function(e) {
- e.preventDefault();
- $(".query_wrapper.search").hide();
- $(".query_wrapper.routing").show();
- $(".query_wrapper.routing [name=route_from]").focus();
- });
-
- $(".close_directions").on("click",function(e) {
- e.preventDefault();
- $(".query_wrapper.search").show();
- $(".query_wrapper.routing").hide();
- $(".query_wrapper.search [name=query]").focus();
- });
-
- OSM.routing = OSM.Routing(map,'OSM.routing',$('.query_wrapper.routing'));
-