1
1
Fork 0
This commit is contained in:
Dominik Säume 2024-05-23 18:43:18 +02:00
parent 27326c944b
commit 4baa5537a5
Signed by: SZUT-Dominik
GPG key ID: 67D15BB250B41E7C
3 changed files with 4 additions and 21 deletions

View file

@ -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,

View file

@ -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==

View file

@ -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<string, string>} [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<string, string>} responseHeaders - The response headers.
*/