feat: remove browser side scroll up
This commit is contained in:
@@ -145,25 +145,6 @@ async function scrollDownToLoadMore(selector, limit) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function scrollUpToLoadMore(selector, limit) {
|
|
||||||
let previousHeight = 0;
|
|
||||||
let itemsLoaded = 0;
|
|
||||||
|
|
||||||
while (itemsLoaded < limit) {
|
|
||||||
window.scrollBy(0, -window.innerHeight);
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
||||||
|
|
||||||
const currentHeight = document.body.scrollHeight;
|
|
||||||
|
|
||||||
if (currentHeight === previousHeight) {
|
|
||||||
break; // No more items to load
|
|
||||||
}
|
|
||||||
|
|
||||||
previousHeight = currentHeight;
|
|
||||||
itemsLoaded += document.querySelectorAll(selector).length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a "scrape" result from the current page.
|
* Returns a "scrape" result from the current page.
|
||||||
* @returns {Array<Object>} *Curated* array of scraped information (with sparse rows removed)
|
* @returns {Array<Object>} *Curated* array of scraped information (with sparse rows removed)
|
||||||
|
|||||||
Reference in New Issue
Block a user