This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
370 lines (333 loc) · 25 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset=utf-8 />
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>Geocoding Playground | Mapbox</title>
<!-- Styling -->
<link rel='stylesheet' href='./src/main.scss' />
<link href='https://api.mapbox.com/mapbox-assembly/v0.21.2/assembly.min.css' rel='stylesheet'>
<script async defer src='https://api.mapbox.com/mapbox-assembly/v0.21.2/assembly.js'></script>
<link rel='stylesheet' href='https://unpkg.com/[email protected]/dist/vue-multiselect.min.css'>
<link href='https://unpkg.com/[email protected]/dist/json-tree.css' rel='stylesheet'>
<link href='https://fonts.googleapis.com/css?family=Noto+Sans' rel='stylesheet' type='text/css'>
<!-- Vue JS -->
<script src='https://unpkg.com/[email protected]/dist/vue.js'></script>
<script src='https://unpkg.com/[email protected]/dist/vue-multiselect.min.js'></script>
<script src='https://unpkg.com/[email protected]/dist/json-tree.js'></script>
<script src='https://unpkg.com/[email protected]/dist/vue-clipboard.min.js'></script>
<script src="https://unpkg.com/v-tooltip"></script>
<!-- Map -->
<script src='https://api.mapbox.com/mapbox-gl-js/v0.53.1/mapbox-gl.js'></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v0.53.1/mapbox-gl.css' rel='stylesheet' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-draw/v1.0.9/mapbox-gl-draw.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-draw/v1.0.9/mapbox-gl-draw.css' type='text/css'/>
<script async src='https://api.tiles.mapbox.com/mapbox.js/plugins/turf/v3.0.11/turf.min.js'></script>
<script src='./src/main.js'></script>
</head>
<body>
<div id='app' class='relative'>
<div class='grid grid--gut12 py12 px12 bg-default'>
<div class='col col--8 col--4-mm relative'>
<template v-if='!cnf.onDebug'>
<div class='absolute flex-parent flex-parent--center-cross flex-parent--center-main w36 h36'><svg class='icon'><use href='#icon-search'></use></svg></div>
<input v-model='query' @focus='searchFocus' class='input bg-white px36' placeholder='Search'>
<div @click='searchClear' class='cursor-pointer absolute top right flex-parent flex-parent--center-cross flex-parent--center-main w36 h36'><svg class='icon'><use href='#icon-close'></use></svg></div>
</template>
</div>
<div class='col col--4 col--8-mm'>
<button @click="invert" v-tooltip="'Flip Coordinates'" v-if='reverse' class='fl btn h36 round bg-default transition bg-default-dark-on-hover color-blue-on-hover'><svg class='icon'><use href='#icon-rotate'></use></svg></button>
<button @click="panelManage('settings')" v-tooltip="'Toggle Settings Panel'" class='fr btn h36 round bg-default transition bg-default-dark-on-hover color-blue-on-hover'><svg class='icon'><use href='#icon-sprocket'/></svg></button>
<button @click="bugReport" v-tooltip="'Found a bug?'" class='fr btn h36 round bg-default transition bg-default-dark-on-hover color-blue-on-hover'><svg class='icon'><use href='#icon-bug'></use></svg></button>
<button @click="shareClick" v-tooltip="'Open API URL'" class='fr btn h36 round bg-default transition bg-default-dark-on-hover color-blue-on-hover'><svg class='icon'><use href='#icon-share'/></svg></button>
<button @click="panelManage('json')" v-tooltip="'Toggle JSON Panel'" class='fr btn h36 round bg-default transition bg-default-dark-on-hover color-blue-on-hover'><svg class='icon'><use href='#icon-code'/></svg></button>
<template v-if= "credentials.debug.authed">
<button @click="hecate" v-tooltip="'Open View in Hecate'" class='fr btn h36 round bg-default transition bg-default-dark-on-hover color-blue-on-hover'><svg class='icon'><use href='#icon-osm'/></svg></button>
<button @click="josm" v-tooltip="'Open View in JOSM'" class='fr btn h36 round bg-default transition bg-default-dark-on-hover color-blue-on-hover'><svg class='icon'><use href='#icon-pencil'/></svg></button>
</template>
</div>
</div>
<!-- Settings -->
<div v-if='settingsPanel' class='left-pane w-full w600-mm bg-white'>
<div class='grid px24 py24'>
<div class='col col--12'>
<h2 class='txt-h3 fl'>Settings</h2>
<button v-tooltip='"Toggle Raw URL View"' @click="urlview = !urlview" class='btn round fr'><svg class='icon'><use href='#icon-eye'></use></svg></button>
</div>
<template v-if='urlview'>
<div class='col col--12 py6 border-b border--gray-light'>
<h3 class='txt-h4 fl py3'>Raw API Request</h3>
<textarea v-if='urlview' v-model="url" readonly placeholder='API URL' class='textarea w-full h180'></textarea>
</div>
</template>
<div class='col col--12 py12'>
<div class='grid grid--gut12'>
<div class='col col--10'>
<input v-model='cnf.url' class='input' id='bboxInput' type='text' placeholder='Parse settings from Mapbox Geocoding API URL'/>
</div>
<div class='col col--2'>
<button @click='parseURL' class='btn round w-full'>Parse</button>
</div>
</div>
</div>
<div class='col col--12'>
<!--Internal Functions-->
<div v-if="credentials.debug.authed" class='col col--12'>
<div class='grid grid--gut12 py12'>
<div class='col col--6'>
<label class='switch-container fl pr12'>
<input v-model='cnf.staging' type='checkbox'/>
<div class='switch'></div>
</label>
<h3 class='txt-h4'>Staging Server</h3>
</div>
<div class='col col--6'>
<label class='switch-container fl pr12'>
<input v-model='cnf.approx' type='checkbox'/>
<div class='switch'></div>
</label>
<h3 class='txt-h4'>Smarty Federation</h3>
</div>
</div>
</div>
<!-- Country Filter -->
<div class='col col--12'>
<div class='col col--12 py12'>
<label class='switch-container fl pr12'>
<input v-model='cnf.onCountry' type='checkbox' checked/>
<div class='switch'></div>
</label>
<h3 class='txt-h4'>Country Filtering <svg @click="help()" class='fr ml12 icon cursor-pointer color-gray-light color-gray-dark-on-hover'><use href='#icon-info'/></svg></h3>
</div>
<div class='col col--12 px48'>
<multiselect v-model='cnf.countries' :options='countries' @search-change='countryFind' placeholder='Filter' :taggable='true' :multiple='true' track-by='code' label='name'></multiselect>
</div>
</div>
<!--Worldview Filter-->
<div class='col col--12'>
<div class="col col--12 py12">
<label class='switch-container fl pr12'>
<input v-model="cnf.onWorldview" type='checkbox' checked/>
<div class='switch'></div>
</label>
<h3 class='txt-h4'>Worldview Filter <svg @click="help()" class='fr ml12 icon cursor-pointer color-gray-light color-gray-dark-on-hover'><use href='#icon-info'/></svg></h3>
</div>
<div class="col col--12 px48">
<multiselect v-model="cnf.worldviews" :options="worldviews" placeholder="Filter" :taggable="true" :multiple="true" track-by="code" label="name"></multiselect>
</div>
</div>
<!-- Types Filter -->
<div class='col col--12'>
<div class='col col--12 py12'>
<div>
<label class='switch-container fl pr12'>
<input v-model='cnf.onType' type='checkbox' checked/>
<div class='switch'></div>
</label>
<span class='txt-h4'>Type Filtering <svg @click="help()" class='fr ml12 icon cursor-pointer color-gray-light color-gray-dark-on-hover'><use href='#icon-info'/></svg></map>
<button @click='typeClearAll' class='btn btn--stroke btn--xs fr px12 mr48 btn--darken50'>Clear All</button>
<button @click='typeAddAll' class='btn btn--stroke btn--xs fr px12 mx3 btn--darken50'>Add All</button>
</div>
</div>
<div class="col col--12 px48">
<button @click="typeClick" type='country' :class="{ 'btn--stroke': !cnf.typeToggle.country }" class='btn my3'>Country</button>
<button @click="typeClick" type='region' :class="{ 'btn--stroke': !cnf.typeToggle.region }" class='btn my3'>Region</button>
<button @click="typeClick" type='district' :class="{ 'btn--stroke': !cnf.typeToggle.district }" class='btn my3'>District</button>
<button @click="typeClick" type='postcode' :class="{ 'btn--stroke': !cnf.typeToggle.postcode }" class='btn my3'>Postcode</button>
<button @click="typeClick" type='locality' :class="{ 'btn--stroke': !cnf.typeToggle.locality }" class='btn my3'>Locality</button>
<button @click="typeClick" type='place' :class="{ 'btn--stroke': !cnf.typeToggle.place }" class='btn my3'>Place</button>
<button @click="typeClick" type='neighborhood' :class="{ 'btn--stroke': !cnf.typeToggle.neighborhood }" class='btn my3'>Neighborhood</button>
<button @click="typeClick" type='address' :class="{ 'btn--stroke': !cnf.typeToggle.address }" class='btn my3'>Address</button>
<button @click="typeClick" type='poi' :class="{ 'btn--stroke': !cnf.typeToggle.poi }" class='btn my3'>POI</button>
</div>
</div>
<!--Proximity Filter-->
<div class='col col--12'>
<div class="col col--12 py12">
<label class='switch-container fl pr12'>
<input v-model="cnf.onProximity" type='checkbox' checked/>
<div class='switch'></div>
</label>
<h3 class='txt-h4'>Proximity Bias <svg @click="help()" class='fr ml12 icon cursor-pointer color-gray-light color-gray-dark-on-hover'><use href='#icon-info'/></svg></h3>
</div>
<div class="col col--12 px48 relative">
<div @click="proximityManualClick" class='cursor-pointer absolute flex-parent flex-parent--center-cross flex-parent--center-main w36 h36'><span v-tooltip="'manually select Proximity from map'"><svg class='icon'><use href='#icon-crosshair'></use></svg></span></div>
<input id="proximityInput" v-model="cnf.proximity" class="input px36" id='bboxInput' type='text' placeholder='Longitude,Latitude'/>
<div @click="proximityClick" class='cursor-pointer absolute top right flex-parent flex-parent--center-cross flex-parent--center-main w36 h36'><span v-tooltip="'picks current location as Proximity'"><svg class='icon'><use href='#icon-compass'></use></svg></span></div>
</div>
</div>
<!--BBOX Filter-->
<div class='col col--12'>
<div class="col col--12 py12">
<label class='switch-container fl pr12'>
<input v-model="cnf.onBBOX" type='checkbox' checked/>
<div class='switch'></div>
</label>
<h3 class='txt-h4'>BBOX Filter <svg @click="help()" class='fr ml12 icon cursor-pointer color-gray-light color-gray-dark-on-hover'><use href='#icon-info'/></svg></h3>
</div>
<div class="col col--12 px48 relative">
<div @click="bboxDraw" class='cursor-pointer absolute flex-parent flex-parent--center-cross flex-parent--center-main w36 h36'><span v-tooltip="'Draw BBOX manually'"><svg class='icon'><use href='#icon-viewport'></use></svg></span></div>
<input v-model="cnf.bbox" class="input px36" id='bboxInput' type='text' placeholder='minX,minY,maxX,maxY'/>
</div>
</div>
<!--Limit-->
<div class='col col--12'>
<div class="col col--12 py12">
<label class='switch-container fl pr12'>
<input v-model="cnf.onLimit" type='checkbox' checked/>
<div class='switch'></div>
</label>
<h3 class='txt-h4'>Limit <svg @click="help()" class='fr ml12 icon cursor-pointer color-gray-light color-gray-dark-on-hover'><use href='#icon-info'/></svg></h3>
</div>
<div class="col col--12 px48">
<input v-model="cnf.limit" class="input" type='number' min='1' max='10' placeholder='Up to 5 for reverse, up to 10 for forward' class='stretch' />
</div>
</div>
<!--Autocomplete Toggle-->
<div class='col col--12'>
<div class="col col--12 py12">
<label class='switch-container fl pr12'>
<input v-model="cnf.autocomplete" type='checkbox' checked/>
<div class='switch'></div>
</label>
<h3 class='txt-h4'>Autocomplete <svg @click="help()" class='fr ml12 icon cursor-pointer color-gray-light color-gray-dark-on-hover'><use href='#icon-info'/></svg></h3>
</div>
</div>
<!--Language Filter-->
<div class='col col--12'>
<div class="col col--12 py12">
<label class='switch-container fl pr12'>
<input v-model="cnf.onLanguage" type='checkbox' checked/>
<div class='switch'></div>
</label>
<h3 class='txt-h4'>Language Filter <svg @click="help()" class='fr ml12 icon cursor-pointer color-gray-light color-gray-dark-on-hover'><use href='#icon-info'/></svg></h3>
</div>
<div class="col col--12 px48">
<multiselect v-model="cnf.languages" :options="languages" placeholder="Filter" :taggable="true" :multiple="true" track-by="code" label="name"></multiselect>
</div>
</div>
<!--Strict LanguageMode Toggle-->
<div class='col col--12'>
<div class="col col--12 py12">
<label class='switch-container fl pr12'>
<input v-model="cnf.languageStrict" type='checkbox'/>
<div class='switch'></div>
</label>
<h3 class='txt-h4'>Strict Language Mode <svg @click="help()" class='fr ml12 icon cursor-pointer color-gray-light color-gray-dark-on-hover'><use href='#icon-info'/></svg></h3>
</div>
</div>
<!--Debug mode-->
<!-- Only visible once temporary token has been retrieved -->
<div class='col col--12' v-if="credentials.debug.authed">
<!-- Toggle -->
<div class="col col--12 py12">
<label class='switch-container fl pr12'>
<input v-model="cnf.onDebug" type='checkbox'/>
<div class='switch'></div>
</label>
<h3 class='txt-h4'>Debug Mode</h3>
</div>
<!--Tile Layer Filter-->
<!-- TODO: allow user to select multiple layers -->
<div class="col col--12 py12">
<div class="col col--12 px48">
<multiselect v-model="cnf.selectedLayer" :options="layers" placeholder="Layers" :multiple="false"></multiselect>
</div>
</div>
</div>
<!--routing Toggle-->
<div class='col col--12'>
<div class="col col--12 py12">
<label class='switch-container fl pr12'>
<input v-model="cnf.routing" type='checkbox'/>
<div class='switch'></div>
</label>
<h3 class='txt-h4'><span>Routable Points<span><span class='ml12 txt-s color-red-light color-red-dark-on-hover'>ALPHA<span></h3>
</div>
</div>
<!--local search Toggle-->
<div class='col col--12'>
<div class="col col--12 py12">
<label class='switch-container fl pr12'>
<input v-model="cnf.localsearch" type='checkbox'/>
<div class='switch'></div>
</label>
<h3 class='txt-h4' v-tooltip='"Local search available by contacting Mapbox Support"'><span>Local Search<span><span class='ml12 txt-s color-red-light color-red-dark-on-hover'>BETA<span></h3>
</div>
</div>
</div>
</div>
</div>
<!-- JSON Response -->
<div v-if="jsonPanel" class='left-pane w-full w600-mm bg-white px24 py24'>
<button v-clipboard:copy="cnf.onDebug ? JSON.stringify(vtQueryResults, null, 4) : JSON.stringify(geocoderResults, null, 4)" class='fr btn h36 round bg-default transition bg-default-dark-on-hover'><svg class='icon'><use href='#icon-clipboard'/></svg></button>
<pre><json-tree :raw="cnf.onDebug ? JSON.stringify(vtQueryResults, null, 4) : JSON.stringify(geocoderResults, null, 4)"></json-tree></pre>
</div>
<div id='map'></div>
<!-- Search Results -->
<div class='resultContainer clearfix'>
<div class='results col5'>
<div class='resultsList'>
<div v-for="(res, res_it) res in (cnf.onDebug ? vtQueryResults.features: geocoderResults.features)" class="res clearfix" :result="res_it" @mouseenter="resultEnter" @mouseleave="resultLeave" @click="resultClick">
<template v-if="res.id.toString().split('.')[0] == 'address'">
<template v-if="res.id.split('.')[0] === '0'">
<div class="resIcon" :result="res_it">
<svg class='icon'><use href='#icon-line-center'/></svg>
</div>
</template>
<template v-if="res.properties.accuracy === 'interpolated'">
<div class="resIcon" :result="res_it">
<svg class='icon'><use href='#icon-point-line'/></svg>
</div>
</template>
<template v-else-if="res.properties.accuracy === 'street'">
<div class="resIcon" :result="res_it">
<svg class='icon'><use href='#icon-line'/></svg>
</div>
</template>
<template v-else-if="res.properties.accuracy === 'intersection'">
<div class="resIcon" :result="res_it">
<svg class='icon'><use href='#icon-plus'/></svg>
</div>
</template>
<template v-else-if="res.properties.accuracy">
<div class="resIcon" :result="res_it">
<svg class='icon'><use href='#icon-home'/></svg>
</div>
</template>
<template v-else>
<div class="resIcon" :result="res_it">
<svg class='icon'><use href='#icon-marker'/></svg>
</div>
</template>
</template>
<template v-else-if="!res.properties.maki">
<div class="resIcon" :result="res_it">
<svg class='icon'><use href='#icon-marker'/></svg>
</div>
</template>
<template v-else>
<div class="resIcon maki" :result="res_it" :class="[ res.properties.maki ]"></div>
</template>
<div class="resultText" :result="res_it" v-text="res.place_name ? res.place_name : res.properties['carmen:text']"></div>
</div>
</div>
</div>
</div>
<!-- mode pop up -->
<div v-if='getlocation' class="grid grid-gut12 absolute bottom z1 w-full">
<div class='col round col--3 relative px12 py12 bg-blue align-center color-white mx60 my30'>
<h4 class='txt-h4 fl'>Click on the map to set proximity</h4>
</div>
</div>
<div v-if='buildingBBox' class="grid round grid-gut12 absolute bottom z1 w-full">
<div class='col round col--3 relative px12 py12 bg-blue align-center color-white mx60 my30'>
<h4 class='txt-h4 fl align-l'><b>1.</b> Click to add first corner (release) <br><b>2.</b> Move cursor to the next corner <br><b>3.</b> Click again to complete the Bbox</h4>
</div>
</div>
<div id='style-sat' class='style' @click="setStyle('mapbox://styles/mapbox/satellite-v9')"></div>
<div id='style-def' class='style' @click="setStyle('mapbox://styles/mapbox/streets-v8')"></div>
<div id='style-drk' class='style' @click="setStyle('mapbox://styles/mapbox/dark-v9')"></div>
</div>
</body>
</html>