1
1
Fork 0
CCNA_Autofill_Userscript/main.user.js

39 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-05-23 14:02:37 +00:00
// ==UserScript==
// @name CCNA Autofill
// @namespace Violentmonkey Scripts
// @match *://assessment.netacad.net/*
// @match *://www.assessment.netacad.net/*
2024-05-23 14:11:32 +00:00
// @match *://www.google.com/*
// @match *://www.google.de/*
2024-05-23 14:36:13 +00:00
// @require https://git.euph.dev/SZUT-Dominik/CCNA_Autofill_Userscript/raw/branch/main/fetch.js
2024-05-23 15:34:40 +00:00
// @require https://git.euph.dev/SZUT-Dominik/CCNA_Autofill_Userscript/raw/branch/main/answer.js
2024-05-23 14:02:37 +00:00
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_xmlhttpRequest
2024-05-23 16:43:18 +00:00
// @version 0.0.18
2024-05-23 14:02:37 +00:00
// @author Dominik Säume
2024-05-23 14:06:28 +00:00
// ==/UserScript==
2024-05-23 14:11:32 +00:00
2024-05-23 14:06:28 +00:00
const URL_STORAGE_KEY = "itexamanswers.net URL";
2024-05-23 15:38:36 +00:00
/** @type {Array<Answer>} */
2024-05-23 15:34:40 +00:00
let answerData;
2024-05-23 14:06:28 +00:00
2024-05-23 14:31:24 +00:00
window.addEventListener("keydown", async (event) => {
2024-05-23 14:06:28 +00:00
switch(event.key){
case "p":
2024-05-23 15:34:40 +00:00
const oldAnswersURL = GM_getValue(URL_STORAGE_KEY);
const newAnswersURL = prompt("Please input the answer url (itexamanswers.net)", oldAnswersURL);
GM_setValue(URL_STORAGE_KEY, newAnswersURL);
answerData = await window.fetchAnswers(newAnswersURL);
2024-05-23 15:38:36 +00:00
console.log(answerData);
2024-05-23 14:06:28 +00:00
break;
case "n":
document.getElementById("next").click();
break;
case "a":
2024-05-23 15:34:40 +00:00
window.answerQuestion(answerData);
2024-05-23 14:06:28 +00:00
break;
}
2024-05-23 14:36:13 +00:00
});