]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.share.js
Add a Geo URI link to the share panel
[rails.git] / app / assets / javascripts / leaflet.share.js
index 44d02c0973f30f92766babce8a5c02090ba05cb2..b991210dfad5a063fcc48d76181c0deb5e72a2c6 100644 (file)
@@ -120,6 +120,21 @@ L.OSM.share = function (options) {
           .text(I18n.t('javascripts.share.paste_html'))
           .appendTo($linkSection));
 
+    // Geo URI
+
+    var $geoUriSection = $('<div>')
+      .attr('class', 'section share-geo-uri')
+      .appendTo($ui);
+
+    $('<h4>')
+      .text(I18n.t('javascripts.share.geo_uri'))
+      .appendTo($geoUriSection);
+
+    $('<div>')
+      .appendTo($geoUriSection)
+      .append($('<a>')
+        .attr('id', 'geo_uri'));
+
     // Image
 
     var $imageSection = $('<div>')
@@ -320,6 +335,12 @@ L.OSM.share = function (options) {
           '<small><a href="' + escapeHTML(map.getUrl(marker)) + '">' +
           escapeHTML(I18n.t('javascripts.share.view_larger_map')) + '</a></small>');
 
+      // Geo URI
+
+      $('#geo_uri')
+        .attr('href', map.getGeoUri(marker))
+        .html(map.getGeoUri(marker));
+
       // Image
 
       if (locationFilter.isEnabled()) {