Last active
February 29, 2024 23:03
-
-
Save boccato/e51f14e1ee45e0e24789273d1dfd1d15 to your computer and use it in GitHub Desktop.
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 JPDB Yes, keep going! | |
// @namespace http://tampermonkey.net/ | |
// @version 0.7 | |
// @description Makes "Yes, keep going!" the default button. | |
// @author boccato | |
// @match https://jpdb.io/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=jpdb.io | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
console.log("testing...") | |
let buttons = document.querySelectorAll('input[type=submit]') | |
// if (buttons && buttons.length == 2) { | |
if (document.location.pathname === "/review") { | |
for (const btn of buttons) { | |
if (btn.attributes.getNamedItem('autofocus')) { | |
btn.attributes.removeNamedItem('autofocus') | |
} | |
} | |
// setTimeout(() => buttons[0].focus({focusVisible: true}), 100) | |
} | |
// /review | |
let btnHard = document.querySelector('input[type=submit][value="✔ Hard"]') | |
if (btnHard) { | |
console.log("hard...") | |
setTimeout(() => btnHard.focus({focusVisible: true}), 100) | |
} | |
let btnShowAnswer = document.querySelector('input[type=submit][value="Show answer"]') | |
if (btnShowAnswer) { | |
setTimeout(() => btnShowAnswer.focus({focusVisible: true}), 100) | |
} | |
let btnYesKeepGoing = document.querySelector('input[type=submit][value="Yes, keep going!"]') | |
if (btnYesKeepGoing) { | |
setTimeout(() => btnYesKeepGoing.focus({focusVisible: true}), 100) | |
} | |
// / and /learn | |
let btn = document.querySelector('input[type=submit][value="Start reviewing"]') | |
if (btn) { | |
setTimeout(() => btn.focus({focusVisible: true}), 100) | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment