From: Tom Hughes Date: Thu, 20 Feb 2025 22:08:02 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/5694' X-Git-Tag: live~188 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/51a2d85053b67b2bc842fa45ac8eb998f8585add?ds=inline;hp=-c Merge remote-tracking branch 'upstream/pull/5694' --- 51a2d85053b67b2bc842fa45ac8eb998f8585add diff --combined app/assets/javascripts/index/directions.js index 3d6da84fc,c472108ae..3d52ec9fb --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@@ -36,6 -36,8 +36,8 @@@ OSM.Directions = function (map) OSM.DirectionsEndpoint(map, $("input[name='route_to']"), OSM.MARKER_RED, endpointDragCallback, endpointChangeCallback) ]; + let downloadURL = null; + const expiry = new Date(); expiry.setYear(expiry.getFullYear() + 10); @@@ -73,8 -75,8 +75,8 @@@ $(".directions_form .btn-close").on("click", function (e) { e.preventDefault(); - $(".describe_location").toggle(!endpoints[0].value); - $(".search_form input[name='query']").val(endpoints[0].value); + $(".describe_location").toggle(!endpoints[1].value); + $(".search_form input[name='query']").val(endpoints[1].value); OSM.router.route("/" + OSM.formatHash(map)); }); @@@ -189,6 -191,16 +191,16 @@@ turnByTurnTable.append(row); }); + const blob = new Blob([JSON.stringify(polyline.toGeoJSON())], { type: "application/json" }); + URL.revokeObjectURL(downloadURL); + downloadURL = URL.createObjectURL(blob); + + $("#sidebar_content").append(`

${ + I18n.t("javascripts.directions.download") + }

`); + $("#sidebar_content").append("

" + I18n.t("javascripts.directions.instructions.courtesy", { link: chosenEngine.creditline }) + "

"); diff --combined config/locales/en.yml index 0320bc2a6,afc09c519..dd7ae4033 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@@ -244,7 -244,7 +244,7 @@@ en comment: Comment full: Full note accounts: - edit: + show: title: "Edit account" my_account: My Account current email address: "Current Email Address" @@@ -3312,6 -3312,8 +3312,8 @@@ ninth: "9th" tenth: "10th" time: "Time" + download: "Download route as GeoJSON" + filename: "route" query: node: Node way: Way