mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 17:52:55 +00:00
26 lines
682 B
JavaScript
26 lines
682 B
JavaScript
iD.ui.SourceSwitch = function(context) {
|
|
function click() {
|
|
d3.event.preventDefault();
|
|
|
|
var live = d3.select(this).classed('live');
|
|
|
|
context.map()
|
|
.flush();
|
|
|
|
context.connection()
|
|
.url(live ? 'http://api06.dev.openstreetmap.org' : 'http://www.openstreetmap.org');
|
|
|
|
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.dev'))
|
|
.classed('live', false)
|
|
.on('click', click);
|
|
};
|
|
};
|