Skip to content

Instantly share code, notes, and snippets.

@leeniati
Last active April 4, 2022 14:13
Show Gist options
  • Save leeniati/c3cd1509f583ac324bced4437b1350a2 to your computer and use it in GitHub Desktop.
Save leeniati/c3cd1509f583ac324bced4437b1350a2 to your computer and use it in GitHub Desktop.
Big A r/place Template
// ==UserScript==
// @name Big A r/place Template
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the canvas!
// @author oralekin, LittleEndu, ekgame, Mr. Quack
// @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://mrquack.ml/images/atrioc-place-template.png";
image.onload = () => {
image.style = `position: absolute; left: 0; top: 0; width: ${image.width/3}px; height: ${image.height/3}px; image-rendering: pixelated; 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);
}
@leeniati
Copy link
Author

leeniati commented Apr 3, 2022

Big A r/place Template

image

How does this work?

The script embeds a manually made dotted template on the r/place canvas. From there, you can see small dots that show the intended color for those pixels.

How do I use it?

To use this, you'll first need to install a user script manager for your browser.
Chrome: Tampermonkey
Opera: Tampermonkey Beta
Firefox: Violentmonkey

After you've installed the user script manager, click this to install the script.
You should inspect the code to be sure it is safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment