forked from openstreetmap/iD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
107 lines (97 loc) · 3.95 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>iD</title>
<link rel='stylesheet' href='dist/iD.css'/>
<meta name='viewport' content='initial-scale=1.0 maximum-scale=1.0'/>
<meta name='apple-mobile-web-app-capable' content='yes'/>
<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent'/>
<script src='dist/iD.js'></script>
</head>
<body>
<div id='id-container'></div>
<script>
var q = iD.utilStringQs(window.location.hash.substring(1));
function startiD() {
id = iD.Context()
.assetPath('dist/');
// disable boundaries (unless we have an explicit disable_features list)
if (!q.hasOwnProperty('disable_features')) {
id.features().disable('boundaries');
}
if (q.hasOwnProperty('minEditableZoom')) {
id.minEditableZoom(q.minEditableZoom)
}
id.ui()(document.getElementById('id-container'), function() {
id.container().select('#about-list')
.insert('li', '.user-list')
.attr('class', 'source-switch')
.call(iD.uiSourceSwitch(id)
.keys([
{
'urlroot': 'https://www.openstreetmap.org',
'oauth_consumer_key': 'dtxeA5csys0Nm7f0x0r0CjvQY6dBzycl0ZW8YuV0',
'oauth_secret': 'XomBRv0iLcNd4JSfkNIqZ42sZfWnSaTQG16bWpzr'
},
{
'urlroot': 'https://api06.dev.openstreetmap.org',
'oauth_consumer_key': 'zwQZFivccHkLs3a8Rq5CoS412fE5aPCXDw9DZj7R',
'oauth_secret': 'aMnOOCwExO2XYtRVWJ1bI9QOdqh1cay2UgpbhA6p'
}
])
);
});
}
var imageryConfigUrl = q.hasOwnProperty('imagery_config') && q.imagery_config
var presetConfigUrl = q.hasOwnProperty('presets_config') && q.presets_config
var ID_CONFIG
// inject custom config before loading iD
if (imageryConfigUrl && presetConfigUrl) {
fetch(imageryConfigUrl)
.then(response => response.json())
.then((imageryConfig) => {
console.log(imageryConfig)
return fetch(presetConfigUrl)
.then(response => response.json())
.then((presetsConfig) => {
console.log(presetsConfig)
ID_CONFIG = {
imagery: imageryConfig.dataImagery,
presets: presetsConfig.presets,
defaults: presetsConfig.defaults,
categories: presetsConfig.categories,
fields: presetsConfig.fields
}
startiD()
});
});
} else if (imageryConfigUrl) {
fetch(imageryConfigUrl)
.then(response => response.json())
.then((imageryConfig) => {
console.log(imageryConfig)
ID_CONFIG = {
imagery: imageryConfig.dataImagery
}
startiD()
});
} else if (presetConfigUrl) {
fetch(presetConfigUrl)
.then(response => response.json())
.then((presetsConfig) => {
console.log(presetsConfig)
ID_CONFIG = {
presets: presetsConfig.presets,
defaults: presetsConfig.defaults,
categories: presetsConfig.categories,
fields: presetsConfig.fields
}
startiD()
});
} else {
startiD()
}
</script>
</body>
</html>