X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/9172695f7f94bb60dd01455a922e22d181eb284e..bab796bc7eb0b44eeb15d6fee567440647bc57e0:/app/assets/javascripts/leaflet.share.js diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index 1434743d0..664aebaa5 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -16,34 +16,50 @@ L.OSM.share = function (options) { var $ui = $('
') .attr('class', 'share-ui'); - $('

') - .text(I18n.t('javascripts.share.title')) - .appendTo($ui); + $('
') + .appendTo($ui) + .append( + $('') + .html('»') + .attr('class', 'close-button') + .attr('href', '#') + .bind('click', toggle)) + .append( + $('

') + .text(I18n.t('javascripts.share.title'))); - var $share_link = $('
') + var $share_link = $('
') .appendTo($ui); var $title = $('

') .text(I18n.t('javascripts.share.link')) .appendTo($share_link); + var $input = $('') + .attr('type', 'text') + .appendTo($share_link); + + var $list = $('
    ') + .appendTo($share_link); + + var $short_option = $('
  • ') + .appendTo($list); + + var $short_url_label = $('') + .attr('for', 'short_url') + .appendTo($short_option); + var $short_url_input = $('') .attr('id', 'short_url') .attr('type', 'checkbox') .prop('checked', 'checked') - .appendTo($share_link) + .appendTo($short_url_label) .bind('change', function() { options.short = $(this).prop('checked'); update(); }); - var $short_url_label = $('') - .text(I18n.t('javascripts.share.short_url')) - .attr('for', 'short_url') - .appendTo($share_link); - - var $input = $('') - .appendTo($share_link); + $short_url_label.append(I18n.t('javascripts.share.short_url')); map.on('moveend layeradd layerremove', update); @@ -53,11 +69,10 @@ L.OSM.share = function (options) { e.stopPropagation(); e.preventDefault(); options.sidebar.togglePane($ui); + $input.select(); } function update() { - var center = map.getCenter().wrap(); - var layers = getMapLayers(map); $input.val( options.short ? options.getShortUrl(map) : options.getUrl(map) );