From c5135edf58b230e8e967d6ad0d818e3684926bea Mon Sep 17 00:00:00 2001 From: "Thorsten S." Date: Sun, 28 Jan 2024 20:55:31 +0100 Subject: [PATCH] pagination check --- dfde-singlepage.user.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) mode change 100755 => 100644 dfde-singlepage.user.js diff --git a/dfde-singlepage.user.js b/dfde-singlepage.user.js old mode 100755 new mode 100644 index 4c39101..1a5553a --- a/dfde-singlepage.user.js +++ b/dfde-singlepage.user.js @@ -28,14 +28,16 @@ myButton_a.innerText = "∞"; myButton.appendChild(myButton_a) - document.querySelector(".pagination ul").prepend(myButton); + const pagination = document.querySelector(".pagination ul"); + if (pagination) { + pagination.prepend(myButton); + } function clickit() { if (unsuitable) { window.location.href= "https://debianforum.de/forum/viewtopic.php?" + thread_id; } let promises = [] - const pageForm = document.querySelector('input[name=page-number]'); - const postPerPage = pageForm ? parseInt(pageForm.attributes["data-per-page"].value) : 25; + 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() => { -- 2.39.2