-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTamperMonkeyScript.user.js
83 lines (78 loc) · 4.62 KB
/
TamperMonkeyScript.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// ==UserScript==
// @name Silksong Place
// @namespace https://www.reddit.com/r/HollowKnight/
// @version 0.7.10
// @description try to take over r/place!
// @author OnyX_#4977
// @match https://hot-potato.reddit.com/embed*
// @icon https://www.google.com/s2/favicons?sz=64&domain=reddit.com
// @grant none
// ==/UserScript==
function makeOverlay(id, url, width, height, x, y) {
x *= 50;
y *= 50;
width *= 50;
height *= 50;
const div = document.createElement("div");
div.className = "Template";
div.id = id;
div.style = `height:${height}px; width:${width}px; position: absolute; inset: 0px; transform: translateX(${x}px) translateY(${y}px); background-size: cover; image-rendering: pixelated; background-image: url('${url}'); opacity: 1`;
document.getElementsByTagName("mona-lisa-embed")[0].shadowRoot.children[0].getElementsByTagName("mona-lisa-camera")[0].shadowRoot.children[0].children[0].children[0].appendChild(div);
}
if (window.top !== window.self) {
window.addEventListener('load', () => {
makeOverlay("Silksong", "https://github.com/onyx-4977/onyx-4977/raw/main/SilksongTemplate.png", 87, 78, 225, 343);
makeOverlay("HollowKnight", "https://github.com/onyx-4977/onyx-4977/raw/main/HollowKnightTemplate.png", 128, 75, 1295, 47);
makeOverlay("Radiance", "https://github.com/onyx-4977/onyx-4977/raw/main/RadianceTemplate.png", 96, 106, 246, 1339);
makeOverlay("EldenRing", "https://github.com/onyx-4977/onyx-4977/raw/main/EldenringTemplate.png", 49, 64, 176, 386);
document.getElementsByTagName("mona-lisa-embed")[0].shadowRoot.children[0].getElementsByClassName("bottom-controls")[0].appendChild(
(function () {
const slider = document.createElement("div");
slider.style = "height: 36px; width: 200px; position: absolute; right: 100px; top: 0; background-color: #FFF;pointer-events: all;border-radius: 26px;";
const input = document.createElement("input");
input.type = 'range';
input.min = '0';
input.max = '1';
input.step = '0.1';
input.value = '1';
input.style = "margin: 10px;left: 0;right: 0;top: 0;bottom: 0;box-sizing: border-box;position: absolute;";
input.id = 'templateSlider'
input.addEventListener('input', (event) => {
document.getElementsByTagName("mona-lisa-embed")[0].shadowRoot.children[0].getElementsByTagName("mona-lisa-camera")[0].shadowRoot.children[0].children[0].children[0].querySelectorAll(".Template").forEach(element => {element.style.opacity = event.currentTarget.value});
});
slider.appendChild(input);
return slider;
})()
);
document.getElementsByTagName("mona-lisa-embed")[0].shadowRoot.children[0].getElementsByClassName("bottom-controls")[0].appendChild(
(function () {
const toggle = document.createElement("div");
toggle.style = "height: 36px; width: 100px; position: absolute; right: 350px; top: 0; background-color: #FFF;pointer-events: all;border-radius: 26px; display: flex; justify-content: space-around; align-items: center;";
const input = document.createElement("input");
input.type = 'checkbox';
input.name = "toggle";
input.addEventListener('click', (event) => {
document.getElementsByTagName("mona-lisa-embed")[0].shadowRoot.children[0].getElementsByTagName("mona-lisa-camera")[0].shadowRoot.children[0].children[0].children[0].querySelectorAll(".Template").forEach(element => {
if (event.currentTarget.checked) {
element.style["-webkit-mask-image"] = `url("https://raw.githubusercontent.com/onyx-4977/onyx-4977/f648a8946a1fe2f37c7b6593d5c889ab7be95085/Dot.svg")`;
element.style["-webkit-mask-repeat"] = "repeat";
element.style["-webkit-mask-size"] = "50px";
} else {
element.style["-webkit-mask-image"] = null;
element.style["-webkit-mask-repeat"] = null;
element.style["-webkit-mask-size"] = null;
}
});
});
input.click()
const label = document.createElement("label");
label.style = "color: black;";
label.innerHTML = "Toggle dot";
label.for = "toggle";
toggle.appendChild(input);
toggle.appendChild(label);
return toggle;
})()
);
}, false);
}