From: Thorsten Date: Thu, 7 Dec 2023 16:25:06 +0000 (+0100) Subject: fix for smaller threads X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=425107c67cdcb386c101c58494284ed49525416f;p=dfde%2Fdfde-singlepage.git fix for smaller threads --- diff --git a/dfde-singlepage.user.js b/dfde-singlepage.user.js old mode 100644 new mode 100755 index 25ed90b..4c39101 --- a/dfde-singlepage.user.js +++ b/dfde-singlepage.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name dfde-singlepage // @namespace de.debianforum -// @version 0.4 +// @version 0.5 // @description View all pages of a thread on one page // @author You // @match https://debianforum.de/forum/viewtopic.php*t=* @@ -34,7 +34,8 @@ if (unsuitable) { window.location.href= "https://debianforum.de/forum/viewtopic.php?" + thread_id; } let promises = [] - const postPerPage = parseInt(document.querySelector('input[name=page-number]').attributes["data-per-page"].value); + const pageForm = document.querySelector('input[name=page-number]'); + const postPerPage = pageForm ? parseInt(pageForm.attributes["data-per-page"].value) : 25; // async wrapper to fix the order of requests/posts const fn = async() => {