From: Thorsten S. Date: Sun, 28 Jan 2024 19:55:31 +0000 (+0100) Subject: pagination check X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=dfde%2Fdfde-singlepage.git pagination check --- 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() => {