-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
108 lines (105 loc) · 4.52 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>
<title>storemap</title>
<meta name="viewport" content="initial-scale=1, user-scalable=0">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/MarkerCluster.css" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/MarkerCluster.Default.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="https://unpkg.com/[email protected]/dist/leaflet.markercluster.js"></script>
<style type="text/css">
* {
border:0;
margin: 0;
}
body {
height: 100%;
width: 100%;
}
#map {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#search-box {
text-align: right;
position: fixed;
top: 10px;
right: 30px;
z-index: 1000 !important;
padding: 10px;
}
#search-box select {
border: solid black;
border-width: 0 1px 1px 0;
border: 1px solid #EEE;
border-radius: .25rem;
padding: .5rem 1.5rem .5rem .5rem;
font-size: 20px;
margin-bottom: 10px;
}
#search-box #last-modified {
font-family: sans-serif;
font-size: 15px;
line-height: 2em;
}
</style>
</head>
<body>
<div id="search-box">
<span id="last-modified"></span>
<br>
<select onchange="choose_game(this.value);">
<option value="duplicate">all-in-one</option>
<option value="ongeki">オンゲキ</option>
<option value="chunithm">CHUNITHM</option>
<option value="maimai">maimai</option>
</select>
<br>
<iframe src="https://ghbtns.com/github-btn.html?user=bemusicscript&repo=storefinder&type=star&count=true&size=large" frameborder="0" scrolling="0" width="110" height="30" title="GitHub"></iframe>
</div>
<div id="map"></div>
<script defer>
var map = L.map('map', {preferCanvas: true}).setView([36, 138], 6);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
var markers = L.markerClusterGroup();
var location_icon = new L.Icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowSize: [41, 41]
});
function choose_game(game_name){
markers.clearLayers();
fetch(`./json/${game_name}.json`).then(r => {
document.querySelector("#last-modified").innerHTML = r.headers.get("Last-Modified");
return r.json()
}).then(stores => {
for (i in stores){
let marker = L.marker(stores[i].location, {icon: location_icon});
marker.bindPopup(`
<div class="notranslate">
<font size=4><b>${stores[i].name}</b></font>
<br><br>
<font size=3>${stores[i].address}</font>
<br><br>
<font size=3><a href="https://maps.google.com/maps?q=${stores[i].name}@${stores[i].location.join(",")}&zoom=16&hl=en">Google Maps</a></font>
</div>`).openPopup();
markers.addLayer(marker);
}
map.addLayer(markers);
});
}
document.addEventListener('DOMContentLoaded', function(){
choose_game("duplicate");
});
</script>
</body>
</html>