Skip to content

Instantly share code, notes, and snippets.

@mvolfik
Last active February 26, 2020 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvolfik/d03ec46bf5245272988fcf276577781a to your computer and use it in GitHub Desktop.
Save mvolfik/d03ec46bf5245272988fcf276577781a to your computer and use it in GitHub Desktop.
// ==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