From 302742b2e051269b9d36bf894f47de96acb86e60 Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Wed, 1 May 2024 19:09:09 +0800 Subject: [PATCH] sneaky little websites want a scroll, don't they? --- scripts/external/scraper.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/external/scraper.js b/scripts/external/scraper.js index ea28c70..c1c6bb6 100644 --- a/scripts/external/scraper.js +++ b/scripts/external/scraper.js @@ -6,6 +6,17 @@ export default class scraper { constructor(scraper_fields) { let field_content; + // Quickly scroll down then to where the user already was to get automatically hidden content. + function autoscroll() { + let SCROLL = {"x": window.scrollX, "y": window.scrollY}; + + [{"top": 0, "left": 0, "behavior": "smooth"}, {"top": document.body.scrollHeight, "left": document.body.scrollWidth, "behavior": "smooth"}, {"top": SCROLL[`y`], "left": SCROLL[`x`], "behavior": "smooth"}].forEach((POSITION) => { + window.scrollTo(POSITION); + }) + }; + + autoscroll(); + if ((typeof scraper_fields).includes("object") && scraper_fields != null && scraper_fields) { /* Read for the particular fields. */