-
Notifications
You must be signed in to change notification settings - Fork 1
/
OSG-screenshot-dealwither-2023-12-15.user.js
63 lines (53 loc) · 1.94 KB
/
OSG-screenshot-dealwither-2023-12-15.user.js
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
// ==UserScript==
// @name OSG screenshot dealwither
// @namespace http://tampermonkey.net/
// @version 2023-12-15
// @description try to take over the world!
// @author You
// @match http*://www.openscenegraph.com/index.php*
// @icon https://www.google.com/s2/favicons?sz=64&domain=openscenegraph.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
localStorage.setItem('trying', window.location.href);
let knownUrls = new Set(JSON.parse(localStorage.getItem('osgScreenshotsKnown')) ?? []);
window.open = (url, target, windowFeatures) => {
if (target && target != "_self" ) {
console.log(`target ${target}`);
}
if (windowFeatures) {
console.log(`windowFeatures ${windowFeatures}`);
}
console.log(new URL(url, window.location));
knownUrls.add(new URL(url, window.location).href);
};
window.print = console.log;
var ayyys = document.getElementsByTagName("a");
for (let ayy of ayyys) {
if (ayy.onclick) {
localStorage.setItem('aboutToClick', JSON.stringify(ayy));
console.log(ayy);
ayy.onclick();
}
};
localStorage.setItem('finished', window.location.href);
localStorage.setItem('trying', undefined);
localStorage.setItem('osgScreenshotsKnown', JSON.stringify([...knownUrls]));
let triedUrls = new Set(JSON.parse(localStorage.getItem('osgScreenshotsTried')) ?? []);
triedUrls.add(window.location.href);
localStorage.setItem('osgScreenshotsTried', JSON.stringify([...triedUrls]));
let nextUrl = null;
for (let next of knownUrls) {
if (!triedUrls.has(next)) {
nextUrl = next;
break;
}
}
if (nextUrl == null) {
window.alert("Done!");
} else {
console.log(`leaving ${window.location.href} and going to ${nextUrl}`);
window.location = nextUrl;
}
})();