diff --git a/data/keys.json b/data/keys.json index f6d67d16e..d14a3e542 100644 --- a/data/keys.json +++ b/data/keys.json @@ -2,13 +2,11 @@ { "url": "http://www.openstreetmap.org", "oauth_consumer_key": "5A043yRSEugj4DJ5TljuapfnrflWDte8jTOcWLlT", - "oauth_secret": "aB3jKq1TRsCOUrfOIZ6oQMEDmv2ptV76PA54NGLL", - "oauth_signature_method": "HMAC-SHA1" + "oauth_secret": "aB3jKq1TRsCOUrfOIZ6oQMEDmv2ptV76PA54NGLL" }, { "url": "http://api06.dev.openstreetmap.org", "oauth_consumer_key": "zwQZFivccHkLs3a8Rq5CoS412fE5aPCXDw9DZj7R", - "oauth_secret": "aMnOOCwExO2XYtRVWJ1bI9QOdqh1cay2UgpbhA6p", - "oauth_signature_method": "HMAC-SHA1" + "oauth_secret": "aMnOOCwExO2XYtRVWJ1bI9QOdqh1cay2UgpbhA6p" } ] diff --git a/index.html b/index.html index 95091618a..b03920b1a 100644 --- a/index.html +++ b/index.html @@ -217,7 +217,8 @@ d3.select("#about").insert('li', '.user-list') .attr('class', 'source-switch') - .call(iD.ui.SourceSwitch(id)); + .call(iD.ui.SourceSwitch(id) + .keys(iD.data.keys)); }); diff --git a/js/id/core/connection.js b/js/id/core/connection.js index 254b7d523..8a58f97d0 100644 --- a/js/id/core/connection.js +++ b/js/id/core/connection.js @@ -1,15 +1,18 @@ -iD.Connection = function(options) { +iD.Connection = function() { var event = d3.dispatch('authenticating', 'authenticated', 'auth', 'loading', 'load', 'loaded'), - url = options.url || 'http://www.openstreetmap.org', + url = 'http://www.openstreetmap.org', connection = {}, user = {}, inflight = {}, loadedTiles = {}, - oauth = osmAuth(_.extend({ + oauth = osmAuth({ + url: 'http://www.openstreetmap.org', + oauth_consumer_key: '5A043yRSEugj4DJ5TljuapfnrflWDte8jTOcWLlT', + oauth_secret: 'aB3jKq1TRsCOUrfOIZ6oQMEDmv2ptV76PA54NGLL', loading: authenticating, done: authenticated - }, options)), + }), ndStr = 'nd', tagStr = 'tag', memberStr = 'member', diff --git a/js/id/id.js b/js/id/id.js index 18c92c78d..7369ce7a5 100644 --- a/js/id/id.js +++ b/js/id/id.js @@ -23,7 +23,7 @@ window.iD = function () { container, ui = iD.ui(context), map = iD.Map(context), - connection = iD.Connection(iD.data.keys[0]); + connection = iD.Connection(); connection.on('load.context', function loadContext(err, result) { history.merge(result); diff --git a/js/id/ui/source_switch.js b/js/id/ui/source_switch.js index 895a11a42..88ae4d009 100644 --- a/js/id/ui/source_switch.js +++ b/js/id/ui/source_switch.js @@ -1,4 +1,6 @@ iD.ui.SourceSwitch = function(context) { + var keys; + function click() { d3.event.preventDefault(); @@ -9,7 +11,7 @@ iD.ui.SourceSwitch = function(context) { .classed('live'); context.connection() - .switch(live ? iD.data.keys[1] : iD.data.keys[0]); + .switch(live ? keys[1] : keys[0]); context.map() .flush(); @@ -19,7 +21,7 @@ iD.ui.SourceSwitch = function(context) { .classed('live', !live); } - return function(selection) { + var sourceSwitch = function(selection) { selection.append('a') .attr('href', '#') .text(t('source_switch.live')) @@ -27,4 +29,12 @@ iD.ui.SourceSwitch = function(context) { .attr('tabindex', -1) .on('click', click); }; + + sourceSwitch.keys = function(_) { + if (!arguments.length) return keys; + keys = _; + return sourceSwitch; + }; + + return sourceSwitch; };