Last active
February 19, 2025 10:09
-
-
Save webartoli/7b3d8ee027f6ce19bf09545e6f1b7f4c to your computer and use it in GitHub Desktop.
Dailytoast.io key handler
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
// paste this snippet in your browser bookmark url | |
javascript: (function () { | |
function clickIfVisible(selector) { | |
var element = document.querySelector(selector); | |
if (element && element.offsetParent !== null) { | |
element.click(); | |
return true; | |
} | |
return false; | |
} | |
function turnOffVolume() { | |
clickIfVisible('button:has(span[class^="icon-soundon"])'); | |
} | |
function setTimePerPartecipant() { | |
clickIfVisible("button.button-icon_up"); | |
} | |
function registerKeys() { | |
document.addEventListener("keydown", function (event) { | |
switch (event.key) { | |
case "ArrowRight": | |
clickIfVisible("button.button-next"); | |
break; | |
case " ": // spacebar | |
clickIfVisible("app-button[label='RESUME'] button") || | |
clickIfVisible("button.button-pause") || | |
clickIfVisible("button.button_primary"); | |
break; | |
default: | |
break; | |
} | |
}); | |
} | |
turnOffVolume(); | |
setTimePerPartecipant(); | |
registerKeys(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Behaviour:
spacebar
to start, pause and resumeArrow Right
to next partecipant