forked from code4history/Maplat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
61 lines (61 loc) · 1.92 KB
/
index.html
File metadata and controls
61 lines (61 loc) · 1.92 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Maplat</title>
<meta content="yes" name="apple-mobile-web-app-capable">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
<link rel="icon" type="image/png" href="parts/favicon.png">
<link href="https://api.tiles.mapbox.com/mapbox-gl-js/v1.6.1/mapbox-gl.css" rel="stylesheet">
<link rel="stylesheet" href="dist/maplat.css">
<style>
.mainview {
position: absolute;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
}
</style>
</head>
<body>
<div class="mainview">
<div id="map_div"></div>
</div>
<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v1.6.1/mapbox-gl.js"></script>
<script src="dist/maplat.js"></script>
<script>
var option = {
enable_cache: true,
restore_session: false,
state_url: false,
enable_share: true,
presentation_mode: true,
pwa_manifest: true,
mapboxgl: mapboxgl,
mapboxToken: 'YOUR-ACCESS-TOKEN'
};
var hashes = (window.location.href.split('#!'))[0];
hashes = hashes.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
option[hash[0]] = hash[1] == 'true' ? true : hash[1] == 'false' ? false : hash[1];
}
Maplat.createObject(option).then(function(app){
app.addEventListener('clickMarker', function(evt) {
console.log(evt);
});
app.addEventListener('clickMap', function (evt) {
console.log(evt);
});
app.core.addLine({
lnglats: [[141.151995, 39.701599], [141.151137, 39.703736], [141.1521671, 39.7090232]],
stroke: {
color: '#ffcc33',
width: 2
}
});
});
</script>
</body>
</html>