update
This commit is contained in:
parent
f9383a99c9
commit
3d316fab7d
2 changed files with 14 additions and 1 deletions
11
answer.js
11
answer.js
|
@ -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 [];
|
||||
|
|
|
@ -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":
|
||||
|
|
Loading…
Reference in a new issue