Make the toggles themselves permalinks
This commit is contained in:
parent
fa9b4a5f6a
commit
48775da938
2 changed files with 25 additions and 33 deletions
|
@ -64,23 +64,31 @@ L.OSM.share = function (options) {
|
||||||
$('<div>')
|
$('<div>')
|
||||||
.attr('class', 'share-tabs')
|
.attr('class', 'share-tabs')
|
||||||
.appendTo($form)
|
.appendTo($form)
|
||||||
.append($('<label>')
|
.append($('<a>')
|
||||||
.attr('class', 'active')
|
.attr('class', 'active')
|
||||||
.attr('for', 'long_input')
|
.attr('for', 'long_input')
|
||||||
|
.attr('id', 'long_link')
|
||||||
.text(I18n.t('javascripts.share.long_link')))
|
.text(I18n.t('javascripts.share.long_link')))
|
||||||
.append($('<label>')
|
.append($('<a>')
|
||||||
.attr('for', 'short_input')
|
.attr('for', 'short_input')
|
||||||
|
.attr('id', 'short_link')
|
||||||
.text(I18n.t('javascripts.share.short_link')))
|
.text(I18n.t('javascripts.share.short_link')))
|
||||||
.append($('<label>')
|
.append($('<a>')
|
||||||
.attr('for', 'embed_html')
|
.attr('for', 'embed_html')
|
||||||
|
.attr('href', '#')
|
||||||
.text(I18n.t('javascripts.share.embed')))
|
.text(I18n.t('javascripts.share.embed')))
|
||||||
.on('click', 'label', function() {
|
.on('click', 'a', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
var id = '#' + $(this).attr('for');
|
var id = '#' + $(this).attr('for');
|
||||||
$linkSection.find('.share-tabs label')
|
$linkSection.find('.share-tabs a')
|
||||||
.removeClass('active');
|
.removeClass('active');
|
||||||
$(this).addClass('active');
|
$(this).addClass('active');
|
||||||
$linkSection.find('.share-tab').hide();
|
$linkSection.find('.share-tab')
|
||||||
$linkSection.find('.share-tab:has(' + id + ')').show();
|
.hide();
|
||||||
|
$linkSection.find('.share-tab:has(' + id + ')')
|
||||||
|
.show()
|
||||||
|
.find('input, textarea')
|
||||||
|
.select();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('<div>')
|
$('<div>')
|
||||||
|
@ -90,12 +98,7 @@ L.OSM.share = function (options) {
|
||||||
.append($('<input>')
|
.append($('<input>')
|
||||||
.attr('id', 'long_input')
|
.attr('id', 'long_input')
|
||||||
.attr('type', 'text')
|
.attr('type', 'text')
|
||||||
.on('click', select))
|
.on('click', select));
|
||||||
.append($('<a>')
|
|
||||||
.attr('id', 'long_link')
|
|
||||||
.on('click', function() { return false; })
|
|
||||||
.append($('<span>')
|
|
||||||
.attr('class', 'icon link')));
|
|
||||||
|
|
||||||
$('<div>')
|
$('<div>')
|
||||||
.attr('class', 'form-row share-tab')
|
.attr('class', 'form-row share-tab')
|
||||||
|
@ -103,12 +106,7 @@ L.OSM.share = function (options) {
|
||||||
.append($('<input>')
|
.append($('<input>')
|
||||||
.attr('id', 'short_input')
|
.attr('id', 'short_input')
|
||||||
.attr('type', 'text')
|
.attr('type', 'text')
|
||||||
.on('click', select))
|
.on('click', select));
|
||||||
.append($('<a>')
|
|
||||||
.attr('id', 'short_link')
|
|
||||||
.on('click', function() { return false; })
|
|
||||||
.append($('<span>')
|
|
||||||
.attr('class', 'icon link')));
|
|
||||||
|
|
||||||
$('<div>')
|
$('<div>')
|
||||||
.attr('class', 'form-row share-tab')
|
.attr('class', 'form-row share-tab')
|
||||||
|
|
|
@ -640,22 +640,24 @@ a.donate {
|
||||||
.share-tabs {
|
.share-tabs {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
label {
|
a {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
background-color: $lightblue;
|
background-color: $lightblue;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
label:first-child {
|
a:first-child {
|
||||||
border-right: 1px solid #fff;
|
border-right: 1px solid #fff;
|
||||||
border-radius: 4px 0 0 4px;
|
border-radius: 4px 0 0 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
label:last-child {
|
a:last-child {
|
||||||
border-left: 1px solid #fff;
|
border-left: 1px solid #fff;
|
||||||
border-radius: 0 4px 4px 0;
|
border-radius: 0 4px 4px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
label.active {
|
a.active {
|
||||||
background-color: $blue;
|
background-color: $blue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -665,17 +667,9 @@ a.donate {
|
||||||
}
|
}
|
||||||
|
|
||||||
.share-link {
|
.share-link {
|
||||||
#long_input,
|
input[type=text],
|
||||||
#short_input {
|
|
||||||
width: 190px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
margin-left: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input,
|
|
||||||
textarea {
|
textarea {
|
||||||
|
width: 100%;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue