mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-21 10:33:34 +00:00
32 lines
783 B
JavaScript
32 lines
783 B
JavaScript
export function ViewOnOSM(context) {
|
|
var id;
|
|
|
|
function viewOnOSM(selection) {
|
|
var entity = context.entity(id);
|
|
|
|
selection.style('display', entity.isNew() ? 'none' : null);
|
|
|
|
var $link = selection.selectAll('.view-on-osm')
|
|
.data([0]);
|
|
|
|
$link.enter()
|
|
.append('a')
|
|
.attr('class', 'view-on-osm')
|
|
.attr('target', '_blank')
|
|
.call(iD.svg.Icon('#icon-out-link', 'inline'))
|
|
.append('span')
|
|
.text(t('inspector.view_on_osm'));
|
|
|
|
$link
|
|
.attr('href', context.connection().entityURL(entity));
|
|
}
|
|
|
|
viewOnOSM.entityID = function(_) {
|
|
if (!arguments.length) return id;
|
|
id = _;
|
|
return viewOnOSM;
|
|
};
|
|
|
|
return viewOnOSM;
|
|
}
|