test: remove autoscroll

This commit is contained in:
buzz-lightsnack-2007 2024-10-25 11:16:46 +08:00
parent 2992c411bb
commit 85ebecab4d

View file

@ -47,7 +47,7 @@ export default class scraper {
}; };
// Check every 1 second to check until autosccroll is done. // Check every 1 second to check until autosccroll is done.
function wait(OPTIONS) { /*function wait(OPTIONS) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Check if autoscroll is done. // Check if autoscroll is done.
if (!((typeof window).includes(`undef`))) { if (!((typeof window).includes(`undef`))) {
@ -61,9 +61,8 @@ export default class scraper {
reject(); reject();
} }
}); });
} }*/
wait(this.#options).then(() => {
this.getTexts(this.fields, this.#options); this.getTexts(this.fields, this.#options);
this.getImages(this.fields, this.#options); this.getImages(this.fields, this.#options);
@ -77,7 +76,6 @@ export default class scraper {
// Observe the document. // Observe the document.
OBSERVER.observe(document.body, {"childList": true, "subtree": true}); OBSERVER.observe(document.body, {"childList": true, "subtree": true});
} }
});
} }
} }
@ -125,9 +123,7 @@ export default class scraper {
} else if ((typeof VALUE).includes(`obj`) && VALUE && !Array.isArray(VALUE)) { } else if ((typeof VALUE).includes(`obj`) && VALUE && !Array.isArray(VALUE)) {
DATA[NAME] = read(VALUE); DATA[NAME] = read(VALUE);
} else if (document.querySelector(VALUE)) { } else if (document.querySelector(VALUE)) {
(document.querySelector(VALUE)) DATA[NAME] = document.querySelector(VALUE).textContent.trim()
? DATA[NAME] = document.querySelector(VALUE).textContent.trim()
: false;
}; };
}; };
}); });