-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.html
More file actions
137 lines (119 loc) · 4.56 KB
/
map.html
File metadata and controls
137 lines (119 loc) · 4.56 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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Parler Video Locations</title>
<meta property="og:url" content="/" />
<meta property="og:title" content="Map of location-data embedded in Parler video uploads" />
<meta property="og:description" content="Meta-data from videos that were uploaded to Parler. Not all the links work, as files are being deleted." />
<meta property="og:site_name" content="parlervid" />
<meta property="og:image" content="https://imgix.lifehacker.com.au/content/uploads/sites/4/2020/11/26/parler-hack.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="800" />
<meta property="og:image:height" content="800" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@uber">
<meta name="twitter:creator" content="@uber">
<meta name="twitter:title" content="Map of location-data embedded in Parler video uploads">
<meta name="twitter:description" content="Meta-data from videos that were uploaded to Parler. Not all the links work, as files are being deleted.">
<meta name="twitter:image" content="https://imgix.lifehacker.com.au/content/uploads/sites/4/2020/11/26/parler-hack.png" />
<script src='https://api.mapbox.com/mapbox-gl-js/v2.0.0/mapbox-gl.js'></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v2.0.0/mapbox-gl.css' rel='stylesheet' />
<script src="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.5.1/mapbox-gl-geocoder.min.js"></script>
<link rel="stylesheet" href="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.5.1/mapbox-gl-geocoder.css" type="text/css" />
<style>
#controls {
font-family: sans-serif;
position: absolute;;
top: 10px;
left: 10px;
padding: 10px;
border-radius: 5px;
background: white;
border: 1px solid black;
z-index: 100;
}
#controls, .mapboxgl-ctrl {
opacity: 60%;
}
button:focus {outline:0;}
</style>
</head>
<body style='margin:0'>
<div id='map' style='width: 100vw; height: 100vh;'></div>
<div id="controls">
<strong>Filters</strong><br/>
<input type="checkbox" onchange="setUser(this.checked)" /> Has user-info<br/>
Date: <input type="date" onchange="setStart(this.value)" value="2018-06-01" /> - <input value="2021-01-11" type="date" onchange="setEnd(this.value)"/>
</div>
<script>
const dataLayer = 'parler-drm78a'
const filterFields = {
user: false,
start: "2018-06-01",
end: "2021-01-11"
}
function setStart(d) {
filterFields.start = d
updateFilter()
}
function setEnd(d) {
filterFields.end = d
updateFilter()
}
function setUser(d) {
filterFields.user = d
updateFilter()
}
function updateFilter() {
const filter = [
"all",
[">", "time", filterFields.start],
["<", "time", filterFields.end]
]
if (filterFields.user) {
filter.push(['!=', "username", 'None'])
}
map.setFilter(dataLayer, filter)
}
mapboxgl.accessToken = "pk.eyJ1IjoiZGF2aWRrb25zdW1lciIsImEiOiJja2R0OHl2OXQwcGh1MnNtcGRleDRpeWRpIn0.lGkSZTG8nmxltvK6uF8NHw";
const map = new mapboxgl.Map({
style: "mapbox://styles/davidkonsumer/ckjy9hcyn12at17pa2dyr5tch",
center: [-95.91128797690739, 39.10422463446551],
zoom: 3.8288679503782523,
container: "map",
antialias: true,
attributionControl: false
})
map.on('load', () => {
updateFilter()
})
map.addControl(
new MapboxGeocoder({
accessToken: mapboxgl.accessToken,
mapboxgl: mapboxgl
})
)
map.on('click', (e) => {
const features = map.queryRenderedFeatures(e.point, {
layers: [dataLayer]
})
if (!features.length) {
return
}
const popupHTML = features.map(feature => `
<p style="border: 1px solid black; padding: 5px;">
<strong><a href="/${feature.properties.id}">${feature.properties.id}</strong></a><br/>
${feature.properties.time}<br/>
${feature.properties.displayname !== 'None' ? `${feature.properties.displayname}<br/>` : ''}
${feature.properties.username !== 'None' ? `${feature.properties.username}<br/>` : ''}
</p>
`).join('')
console.log(popupHTML)
const popup = new mapboxgl.Popup({ offset: [0, -15] })
.setLngLat(features[0].geometry.coordinates)
.setHTML('<div style="max-height: 300px; overflow: auto">' + popupHTML + '</div>')
.addTo(map)
})
</script>
</body>