Created
December 20, 2022 01:07
-
-
Save GiovanH/8d67487b6f21a942563a7e7a02a1cdc6 to your computer and use it in GitHub Desktop.
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 CYOA helper | |
// @match https://*.*/*.png | |
// @grant none | |
// @version 1.0 | |
// @author - | |
// @description Shift+Click to add checkboxes over images | |
// ==/UserScript== | |
function inject(){ | |
window.addEventListener('mousedown', (event) => { | |
console.log(event) | |
if (event.shiftKey) { | |
const checkbox = document.createElement('input') | |
checkbox.type = 'checkbox' | |
checkbox.checked = true | |
checkbox.style.position = "absolute" | |
checkbox.style.top = `${event.pageY-6}px` | |
checkbox.style.left = `${event.pageX-6}px` | |
const size = 32; | |
checkbox.style.width = `${size}px` | |
checkbox.style.height = `${size}px` | |
document.body.appendChild(checkbox) | |
event.preventDefault() | |
} | |
}) | |
} | |
inject(); | |
window.addEventListener('DOMContentLoaded', (event) => { | |
inject(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment