Files
iD/js/id/ui/source_switch.js
Tom MacWright ca74b111b0 Fix highlighting of layers and geocoding
* Fix highlighting of custom layer. Fixes #915
* Line up tabindexes. Fixes #922
2013-03-07 15:32:03 -05:00

27 lines
716 B
JavaScript

iD.ui.SourceSwitch = function(context) {
function click() {
d3.event.preventDefault();
var live = d3.select(this).classed('live');
context.connection()
.url(live ? 'http://api06.dev.openstreetmap.org' : 'http://www.openstreetmap.org');
context.map()
.flush();
d3.select(this)
.text(live ? t('source_switch.dev') : t('source_switch.live'))
.classed('live', !live);
}
return function(selection) {
selection.append('a')
.attr('href', '#')
.text(t('source_switch.live'))
.classed('live', true)
.attr('tabindex', -1)
.on('click', click);
};
};