Skip to content

Instantly share code, notes, and snippets.

@GiovanH
Created December 20, 2022 01:07
Show Gist options
  • Save GiovanH/8d67487b6f21a942563a7e7a02a1cdc6 to your computer and use it in GitHub Desktop.
Save GiovanH/8d67487b6f21a942563a7e7a02a1cdc6 to your computer and use it in GitHub Desktop.
// ==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