Quizlet - Hotkeys to Search Flash Cards by Accuracy

Press the 1-2-3-4 number keys to navigate large decks easily

当前为 2018-03-28 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Quizlet - Hotkeys to Search Flash Cards by Accuracy
// @namespace   QZLT_flashcardSelectKBMode
// @description Press the 1-2-3-4 number keys to navigate large decks easily
// @author      Kai Krause <[email protected]>
// @match       http://quizlet.com/*flash-cards/*
// @match       https://quizlet.com/*flash-cards/*
// @version     1.5
// @grant       none
// ==/UserScript==

window.onload = function(){
	var titles = document.getElementsByClassName("SetPageTermChunk-title");
	var titlesCache = [];

	for (var i = 0; i < titles.length; i++){
		titles[i].innerHTML += "<a style='visibility:hidden' name='" +  titles[i].textContent + "'></a>";
		titlesCache.push(titles[i].textContent);
	}

	function titleSelect(charE) {
		var el = document.activeElement;
		if (el.tagName.toLowerCase() != 'textarea') {
			if (charE.keyCode == "49") {
				window.location.hash = titlesCache[0];
			} else if (charE.keyCode == "50") {
				window.location.hash = titlesCache[1];
			} else if (charE.keyCode == "51") {
				window.location.hash = titlesCache[2];
			} else if (charE.keyCode == "52") {
				window.location.hash = titlesCache[3];
			}
		}
	}
	window.addEventListener("keydown", titleSelect, true);
}