// ==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)