1
1
Fork 0
This commit is contained in:
Dominik Säume 2024-05-23 17:38:36 +02:00
parent f9383a99c9
commit 3d316fab7d
Signed by: SZUT-Dominik
GPG key ID: 67D15BB250B41E7C
2 changed files with 14 additions and 1 deletions

View file

@ -1,3 +1,8 @@
/**
*
* @param {Array<Answer>} answerData
* @returns
*/
function answerQuestion(answerData){
const question = document.querySelector(".question:not(.hidden)");
if (!question) {
@ -30,6 +35,12 @@ function answerQuestion(answerData){
}
}
/**
*
* @param {Array<Answer>} answerData
* @param {string} questionText
* @returns
*/
function findAnswers(answerData, questionText, answers) {
if (answerData === null) {
return [];

View file

@ -10,11 +10,12 @@
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_xmlhttpRequest
// @version 0.0.12
// @version 0.0.13
// @author Dominik Säume
// ==/UserScript==
const URL_STORAGE_KEY = "itexamanswers.net URL";
/** @type {Array<Answer>} */
let answerData;
window.addEventListener("keydown", async (event) => {
@ -24,6 +25,7 @@ window.addEventListener("keydown", async (event) => {
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":