Skip to content

Instantly share code, notes, and snippets.

@BorysekOndrej
Created May 24, 2018 22:23
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 BorysekOndrej/26cd56d63f562ca46eadf489e46f3994 to your computer and use it in GitHub Desktop.
Save BorysekOndrej/26cd56d63f562ca46eadf489e46f3994 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name FI Drill keybindings
// @author David Pavlík
// @match https://kabell.sk/fi_muni_drill/**
// @grant none
// @require https://code.jquery.com/jquery-3.3.1.slim.min.js
// ==/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)',
' ': 'body > div.container.main > div > div.col-sm-9 > div:nth-child(4) > div:nth-child(3) > a'
}
const selector = bindings[event.key];
if(typeof selector !== "undefined"){
const element = $(selector)[0];
element.click();
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment