38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
|
// ==UserScript==
|
||
|
// @name CCNA Autofill
|
||
|
// @namespace Violentmonkey Scripts
|
||
|
// @match *://assessment.netacad.net/*
|
||
|
// @match *://www.assessment.netacad.net/*
|
||
|
// @match *://www.google.com/*
|
||
|
// @match *://www.google.de/*
|
||
|
// @require https://git.euph.dev/SZUT-Dominik/CCNA_Autofill_Userscript/raw/branch/main/src/fetch.js
|
||
|
// @require https://git.euph.dev/SZUT-Dominik/CCNA_Autofill_Userscript/raw/branch/main/src/answer.js
|
||
|
// @grant GM_setValue
|
||
|
// @grant GM_getValue
|
||
|
// @grant GM_xmlhttpRequest
|
||
|
// @version 1.0.0
|
||
|
// @author Dominik Säume
|
||
|
// ==/UserScript==
|
||
|
|
||
|
const URL_STORAGE_KEY = "itexamanswers.net URL";
|
||
|
/** @type {Array<Answer>} */
|
||
|
let answerData;
|
||
|
|
||
|
window.addEventListener("keydown", async (event) => {
|
||
|
switch(event.key){
|
||
|
case "p":
|
||
|
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);
|
||
|
break;
|
||
|
|
||
|
case "n":
|
||
|
document.getElementById("next").click();
|
||
|
break;
|
||
|
|
||
|
case "a":
|
||
|
window.answerQuestion(answerData);
|
||
|
break;
|
||
|
}
|
||
|
});
|