1 L.OSM.share = function (options) {
2 var control = L.control(options);
4 control.onAdd = function (map) {
5 var $container = $('<div>')
6 .attr('class', 'control-share');
9 .attr('class', 'control-button')
11 .attr('title', 'Share')
12 .html('<span class="icon share"></span>')
14 .appendTo($container);
17 .attr('class', 'share-ui');
20 .attr('class', 'sidebar_heading')
24 .text(I18n.t('javascripts.close'))
25 .attr('class', 'sidebar_close')
27 .bind('click', toggle))
30 .text(I18n.t('javascripts.share.title')));
32 var $linkSection = $('<div>')
33 .attr('class', 'section share-link')
37 .text(I18n.t('javascripts.share.link'))
38 .appendTo($linkSection);
40 var $shortLink, $longLink;
43 .appendTo($linkSection)
45 .append($longLink = $('<a>')
46 .text(I18n.t('javascripts.share.long_link'))))
48 .append($shortLink = $('<a>')
49 .text(I18n.t('javascripts.share.short_link'))));
51 map.on('moveend layeradd layerremove', update);
53 options.sidebar.addPane($ui);
58 options.sidebar.togglePane($ui);
63 $shortLink.attr('href', options.getShortUrl(map));
64 $longLink.attr('href', options.getUrl(map));