Skip to content

Instantly share code, notes, and snippets.

@cowboy
Last active June 4, 2023 05:29
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Universal Paperclips: stuff to paste into console http://www.decisionproblem.com/paperclips
_toggles = {}
makeToggle = (id, fn, delay = 250) => {
const elem = document.querySelector('#' + id)
elem.onclick = () => {
if (_toggles[id]) {
clearInterval(_toggles[id])
_toggles[id] = null
} else {
_toggles[id] = setInterval(() => elem.disabled || fn(), delay)
}
}
}
makeToggle('btnMakePaperclip', () => clipClick(1))
makeToggle('btnQcompute', qComp)
makeToggle('btnMakeProbe', makeProbe)
makeToggle('btnAddProc', addProc)
makeToggle('btnAddMem', addMem)
@BrisK1w1
Copy link

how does it work?

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