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');
23 .text(I18n.t('javascripts.share.title')));
25 var $share_link = $('<section></section>')
28 var $title = $('<h3></h3>')
29 .text(I18n.t('javascripts.share.link'))
30 .appendTo($share_link);
32 var $short_url_input = $('<input />')
33 .attr('id', 'short_url')
34 .attr('type', 'checkbox')
35 .prop('checked', 'checked')
36 .appendTo($share_link)
37 .bind('change', function() {
38 options.short = $(this).prop('checked');
42 var $short_url_label = $('<label></label>')
43 .text(I18n.t('javascripts.share.short_url'))
44 .attr('for', 'short_url')
45 .appendTo($share_link);
47 var $input = $('<input />')
48 .appendTo($share_link);
50 map.on('moveend layeradd layerremove', update);
52 options.sidebar.addPane($ui);
57 options.sidebar.togglePane($ui);
62 options.short ? options.getShortUrl(map) : options.getUrl(map)