Added itb_scroll

This commit is contained in:
2024-12-08 10:54:37 +01:00
parent 928c1e14b9
commit 2499d7b83f
2 changed files with 82 additions and 2 deletions

View File

@@ -13,9 +13,19 @@ class ScreenshotGenerator:
def get_page_content(self) -> dict:
script = """
function processElement(element) {
if (!element.offsetParent && element !== document.body) return null;
// Check if element is actually visible in viewport
const rect = element.getBoundingClientRect();
if (!element.offsetParent && element !== document.body) return null;
if (rect.width === 0 || rect.height === 0) return null;
// Check if element is within viewport bounds
const viewportWidth = window.innerWidth;
const viewportHeight = window.innerHeight;
if (rect.bottom < 0 || rect.top > viewportHeight ||
rect.right < 0 || rect.left > viewportWidth) {
return null;
}
const styles = window.getComputedStyle(element);
const text = Array.from(element.childNodes)