diff --git a/index.html b/index.html
index 123cd5778..feae3bc85 100644
--- a/index.html
+++ b/index.html
@@ -187,12 +187,14 @@
var id = iD();
iD.util.asyncMap(['keys.json', 'presets/presets.json'], d3.json, function(err, data) {
- id.connection()
- .keys(data[0])
- .presetData(iD.presetData().data(data[1]));
+ id.connection()
+ .keys(data[0]);
- d3.select("#iD")
- .call(id.ui())
+ id.presetData()
+ .data(data[1]);
+
+ d3.select("#iD")
+ .call(id.ui());
});
diff --git a/js/id/connection.js b/js/id/connection.js
index 5872811c8..08c494454 100644
--- a/js/id/connection.js
+++ b/js/id/connection.js
@@ -4,8 +4,6 @@ iD.Connection = function(context) {
url = 'http://api06.dev.openstreetmap.org',
connection = {},
user = {},
- version,
- presetData = iD.presetData(),
keys,
inflight = {},
loadedTiles = {},
@@ -329,12 +327,6 @@ iD.Connection = function(context) {
return connection;
};
- connection.presetData = function(_) {
- if (!arguments.length) return presetData;
- presetData = _;
- return connection;
- };
-
connection.authenticate = function(callback) {
function done(err, res) {
event.auth();
diff --git a/js/id/id.js b/js/id/id.js
index 74d0b6d82..5e10fcb74 100644
--- a/js/id/id.js
+++ b/js/id/id.js
@@ -95,6 +95,13 @@ window.iD = function () {
context.zoomIn = map.zoomIn;
context.zoomOut = map.zoomOut;
+ /* Presets */
+ var presetData = iD.presetData();
+
+ context.presetData = function() {
+ return presetData;
+ };
+
context.container = function(_) {
if (!arguments.length) return container;
container = _;
diff --git a/js/id/modes/select.js b/js/id/modes/select.js
index d2995ea4f..3d9064126 100644
--- a/js/id/modes/select.js
+++ b/js/id/modes/select.js
@@ -83,9 +83,6 @@ iD.modes.Select = function(context, selection, initial) {
}), true));
if (entity) {
- inspector
- .presetData(context.connection().presetData());
-
context.container()
.select('.inspector-wrap')
.style('display', 'block')
diff --git a/js/id/ui/inspector.js b/js/id/ui/inspector.js
index e89e7bd02..73e7385a5 100644
--- a/js/id/ui/inspector.js
+++ b/js/id/ui/inspector.js
@@ -1,6 +1,5 @@
iD.ui.Inspector = function(context) {
var event = d3.dispatch('changeTags', 'close', 'change'),
- presetData = iD.presetData(),
initial = false,
inspectorbody,
entity,
@@ -19,7 +18,6 @@ iD.ui.Inspector = function(context) {
.attr('class', 'fillL'),
presetGrid = iD.ui.PresetGrid(context)
- .presetData(presetData)
.entity(entity)
.on('message', changeMessage)
.on('choose', function(preset) {
@@ -27,7 +25,6 @@ iD.ui.Inspector = function(context) {
});
tagEditor = iD.ui.TagEditor(context)
- .presetData(presetData)
.tags(entity.tags)
.on('message', changeMessage)
.on('changeTags', function() {
@@ -66,10 +63,5 @@ iD.ui.Inspector = function(context) {
return inspector;
};
- inspector.presetData = function(_) {
- presetData = _;
- return inspector;
- };
-
return d3.rebind(inspector, event, 'on');
};
diff --git a/js/id/ui/presetgrid.js b/js/id/ui/presetgrid.js
index bc8f3dfd6..605b38b9a 100644
--- a/js/id/ui/presetgrid.js
+++ b/js/id/ui/presetgrid.js
@@ -1,7 +1,7 @@
iD.ui.PresetGrid = function(context) {
var event = d3.dispatch('choose', 'message'),
entity,
- presetData,
+ presetData = context.presetData(),
taginfo = iD.taginfo();
function presetgrid(selection, preset) {
@@ -184,12 +184,6 @@ iD.ui.PresetGrid = function(context) {
.text(t('commit.cancel'));
}
- presetgrid.presetData = function(_) {
- if (!arguments.length) return presetData;
- presetData = _;
- return presetgrid;
- };
-
presetgrid.entity = function(_) {
if (!arguments.length) return entity;
entity = _;
diff --git a/js/id/ui/tageditor.js b/js/id/ui/tageditor.js
index 639e4434e..beeabca74 100644
--- a/js/id/ui/tageditor.js
+++ b/js/id/ui/tageditor.js
@@ -1,6 +1,6 @@
iD.ui.TagEditor = function(context) {
var event = d3.dispatch('changeTags', 'choose', 'close', 'message'),
- presetData = iD.presetData(),
+ presetData = context.presetData(),
entity,
tags,
name,
@@ -167,10 +167,5 @@ iD.ui.TagEditor = function(context) {
}
};
- tageditor.presetData = function(_) {
- presetData = _;
- return tageditor;
- };
-
return d3.rebind(tageditor, event, 'on');
};