]> git.aero2k.de Git - dfde/dfde-singlepage.git/commitdiff
read posts per page from page
authorThorsten S <mail@aero2k.de>
Tue, 14 Jun 2022 21:58:11 +0000 (23:58 +0200)
committerThorsten S <mail@aero2k.de>
Tue, 14 Jun 2022 21:58:11 +0000 (23:58 +0200)
dfde-singlepage.user.js

index 320a68882c79f57d22d695484ce3fecbec2bb353..25ed90b147a2b6ef10e477198ceb480304e363b4 100644 (file)
@@ -1,7 +1,7 @@
 // ==UserScript==
 // @name         dfde-singlepage
 // @namespace    de.debianforum
-// @version      0.3
+// @version      0.4
 // @description  View all pages of a thread on one page
 // @author       You
 // @match        https://debianforum.de/forum/viewtopic.php*t=*
         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);
+
         // async wrapper to fix the order of requests/posts
         const fn = async() => {
             for (var p=1; p<pages; p++) {
-                const url = "https://debianforum.de/forum/viewtopic.php?" + thread_id + "&start=" + p*15;
+                const url = "https://debianforum.de/forum/viewtopic.php?" + thread_id + "&start=" + p*postPerPage;
 
                 promises.push(
                     fetch(url)