您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Win micromatch in less than a second! This is based off of the original script by Danielv123, but basically all of the code has been replaced by my own
当前为
- // ==UserScript==
- // @name Updated Quizlet Micromatch bot
- // @namespace BenjaminHinchliff
- // @version 0.2
- // @description Win micromatch in less than a second! This is based off of the original script by Danielv123, but basically all of the code has been replaced by my own
- // @author You
- // @match https://quizlet.com/*/match*
- // @grant none
- // ==/UserScript==
- // a little function to allow the program to click on elements
- function clickEvent(element) {
- let eve = new CustomEvent("pointerdown", { bubbles: true });
- element.dispatchEvent(eve);
- }
- let rawTerms = Quizlet.matchModeData.terms;
- let terms = {};
- // get terms from Quizlet object (a global variable because I only want to retrive it once)
- for (let i = 0; i < rawTerms.length; i++) {
- terms[rawTerms[i].word] = rawTerms[i].definition;
- }
- // wait until user presses start
- document.onclick = ()=>{
- // get all the nodes and store them in a variable to avoid re-querying nodes (I know it's live shut up)
- let nodes = document.querySelector(".MatchModeQuestionGridBoard-tiles").childNodes;
- for (let i = 0; i < nodes.length; i++) {
- // get term
- let search = nodes[i].childNodes[0].childNodes[0].childNodes[0].childNodes[0].innerHTML;
- // match with definition
- let dictionaryResult = terms[search];
- if(dictionaryResult) {
- // find term in nodes and send click events
- for (let j = 0; j < nodes.length; j++) {
- if (nodes[j].innerHTML.includes(dictionaryResult)) {
- setTimeout(() => {
- clickEvent(nodes[i].childNodes[0]);
- clickEvent(nodes[j].childNodes[0]);
- },
- i * 50); // this is only here because quizlet doesn't allow score below 0.5 seconds and this roughly comes out to 0.5
- }
- }
- }
- }
- };