X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/bd2e999756de84c91593c693fcbef47778936a65..7dbf8d83369cb73929080c4ba23fdd7dcd0184df:/app/assets/javascripts/leaflet.share.js diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index 44d02c097..044c767cf 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 = $('
') @@ -130,7 +145,14 @@ L.OSM.share = function (options) { .text(I18n.t('javascripts.share.image')) .appendTo($imageSection); + $('
') + .attr('id', 'export-warning') + .attr('class', 'deemphasize') + .text(I18n.t('javascripts.share.only_standard_layer')) + .appendTo($imageSection); + $form = $('
') + .attr('id', 'export-image') .attr('class', 'standard-form') .attr('action', '/export/finish') .attr('method', 'post') @@ -191,6 +213,15 @@ L.OSM.share = function (options) { .attr('type', 'hidden') .appendTo($form); + var csrf_param = $("meta[name=csrf-param]").attr("content"), + csrf_token = $("meta[name=csrf-token]").attr("content"); + + $('') + .attr('name', csrf_param) + .attr('value', csrf_token) + .attr('type', 'hidden') + .appendTo($form); + $('

') .attr('class', 'deemphasize') .html(I18n.t('javascripts.share.image_size') + ' x ') @@ -315,11 +346,17 @@ L.OSM.share = function (options) { $('#embed_html').val( '
' + '
' + 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()) { @@ -343,6 +380,14 @@ L.OSM.share = function (options) { $("#mapnik_image_width").text(Math.round(size.x / scale / 0.00028)); $("#mapnik_image_height").text(Math.round(size.y / scale / 0.00028)); + + if (map.getMapBaseLayerId() === 'mapnik') { + $('#export-image').show(); + $('#export-warning').hide(); + } else { + $('#export-image').hide(); + $('#export-warning').show(); + } } function select() {