X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/7503caa750f2788e2412e5b7f8ed37210b7407c3..0ff7a928e4359b177a43b7d2e8e1e0e468c2be53:/app/assets/javascripts/leaflet.share.js diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index 6a4491c2a..b991210df 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -120,6 +120,21 @@ L.OSM.share = function (options) { .text(I18n.t('javascripts.share.paste_html')) .appendTo($linkSection)); + // Geo URI + + var $geoUriSection = $('
') + .attr('class', 'section share-geo-uri') + .appendTo($ui); + + $('

') + .text(I18n.t('javascripts.share.geo_uri')) + .appendTo($geoUriSection); + + $('
') + .appendTo($geoUriSection) + .append($('') + .attr('id', 'geo_uri')); + // Image var $imageSection = $('
') @@ -230,6 +245,7 @@ L.OSM.share = function (options) { update(); options.sidebar.togglePane($ui, button); + $('.leaflet-control .control-button').tooltip('hide'); } function toggleMarker() { @@ -273,6 +289,19 @@ L.OSM.share = function (options) { update(); } + function escapeHTML(string) { + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + return string === null ? '' : (string + '').replace(/[&<>"']/g, function(match) { + return htmlEscapes[match]; + }); + } + function update() { var bounds = map.getBounds(); @@ -306,6 +335,12 @@ L.OSM.share = function (options) { '' + escapeHTML(I18n.t('javascripts.share.view_larger_map')) + ''); + // Geo URI + + $('#geo_uri') + .attr('href', map.getGeoUri(marker)) + .html(map.getGeoUri(marker)); + // Image if (locationFilter.isEnabled()) {