chore: lint
This commit is contained in:
@@ -428,39 +428,39 @@ async function clickNextPagination(selector, scrapedData, limit) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
window.scrollDown = async(selector, limit) {
|
window.scrollDown = async (selector, limit) {
|
||||||
let previousHeight = 0;
|
let previousHeight = 0;
|
||||||
let itemsLoaded = 0;
|
let itemsLoaded = 0;
|
||||||
|
|
||||||
while (itemsLoaded < limit) {
|
while (itemsLoaded < limit) {
|
||||||
window.scrollBy(0, window.innerHeight);
|
window.scrollBy(0, window.innerHeight);
|
||||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||||
|
|
||||||
const currentHeight = document.body.scrollHeight;
|
const currentHeight = document.body.scrollHeight;
|
||||||
|
|
||||||
if (currentHeight === previousHeight) {
|
if (currentHeight === previousHeight) {
|
||||||
break; // No more items to load
|
break; // No more items to load
|
||||||
}
|
}
|
||||||
|
|
||||||
previousHeight = currentHeight;
|
previousHeight = currentHeight;
|
||||||
itemsLoaded += document.querySelectorAll(selector).length;
|
itemsLoaded += document.querySelectorAll(selector).length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.scrollUp = async(selector, limit) {
|
window.scrollUp = async (selector, limit) {
|
||||||
let previousHeight = 0;
|
let previousHeight = 0;
|
||||||
let itemsLoaded = 0;
|
let itemsLoaded = 0;
|
||||||
|
|
||||||
while (itemsLoaded < limit) {
|
while (itemsLoaded < limit) {
|
||||||
window.scrollBy(0, -window.innerHeight);
|
window.scrollBy(0, -window.innerHeight);
|
||||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||||
|
|
||||||
const currentHeight = document.body.scrollHeight;
|
const currentHeight = document.body.scrollHeight;
|
||||||
|
|
||||||
if (currentHeight === previousHeight) {
|
if (currentHeight === previousHeight) {
|
||||||
break; // No more items to load
|
break; // No more items to load
|
||||||
}
|
}
|
||||||
|
|
||||||
previousHeight = currentHeight;
|
previousHeight = currentHeight;
|
||||||
itemsLoaded += document.querySelectorAll(selector).length;
|
itemsLoaded += document.querySelectorAll(selector).length;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user