Last active
April 4, 2022 22:19
-
-
Save clarkb7/d96e99cea3a2fab6c4705db6f964ea57 to your computer and use it in GitHub Desktop.
r/place 2022 overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GUTS template | |
// @namespace http://tampermonkey.net/ | |
// @version 0.15 | |
// @description try to take over the canvas! | |
// @author Ruukas, clark, Rhys, huspaherzu, ??? | |
// @match https://hot-potato.reddit.com/embed* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=reddit.com | |
// @grant none | |
// ==/UserScript== | |
let overlay = null; | |
if (window.top !== window.self) { | |
window.addEventListener('load', () => { | |
const shadowRoot = document.getElementsByTagName("mona-lisa-embed")[0].shadowRoot.children[0]; | |
function toggle(){ | |
const parent = shadowRoot.getElementsByTagName("mona-lisa-canvas")[0].shadowRoot.children[0]; | |
if(overlay === null){ | |
overlay = parent.appendChild(( | |
function () { | |
const i = document.createElement("img"); | |
i.src = "https://i.imgur.com/0MOSRfT.png"; | |
i.style = "position: absolute;left: 0;top: 0;image-rendering: pixelated;width: 2000px;height: 2000px;"; | |
console.log(i); | |
return i; | |
} | |
)()); | |
} | |
else{ | |
parent.removeChild(overlay); | |
overlay = null; | |
} | |
} | |
toggle(); | |
shadowRoot.appendChild(( | |
function () { | |
const button = document.createElement("button"); | |
button.innerText = "Toggle overlay"; | |
button.onclick = toggle; | |
button.style = "position: absolute;left: 5px;top: 100px;"; | |
console.log(button); | |
return button; | |
} | |
)()); | |
}, false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment