diff --git a/answer.js b/answer.js index f62d117..e3893f8 100644 --- a/answer.js +++ b/answer.js @@ -1,3 +1,8 @@ +/** + * + * @param {Array} answerData + * @returns + */ function answerQuestion(answerData){ const question = document.querySelector(".question:not(.hidden)"); if (!question) { @@ -30,6 +35,12 @@ function answerQuestion(answerData){ } } +/** + * + * @param {Array} answerData + * @param {string} questionText + * @returns + */ function findAnswers(answerData, questionText, answers) { if (answerData === null) { return []; diff --git a/main.user.js b/main.user.js index 1abf615..93d17b6 100644 --- a/main.user.js +++ b/main.user.js @@ -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} */ 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":