Created
April 3, 2022 23:48
-
-
Save helpimnotdrowning/c491861735c95f65cd9a54e6fd5a6275 to your computer and use it in GitHub Desktop.
KyoAni Alliance (and friends???) Overlay
This file contains hidden or 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 KyoAni and friends r/place Overlay | |
// @namespace http://tampermonkey.net/ | |
// @version 0.3-kyoani | |
// @description kyogo animaion !!! so true | |
// @author oralekin, LittleEndu, ekgame, helpimnotdrowning, ninjuh1124 | |
// @match https://hot-potato.reddit.com/embed* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=reddit.com | |
// @grant none | |
// ==/UserScript== | |
if (window.top !== window.self) { | |
window.addEventListener('load', () => { | |
// Load the image | |
const image = document.createElement("img"); | |
image.src = "https://raw.githubusercontent.com/ninjuh1124/raw/master/kyoaniplacechararesize.png?" + Date.now();; | |
image.onload = () => { | |
image.style = `position: absolute; left: 0; top: 0; width: ${image.width/3}px; height: ${image.height/3}px; image-rendering: crisp-edges; z-index: 1`; | |
}; | |
// Add the image as overlay | |
const camera = document.querySelector("mona-lisa-embed").shadowRoot.querySelector("mona-lisa-camera"); | |
const canvas = camera.querySelector("mona-lisa-canvas"); | |
canvas.shadowRoot.querySelector('.container').appendChild(image); | |
// Add a style to put a hole in the pixel preview (to see the current or desired color) | |
const waitForPreview = setInterval(() => { | |
const preview = camera.querySelector("mona-lisa-pixel-preview"); | |
if (preview) { | |
clearInterval(waitForPreview); | |
const style = document.createElement('style') | |
style.innerHTML = '.pixel { clip-path: polygon(-20% -20%, -20% 120%, 37% 120%, 37% 37%, 62% 37%, 62% 62%, 37% 62%, 37% 120%, 120% 120%, 120% -20%); }' | |
preview.shadowRoot.appendChild(style); | |
} | |
}, 100); | |
}, false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment