Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save IoIxD/4acf8621482a6b859741c5282a43e938 to your computer and use it in GitHub Desktop.
Save IoIxD/4acf8621482a6b859741c5282a43e938 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Keyboard navigation for McGraw Hill SmartBook
// @namespace http://ioi-xd.net/
// @version 0.0
// @description Make McGraw Hill Smartbook suck significantly less by allowing you to use Enter and the number row to input answers.
// @author You
// @match https://learning.mheducation.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=mheducation.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.addEventListener("keyup", (e) => {
if(e.key == "Enter") {
let buttons = document.querySelector(".confidence-buttons-container");
if(buttons) {
buttons.querySelectorAll("button")[0].click();
let correct = document.querySelector(".choice-row.-correct");
if(correct) {
setTimeout(() => {document.querySelector(".next-button").click();},250);
};
} else {
document.querySelector(".next-button").click();
}
}
if(+(e.key)) {
let fields = document.querySelector(".multiple-choice-fieldset") || document.querySelector(".mcms-fieldset");
let chosen = fields.querySelectorAll(".choice-row")[+(e.key)-1];
if(chosen) {
chosen.querySelector(".choiceText").click();
}
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment