forked from Taggagii/GeoGuessr-Hack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
26 lines (24 loc) · 952 Bytes
/
Copy pathbackground.js
File metadata and controls
26 lines (24 loc) · 952 Bytes
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
chrome.webRequest.onCompleted.addListener(async (request) => {
if (request.method !== 'GET' || request.type !== 'script' || !request.url.includes('GeoPhotoService')) {
return;
}
await fetch(request.url).then((response) => {
return response.text();
}).then((data) => {
// console.log(data);
let coordHolder = JSON.parse(data.match(/\[null,null,-?\d*.\d*,-?\d*.\d*\]/)[0]);
if (!coordHolder) {
chrome.storage.sync.set({coords: JSON.stringify(data[1][0])}, () => {
console.log('set value weird');
});
console.log(data[1][0])
} else {
let coords = coordHolder.splice(2, 2);
chrome.storage.sync.set({coords: JSON.stringify(coords)}, () => {
console.log('set value');
});
console.log(coords);
}
console.log('-'.repeat(50));
});
}, {urls: ['<all_urls>']});