//= require leaflet.key
//= require leaflet.note
//= require leaflet.share
+//= require leaflet.polyline
+ //= require leaflet.query
//= require index/search
//= require index/browse
//= require index/export
//= require index/history
//= require index/note
//= require index/new_note
+//= require index/directions
//= require index/changeset
+ //= require index/query
//= require router
-(function() {
+$(document).ready(function () {
var loaderTimeout;
OSM.loadSidebarContent = function(path, callback) {
+ map.setSidebarOverlaid(false);
+
clearTimeout(loaderTimeout);
loaderTimeout = setTimeout(function() {
}
});
};
-})();
-$(document).ready(function () {
var params = OSM.mapParams();
var map = new L.OSM.Map("map", {
sidebar: sidebar
}).addTo(map);
+ L.OSM.query({
+ position: position,
+ sidebar: sidebar
+ }).addTo(map);
+
L.control.scale()
.addTo(map);
$.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();
}
OSM.Index = function(map) {
var page = {};
- page.pushstate = function() {
- $("#content").addClass("overlay-sidebar");
- map.invalidateSize({pan: false})
- .panBy([-350, 0], {animate: false});
+ page.pushstate = page.popstate = function() {
+ map.setSidebarOverlaid(true);
document.title = I18n.t('layouts.project_name.title');
};
return map.getState();
};
- page.popstate = function() {
- $("#content").addClass("overlay-sidebar");
- map.invalidateSize({pan: false});
- document.title = I18n.t('layouts.project_name.title');
- };
-
- page.unload = function() {
- map.panBy([350, 0], {animate: false});
- $("#content").removeClass("overlay-sidebar");
- map.invalidateSize({pan: false});
- };
-
return page;
};
OSM.router = OSM.Router(map, {
"/": OSM.Index(map),
"/search": OSM.Search(map),
+ "/directions": OSM.Directions(map),
"/export": OSM.Export(map),
"/note/new": OSM.NewNote(map),
"/history/friends": history,
"/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") {
});
}
+ params = params.concat(Array.prototype.slice.call(arguments, 2));
+
return (controller[action] || $.noop).apply(controller, params);
};
if (window.history && window.history.pushState) {
$(window).on('popstate', function(e) {
if (!e.originalEvent.state) return; // Is it a real popstate event or just a hash change?
- var path = window.location.pathname + window.location.search;
+ var path = window.location.pathname + window.location.search,
+ route = routes.recognize(path);
if (path === currentPath) return;
- currentRoute.run('unload');
+ currentRoute.run('unload', null, route === currentRoute);
currentPath = path;
- currentRoute = routes.recognize(currentPath);
+ currentRoute = route;
currentRoute.run('popstate', currentPath);
map.setState(e.originalEvent.state, {animate: false});
});
var path = url.replace(/#.*/, ''),
route = routes.recognize(path);
if (!route) return false;
- currentRoute.run('unload');
+ currentRoute.run('unload', null, route === currentRoute);
var state = OSM.parseHash(url);
map.setState(state);
window.history.pushState(state, document.title, url);
return true;
};
+ router.replace = function (url) {
+ window.history.replaceState(OSM.parseHash(url), document.title, url);
+ };
+
router.stateChange = function(state) {
if (state.center) {
window.history.replaceState(state, document.title, OSM.formatHash(state));
}
};
} else {
- router.route = function (url) {
+ router.route = router.replace = function (url) {
window.location.assign(url);
};
.icon.close:hover { background-position: -200px -20px; }
.icon.check { background-position: -220px 0; }
.icon.note { background-position: -240px 0; }
- .icon.gear { background-position: -260px 0; }
+ .icon.query { background-position: -260px 0; }
/* Rules for links */
background-color: black;
}
- &.active {
- background-color: #9ed485;
- }
-
&.disabled {
background-color: #333;
background-color: rgba(0,0,0,.5);
cursor: default;
}
+ &.active {
+ background-color: #9ed485;
+ }
+
.icon {
margin: 10px;
}
#map {
height: 100%;
overflow: hidden;
+
+ &.query-active {
+ cursor: help;
+ }
+
+ &.query-disabled {
+ cursor: not-allowed;
+ }
}
#map-ui {
}
}
-/* Rules for the search box */
+/* Rules for the search and direction forms */
-header .search_form {
+header .search_forms,
+.directions_form {
display: none;
}
-.search_form {
+.search_form,
+.directions_form {
position: relative;
padding: $lineheight/2;
+ padding-top: 1px;
background-color: $lightgrey;
.query_wrapper {
border-radius: 0 2px 2px 0;
}
- .describe_location {
- position: absolute;
- top: 6px;
- right: 6px;
+ .query_options {
+ text-align: right;
font-size: 10px;
color: $blue;
}
color: #f00;
}
+/* Rules for routing */
+
+#sidebar_content>table {
+ padding: 5px 20px 10px 15px;
+ width: 100%;
+ border-collapse: separate;
+}
+
+td.direction {
+ background-image: image-url('routing-sprite.png');
+ width: 20px; height: 20px;
+ background-repeat: no-repeat;
+}
+@for $i from 1 through 17 {
+td.direction.i#{$i} { background-position: #{($i)*-20+20}px 0px; }
+}
+
+.directions_form input[type="submit"] {
+ margin-top: 30px !important;
+}
+
+p#routing_summary {
+ padding: 0 $lineheight $lineheight/4;
+}
+
+td.instruction, td.distance {
+ padding-top: 0;
+ border-bottom: 1px solid #DDD;
+}
+td.distance {
+ color: #BBB;
+ text-align: right;
+ font-size: x-small;
+}
+tr.turn {
+ cursor: pointer;
+}
+tr.turn:hover {
+ background: lighten($green, 30%);
+}
+.routing_engines, #route_from, #route_to { margin-left: 25px; }
+.routing_marker { width: 15px; position: absolute; }
+
/* Rules for entity history */
#sidebar_content {
overflow: hidden;
margin: 0 0 10px 10px;
}
+
+ .query-intro p {
+ padding: $lineheight $lineheight $lineheight/2;
+ }
+
+ .query-results {
+ display: none;
+
+ h3 {
+ padding: $lineheight $lineheight $lineheight/2;
+ margin: 0;
+ }
+
+ ul {
+ li {
+ padding: 15px 20px;
+ border-bottom: 1px solid #ddd;
+
+ &.query-result {
+ cursor: pointer;
+ }
+
+ &.selected {
+ background: #FFFFE6;
+ }
+ }
+ }
+ }
}
/* Rules for export sidebar */
}
}
+/* Rules for the routing sidebar */
+
+#sidebar_content {
+ #routing_credit {
+ text-align: center;
+ padding: 0.5em;
+ }
+}
+
/* Rules for edit pages */
.site-edit {
}
}
- #sidebar #sotm {
- padding: 10px;
- min-height: 120px;
-
- img {
- float: left;
- width: 100px;
- height: 100px;
- }
-
- h2 {
- margin-left: 100px;
- padding: 7px 10px 6px 15px;
- }
-
- p {
- margin-left: 100px;
- padding: 6px 10px 7px 15px;
- }
-
- a {
- color: $darkgrey;
- }
-
- :hover {
- text-decoration: none;
- color: darken($darkgrey, 25%);
- }
- }
-
@import 'browse';
@media only screen and (max-width:960px) {
reopened_by: "Reactivated by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
reopened_by_anonymous: "Reactivated by anonymous <abbr title='%{exact_time}'>%{when} ago</abbr>"
hidden_by: "Hidden by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
+ query:
+ title: "Query Features"
+ introduction: "Click on the map to find nearby features."
+ nearby: "Nearby features"
+ enclosing: "Enclosing features"
changeset:
changeset_paging_nav:
showing_page: "Page %{page}"
primary_link: "Primary Road"
proposed: "Proposed Road"
raceway: "Raceway"
- residential: "Residential"
+ residential: "Residential Road"
rest_area: "Rest Area"
road: "Road"
secondary: "Secondary Road"
tram: "Tramway"
tram_stop: "Tram Stop"
yard: "Railway Yard"
+ route:
+ bus: "Bus Route"
shop:
alcohol: "Off License"
antiques: "Antiques"
text: Make a Donation
learn_more: "Learn More"
more: More
- sotm_header: State of the Map 2014
- sotm_line_1: 8th Annual Conference
- sotm_line_2: November 7th-9th 2014
- sotm_line_3: Buenos Aires, Argentina
license_page:
foreign:
title: About this translation
close: Close
search:
search: Search
+ get_directions: "Get directions"
+ get_directions_title: "Find directions between two points"
+ close_directions: "Close directions"
+ close_directions_title: "Close the directions panel"
+ from: "From"
+ to: "To"
where_am_i: "Where am I?"
where_am_i_title: Describe the current location using the search engine
submit_text: "Go"
createnote_disabled_tooltip: Zoom in to add a note to the map
map_notes_zoom_in_tooltip: Zoom in to see map notes
map_data_zoom_in_tooltip: Zoom in to see map data
+ queryfeature_tooltip: Query features
+ queryfeature_disabled_tooltip: Zoom in to query features
changesets:
show:
comment: "Comment"
comment_and_resolve: Comment & Resolve
comment: Comment
edit_help: Move the map and zoom in on a location you want to edit, then click here.
+ directions:
+ engines:
+ graphhopper_bicycle: "Bicycle (GraphHopper)"
+ graphhopper_foot: "Foot (GraphHopper)"
+ mapquest_bicycle: "Bicycle (MapQuest)"
+ mapquest_car: "Car (MapQuest)"
+ mapquest_foot: "Foot (MapQuest)"
+ osrm_car: "Car (OSRM)"
+ directions: "Directions"
+ distance: "Distance"
+ errors:
+ no_route: "Couldn't find a route between those two places."
+ no_place: "Sorry - couldn't find that place."
+ instructions:
+ continue_on: "Continue on "
+ slight_right: "Slight right onto "
+ turn_right: "Turn right onto "
+ sharp_right: "Sharp right onto "
+ uturn: "U-turn along "
+ sharp_left: "Sharp left onto "
+ turn_left: "Turn left onto "
+ slight_left: "Slight left onto "
+ via_point: "(via point) "
+ follow: "Follow "
+ roundabout: "At roundabout take "
+ leave_roundabout: "Leave roundabout - "
+ stay_roundabout: "Stay on roundabout - "
+ start: "Start at end of "
+ destination: "Reach destination"
+ against_oneway: "Go against one-way on "
+ end_oneway: "End of one-way on "
+ unnamed: "(unnamed)"
+ courtesy: "Directions courtesy of %{link}"
+ time: "Time"
+ query:
+ node: Node
+ way: Way
+ relation: Relation
+ nothing_found: No features found
+ error: "Error contacting %{server}: %{error}"
+ timeout: "Timeout contacting %{server}"
redaction:
edit:
description: "Description"
match '/offline' => 'site#offline', :via => :get
match '/key' => 'site#key', :via => :get
match '/id' => 'site#id', :via => :get
+ match '/query' => 'browse#query', :via => :get
match '/user/new' => 'user#new', :via => :get
match '/user/new' => 'user#create', :via => :post
match '/user/terms' => 'user#terms', :via => :get
match '/geocoder/search_osm_nominatim_reverse' => 'geocoder#search_osm_nominatim_reverse', :via => :get
match '/geocoder/search_geonames_reverse' => 'geocoder#search_geonames_reverse', :via => :get
+ # directions
+ match '/directions' => 'directions#search', :via => :get, :as => :directions
+
# export
match '/export/finish' => 'export#finish', :via => :post
match '/export/embed' => 'export#embed', :via => :get