-
Notifications
You must be signed in to change notification settings - Fork 3
/
mod_map.html
149 lines (116 loc) · 4.19 KB
/
mod_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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html>
<html>
<head>
<title>Mod Map FakeStreamer_ - IRL</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html,
body {
background-color: #000;
height: 100%;
margin: 0;
padding: 0;
color: white;
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: 57px;
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: 57px 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="stats"></div>
<script>
const socketstats = io();
const element = document.getElementById("stats");
socketstats.on("THESTUFF", stats => {
html = "";
html += `<center>Location Name: ${stats.town2}${stats.city2}${stats.state}${stats.country2} ║ Temp: ${stats.temp}°F ║ Time: ${stats.time} ║ GPS Coords: <a href="https://maps.google.com?q=${stats.lat},${stats.lon}" target="_blank">${stats.lat}, ${stats.lon}</a> ║ Altitude: ${stats.a} ║ Phone Battery: ${stats.b}%</center>`;
//html += `<br>`;
element.innerHTML = html;
});
</script>
<div id="map"></div>
<script>
const socket = io();
const urlParams = new URLSearchParams(window.location.search);
const myKey = urlParams.get('key');
function initMap() {
getMap();
}
const getMap = async () => {
try {
let customMapType = new google.maps.StyledMapType(style, {
name: ""
});
let customMapTypeId = 'google';
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); //new pan to lat & long location
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?key=${myKey}`).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>