Last active
June 7, 2018 16:10
-
-
Save xxdavid/9f88f4d249349b91b38dc16636823e88 to your computer and use it in GitHub Desktop.
FI Drill keybindings
This file contains 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
// ==UserScript== | |
// @name FI Drill keybindings | |
// @author David Pavlík | |
// @match https://kabell.sk/fi_muni_drill/** | |
// @grant none | |
// ==/UserScript== | |
document.addEventListener('keypress', event => { | |
const bindings = { | |
'd': 'body > div.container.main > div > div.col-sm-9 > div:nth-child(3) > div div:contains(ne)', | |
'k': 'body > div.container.main > div > div.col-sm-9 > div:nth-child(3) > div div:contains(ano)', | |
'q': 'body > div.container.main > div > div.col-sm-9 > div:nth-child(3) a:nth-child(1)', | |
'w': 'body > div.container.main > div > div.col-sm-9 > div:nth-child(3) a:nth-child(2)', | |
'e': 'body > div.container.main > div > div.col-sm-9 > div:nth-child(3) a:nth-child(3)', | |
' ': 'body > div.container.main > div > div.col-sm-9 > div:nth-child(4) > div:nth-child(3) > a' | |
} | |
const selector = bindings[event.key] | |
const element = $(selector)[0] | |
element.click() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version for greasemonkey:
https://gist.github.com/BorysekOndrej/26cd56d63f562ca46eadf489e46f3994