Quizlet 'Learn' Mode Global Input Stopper

Disable page click from going to the next question without permission. Additionally, "Enter" key will submit answers, and "space" will override incorrect answers. Only accept 'enter', 'space' keys and 'click' events.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Quizlet 'Learn' Mode Global Input Stopper
// @description Disable page click from going to the next question without permission. Additionally, "Enter" key will submit answers, and "space" will override incorrect answers. Only accept 'enter', 'space' keys and 'click' events.
// @author      Kai Krause <[email protected]>
// @match       http://quizlet.com/*/write*
// @match       https://quizlet.com/*/write*
// @version     1.3.4
// @grant       none
// @namespace QZLT_LearnKBMode
// ==/UserScript==

window.addEventListener('load', function() {
	Element.NativeEvents={click:2,dblclick:0,mouseup:0,mousedown:0,contextmenu:0,mousewheel:0,DOMMouseScroll:0,mouseover:0,mouseout:0,mousemove:0,selectstart:1,selectend:0,keydown:0,keypress:0,keyup:0,input:0,orientationchange:2,touchstart:2,touchmove:2,touchend:2,touchcancel:2,gesturestart:2,gesturechange:2,gestureend:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,paste:2,oninput:2,load:2,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};

	window.addEventListener("keydown", enter, true);
	
	function enter(charE) {
		var answerBtn = document.getElementById("js-learnModeAnswerButton");
		var checkBtn = document.getElementsByClassName("LearnModeMain-anyKey");
		var overrideBtn = document.getElementsByClassName("LearnModeGradeAnswerView-overrideLink");
		if (charE.keyCode == "13") {
			if (answerBtn){
				answerBtn.click();
			} else if (checkBtn) {
				checkBtn[0].click();
			}
		}
		if (charE.keyCode == "32") {
			if (overrideBtn){
				overrideBtn[0].click();
			}
		}
	}
}, false);