$('<h4>')
.text(I18n.t('javascripts.share.title')));
- // Link / Embed
+ // Link
var $linkSection = $('<div>')
.attr('class', 'section share-link')
.bind('change', toggleMarker))
.append(I18n.t('javascripts.share.include_marker')));
- var $shortLink, $longLink;
+ $('<div>')
+ .attr('class', 'form-row')
+ .appendTo($form)
+ .append(
+ $('<label>')
+ .attr('for', 'center_marker')
+ .append(
+ $('<input>')
+ .attr('id', 'center_marker')
+ .attr('type', 'checkbox')
+ .prop('checked', true)
+ .bind('change', update))
+ .append(I18n.t('javascripts.share.center_marker')));
$('<div>')
.attr('class', 'form-row')
.attr('type', 'text')
.on('click', select));
+ // Embed
+
+ var $embedSection = $('<div>')
+ .attr('class', 'section share-embed')
+ .appendTo($ui);
+
+ var $form = $('<form>')
+ .attr('class', 'standard-form')
+ .appendTo($embedSection);
+
$('<div>')
.attr('class', 'form-row')
.appendTo($form)
}
function update() {
+ if (map.hasLayer(marker) && $('#center_marker').is(':checked')) {
+ map.panTo(marker.getLatLng());
+ }
+
var bounds = map.getBounds();
$('#link_marker')
.prop('checked', map.hasLayer(marker));
+ $('#center_marker')
+ .prop('disabled', !map.hasLayer(marker));
+
$('#image_filter')
.prop('checked', locationFilter.isEnabled());
$('#embed_html').val(
'<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="' +
- 'http://' + OSM.SERVER_URL + '/export/embed.html?' + $.param(params) +
+ escapeHTML('http://' + OSM.SERVER_URL + '/export/embed.html?' + $.param(params)) +
'" style="border: 1px solid black"></iframe><br/>' +
- '<small><a href="' + map.getUrl(marker) + '</a></small>');
+ '<small><a href="' + escapeHTML(map.getUrl(marker)) + '</a></small>');
// Image