sneaky little websites want a scroll, don't they?

This commit is contained in:
buzz-lightsnack-2007 2024-05-01 19:09:09 +08:00
parent ec53a7c1ee
commit 302742b2e0

View file

@ -6,6 +6,17 @@ export default class scraper {
constructor(scraper_fields) { constructor(scraper_fields) {
let field_content; 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) { if ((typeof scraper_fields).includes("object") && scraper_fields != null && scraper_fields) {
/* Read for the particular fields. */ /* Read for the particular fields. */