Switch back to links for sharing
This commit is contained in:
parent
dc8751cf7a
commit
68a46f2452
3 changed files with 27 additions and 33 deletions
|
@ -29,39 +29,24 @@ L.OSM.share = function (options) {
|
||||||
$('<h4>')
|
$('<h4>')
|
||||||
.text(I18n.t('javascripts.share.title')));
|
.text(I18n.t('javascripts.share.title')));
|
||||||
|
|
||||||
var $share_link = $('<section>')
|
var $linkSection = $('<section>')
|
||||||
|
.attr('class', 'share-link')
|
||||||
.appendTo($ui);
|
.appendTo($ui);
|
||||||
|
|
||||||
var $title = $('<h4>')
|
$('<h4>')
|
||||||
.text(I18n.t('javascripts.share.link'))
|
.text(I18n.t('javascripts.share.link'))
|
||||||
.appendTo($share_link);
|
.appendTo($linkSection);
|
||||||
|
|
||||||
var $input = $('<input />')
|
var $shortLink, $longLink;
|
||||||
.attr('type', 'text')
|
|
||||||
.on('click', select)
|
|
||||||
.appendTo($share_link);
|
|
||||||
|
|
||||||
var $list = $('<ul>')
|
$('<ul>')
|
||||||
.appendTo($share_link);
|
.appendTo($linkSection)
|
||||||
|
.append($('<li>')
|
||||||
var $short_option = $('<li>')
|
.append($longLink = $('<a>')
|
||||||
.appendTo($list);
|
.text(I18n.t('javascripts.share.long_link'))))
|
||||||
|
.append($('<li>')
|
||||||
var $short_url_label = $('<label></label>')
|
.append($shortLink = $('<a>')
|
||||||
.attr('for', 'short_url')
|
.text(I18n.t('javascripts.share.short_link'))));
|
||||||
.appendTo($short_option);
|
|
||||||
|
|
||||||
var $short_url_input = $('<input />')
|
|
||||||
.attr('id', 'short_url')
|
|
||||||
.attr('type', 'checkbox')
|
|
||||||
.prop('checked', 'checked')
|
|
||||||
.appendTo($short_url_label)
|
|
||||||
.bind('change', function() {
|
|
||||||
options.short = $(this).prop('checked');
|
|
||||||
update();
|
|
||||||
});
|
|
||||||
|
|
||||||
$short_url_label.append(I18n.t('javascripts.share.short_url'));
|
|
||||||
|
|
||||||
map.on('moveend layeradd layerremove', update);
|
map.on('moveend layeradd layerremove', update);
|
||||||
|
|
||||||
|
@ -71,13 +56,12 @@ L.OSM.share = function (options) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
options.sidebar.togglePane($ui);
|
options.sidebar.togglePane($ui);
|
||||||
$input.select();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
$input.val(
|
$shortLink.attr('href', options.getShortUrl(map));
|
||||||
options.short ? options.getShortUrl(map) : options.getUrl(map)
|
$longLink.attr('href', options.getUrl(map));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function select() {
|
function select() {
|
||||||
|
|
|
@ -624,6 +624,15 @@ a.donate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.share-ui {
|
||||||
|
.share-link {
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.site-index .leaflet-top,
|
.site-index .leaflet-top,
|
||||||
.site-export .leaflet-top {
|
.site-export .leaflet-top {
|
||||||
top: $lineheight/2 !important;
|
top: $lineheight/2 !important;
|
||||||
|
|
|
@ -2042,7 +2042,8 @@ en:
|
||||||
title: "Share"
|
title: "Share"
|
||||||
cancel: "Cancel"
|
cancel: "Cancel"
|
||||||
link: "Link"
|
link: "Link"
|
||||||
short_url: "Short URL"
|
short_link: "Short Link"
|
||||||
|
long_link: "Long Link"
|
||||||
key:
|
key:
|
||||||
title: "Map Key"
|
title: "Map Key"
|
||||||
tooltip: "Map Key"
|
tooltip: "Map Key"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue