Skip to content

Instantly share code, notes, and snippets.

@mvolfik
Last active February 26, 2020 11:17
Embed
What would you like to do?
// ==UserScript==
// @name Kahoot hotkeys
// @namespace mvolfik.github.io
// @version 0.2
// @description take over the world!
// @author mvolfik
// @match https://kahoot.it/v2/*
// ==/UserScript==
(function() {
document.onkeypress=function(e){
console.log(e.keyCode);
switch (e.keyCode) {
case 52:
document.querySelectorAll("button[data-functional-selector~=answer-0]")[0].click();
break;
case 53:
document.querySelectorAll("button[data-functional-selector~=answer-1]")[0].click();
break;
case 49:
document.querySelectorAll("button[data-functional-selector~=answer-2]")[0].click();
break;
case 50:
document.querySelectorAll("button[data-functional-selector~=answer-3]")[0].click();
break;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment