39 lines
No EOL
1.3 KiB
JavaScript
39 lines
No EOL
1.3 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/fetch.js
|
|
// @require https://git.euph.dev/SZUT-Dominik/CCNA_Autofill_Userscript/raw/branch/main/answer.js
|
|
// @grant GM_setValue
|
|
// @grant GM_getValue
|
|
// @grant GM_xmlhttpRequest
|
|
// @version 0.0.18
|
|
// @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);
|
|
console.log(answerData);
|
|
break;
|
|
|
|
case "n":
|
|
document.getElementById("next").click();
|
|
break;
|
|
|
|
case "a":
|
|
window.answerQuestion(answerData);
|
|
break;
|
|
}
|
|
}); |