From 4baa5537a5a2fc7b242a2bd327523dcb1d44f87e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Thu, 23 May 2024 18:43:18 +0200 Subject: [PATCH] update --- fetch.js | 5 +++-- main.user.js | 2 +- types/GM_xmlhttpRequest.d.js | 18 ------------------ 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/fetch.js b/fetch.js index 9fed719..5d76b3e 100644 --- a/fetch.js +++ b/fetch.js @@ -67,7 +67,7 @@ function getAllAnswersElement(response) { */ function parseAnswerElement(index, element, allAnswersElement) { // Check for Possible Tags - if (!(element.tagName === "P" || element.tagName === "STRONG")) { + if (!(element.tagName === "P" || element.tagName === "STRONG") || !element.innerHTML) { return; } @@ -81,6 +81,7 @@ function parseAnswerElement(index, element, allAnswersElement) { questionElement = element; } + // Get Question const questionText = parseQuestion(questionElement); if (questionText === null) { @@ -89,7 +90,7 @@ function parseAnswerElement(index, element, allAnswersElement) { // Get Awsners const answersElement = getAnswersElement(index, allAnswersElement); - if (answersElement === null || answersElement.tagName === "UL") return; + if (answersElement === null || answersElement.tagName !== "UL") return; return { question: questionText, diff --git a/main.user.js b/main.user.js index c078d46..725c2f7 100644 --- a/main.user.js +++ b/main.user.js @@ -10,7 +10,7 @@ // @grant GM_setValue // @grant GM_getValue // @grant GM_xmlhttpRequest -// @version 0.0.17 +// @version 0.0.18 // @author Dominik Säume // ==/UserScript== diff --git a/types/GM_xmlhttpRequest.d.js b/types/GM_xmlhttpRequest.d.js index a9a9e06..39635a5 100644 --- a/types/GM_xmlhttpRequest.d.js +++ b/types/GM_xmlhttpRequest.d.js @@ -4,21 +4,8 @@ * @param {string} details.method - The HTTP request method (e.g., 'GET', 'POST'). * @param {string} details.url - The URL to send the request to. * @param {Object} [details.headers] - Additional headers to include in the request. - * @param {string|FormData|Document|Blob|ArrayBuffer} [details.data] - The data to send with the request. - * @param {string} [details.overrideMimeType] - A MIME type to specify with the request (e.g., "text/html; charset=ISO-8859-1"). - * @param {string} [details.password] - Password to use for authentication purposes. - * @param {string} [details.responseType] - Decode the response as specified type. Accepted values are "", "arraybuffer", "blob", "document", "json", "text", "ms-stream". Default value is "text". See XMLHttpRequest responseType. - * @param {boolean} [details.synchronous] - Defaults to false. When true, this is a synchronous request. Be careful: The entire Firefox UI will be locked and frozen until the request completes. In this mode, more data will be available in the return value. - * @param {number} [details.timeout] - The number of milliseconds to wait before terminating the call; zero (the default) means wait forever. - * @param {Object} [details.upload] - Object containing optional function callbacks (onabort, onerror, onload, onprogress) to monitor the upload of data. Each is passed one argument, the Response Object. - * @param {string} details.url - Required. The URL to make the request to. Must be an absolute URL, beginning with the scheme. May be relative to the current page. - * @param {string} [details.user] - User name to use for authentication purposes. * @param {function(GMXMLHttpRequestResponse):void} [details.onload] - Optional. Will be called when the request has completed successfully. Passed one argument, the Response Object. * @param {Function} [details.onerror] - Optional. Will be called if an error occurs while processing the request. Passed one argument, the Response Object. - * @param {Function} [details.onabort] - Optional. Will be called when the request is aborted. Passed one argument, the Response Object. - * @param {Function} [details.ontimeout] - Optional. Will be called if/when the request times out. Passed one argument, the Response Object. - * @param {Function} [details.onprogress] - Optional. Will be called when the request progress changes. Passed one argument, the Response Object. - * @param {Function} [details.onreadystatechange] - Optional. Will be called repeatedly while the request is in progress. Passed one argument, the Response Object. * @returns {undefined} */ function GM_xmlhttpRequest(details) { @@ -28,10 +15,5 @@ function GM_xmlhttpRequest(details) { /** * Response object for the HTTP request. * @typedef {Object} GMXMLHttpRequestResponse - * @property {number} readyState - The state of the request. - * @property {string} responseHeaders - The response headers. * @property {string} responseText - The response body as text. - * @property {number} status - The HTTP status code of the response. - * @property {string} statusText - The status message corresponding to the status code. - * @property {Object} responseHeaders - The response headers. */