forked from mapbox/geojson.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
207 lines (188 loc) · 6.71 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=Edge'>
<link href='lib/mapbox.js/latest/mapbox.css' rel='stylesheet' />
<link rel='stylesheet' href='css/font-awesome/css/font-awesome.min.css'>
<link rel='stylesheet' href='css/fonts/mplus.css'>
<title>geojson.io</title>
<link href='lib/draw/leaflet.draw.css' rel='stylesheet' />
<link href='lib/codemirror/lib/codemirror.css' rel='stylesheet' />
<link href='css/base.css' rel='stylesheet' />
<link href='css/marker.css' rel='stylesheet' />
<link href='css/github_browse.css' rel='stylesheet' />
<link href='css/site.css' rel='stylesheet' />
<link href='css/theme.css' rel='stylesheet' />
<link rel='icon' type='image/x-icon' href='/img/favicon.png' />
<meta name='author' content='MapBox' />
<meta name='description' content='simply edit geojson map data' />
<meta property='og:site_name' content='geojson.io'/>
<meta name='viewport' content='initial-scale=1,maximum-scale=1'>
<!--[if lt IE 9]>
<script type='text/javascript' src='lib/aight.min.js'></script>
<![endif]-->
<script src='lib/mapbox.js/latest/mapbox.js'></script>
<script src='lib/raven.min.js'></script>
<meta http-equiv="Content-Security-Policy" content="
default-src
'self'
;
child-src
'self'
blob:
;
connect-src
'self'
*
;
font-src
'self'
;
frame-src
'self'
;
img-src
'self'
data:
*
;
script-src
'self'
'unsafe-eval'
'unsafe-inline'
https://cdn.segment.com
https://assets.customer.io
https://secure.gaug.es
https://www.google-analytics.com
;
style-src
'self'
'unsafe-inline'
;
">
<script>
if (/a\.tiles\.mapbox\.com/.test(L.mapbox.config.HTTP_URL)) {
Raven.config('https://c2d096c944dd4150ab7e44b0881b4a46@app.getsentry.com/11480', {
whitelistUrls: [/geojson\.io/],
ignoreErrors: [
'Uncaught Error: Error connecting to extension ckibcdccnfeookdmbahgiakhnjcddpki',
'Uncaught Error: Error connecting to extension pioclpoplcdbaefihamjohnefbikjilc'
]
}).install();
}
</script>
<style>
/*
* http://seclab.stanford.edu/websec/framebusting/framebust.pdf
*/
body { display: none; }
</style>
</head>
<body id='geojsonio-body'>
<div style="width: 500px; height: 500px; color: red;"></div>
<div class='geojsonio'></div>
<script>
if (self == top) {
document.getElementsByTagName ("body")[0].style.display = 'block';
} else {
top.location = self.location;
}
</script>
<script src='dist/delegate.js'></script>
<script src='dist/lib.js'></script>
<script src='dist/site.js'></script>
<script src="lib/jquery-1.10.2.min.js"></script>
<script>
</script>
<script type='text/javascript'>
if (/a\.tiles\.mapbox\.com/.test(L.mapbox.config.HTTP_URL)) {
var _gauges = _gauges || [];
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-12158002-18', 'auto');
ga('send', 'pageview');
}
var b = document.createElement("BUTTON");
b.innerHTML = 'Search';
b.style.zIndex = "1000";
b.style.position = "relative";
b.style.background = "green";
b.style.color = "white";
b.style.opacity = ".8";
b.style.marginRight = "10px";
b.style.marginLeft = "10px";
b.style.borderRadius = "5px";
b.style.width = "150px";
b.style.height = "39px";
b.style.marginTop = "2px";
document.body.getElementsByClassName("file-bar")[0].appendChild(b);
b.onclick = function(){
$("select[title='Help']").click();
var node = document.querySelector('[title="Help"]');
$(node).click();
var bounds = window.api.map.getBounds();
var sw = 'South West: ' + bounds._southWest
var ne = '\nNorth East: ' + bounds._northEast
var regExp = /\(([^)]+)\)/;
var matches = regExp.exec(sw);
var sw = matches[1].split(', ');
matches = regExp.exec(ne);
var ne = matches[1].split(', ');
var nw = [sw[0], ne[1]];
var se = [ne[0], sw[1]];
var post_url = 'http://128.239.111.60:3000';
$.ajax({
type: 'POST',
data: JSON.stringify({"bounds": [sw,ne,nw,se]}),
contentType: 'application/json',
url: 'http://128.239.111.60:3000/search',
success: function(data) {
for(var x=0;x<data.length;x++){
var i = document.createElement('div');
if(typeof data[x] === 'string'){
i.innerHTML = data[x];
}
else{
i.innerHTML = data[x].name;
var url = document.createElement('BUTTON');
url.innerHTML = 'Go'
url.style.width = "150px";
url.style.height = "39px";
url.style.background = "green";
url.style.color = "white";
i.appendChild(url);
url.setAttribute('url', data[x].gist);
url.onclick = function(){
var uri = this.getAttribute('url');
$.ajax({
type: 'POST',
data: JSON.stringify({"gist": uri}),
contentType: 'application/json',
url: 'http://128.239.111.60:3000/gist',
success: function(data) {
window.api.data.set({map: data});
var x1 = Infinity, y1 = Infinity, x2 = -1, y2 = -1;
for(var i=0;i<data.features[0].geometry.coordinates[0].length;i++){
if(data.features[0].geometry.coordinates[0][i][0] < x1) x1 = data.features[0].geometry.coordinates[0][i][0];
if(data.features[0].geometry.coordinates[0][i][1] < y1) y1 = data.features[0].geometry.coordinates[0][i][1];
if(data.features[0].geometry.coordinates[0][i][0] > x2) x2 = data.features[0].geometry.coordinates[0][i][0];
if(data.features[0].geometry.coordinates[0][i][1] > y2) y2 = data.features[0].geometry.coordinates[0][i][1];
}
var centerpoint = [y1+((y2-y1)/2),x1+((x2-x1)/2)];
window.api.map.setView(centerpoint, 5);
}
});
}
}
i.style.textAlign = "center";
document.body.getElementsByClassName("pane")[0].appendChild(i);
}
}
});
}
</script>
</body>
</html>