-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmap.html
135 lines (105 loc) · 3.5 KB
/
map.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
<!DOCTYPE html>
<html>
<head>
<title>FakeStreamer_ Map - IRL</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html,
body {
background-color: #181818;
height: 100%;
margin: 0;
padding: 0;
color: #F4F4F4;
font-family: 'Inter', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
a {
color: #2c87f0;
}
a:visited {
color: #c33;
}
a:hover,
a:active,
a:focus {
color: rgb(31, 133, 10);
}
#map {
height: 100%;
position: relative;
}
::-webkit-scrollbar {
display: none;
}
div.gmnoprint {
display: none !important;
}
#map [tabindex="0"]>div:first-child {
will-change: transform !important;
}
#map:after {
width: 44px;
height: 80px;
display: block;
content: ' ';
position: absolute;
top: 45%;
left: 48.8%;
margin: -40px 0 0 -11px;
background: url('https://fakestreamer.nl/wp-content/uploads/2024/01/current_location.png');
background-size: 44px 80px;
pointer-events: none;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script>
</head>
<body id="mapbody">
<div id="map"></div>
<script>
const socket = io();
function initMap() {
getMap();
}
const getMap = async () => {
try {
let data = await fetch(`./style`);
let style = await data.json();
let customMapType = new google.maps.StyledMapType(style, {
name: ""
});
let customMapTypeId = 'custom_style';
let map = new google.maps.Map(document.getElementById('map'), {
zoom: 15,
disableDefaultUI: true,
backgroundColor: '#000',
center: { lat: 51.9244, lng: 4.4777 }, // Center of Minneapolis, MN you can change this to your major city's lon/lat.
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP, customMapTypeId]
}
});
socket.on("THESTUFF", data => {
var latLng = new google.maps.LatLng(data.lat, data.lon);
map.panTo(latLng);
});
map.mapTypes.set(customMapTypeId, customMapType);
map.setMapTypeId(customMapTypeId);
} catch (error) {
console.log("initMap request failed or something.", error);
}
}
</script>
<script>
window.onload = function () {
let data = fetch(`./stats/gapi`).then(function (response) {
return response.text().then(function (gapi) {
console.log("gapi =", gapi);
var newScript = document.createElement("script");
newScript.src = `https://maps.googleapis.com/maps/api/js?key=${gapi}&callback=initMap`;
document.getElementsByTagName('head')[0].appendChild(newScript);
});
});
};
</script>
</body>
</html>