From 5e689cb40acad3d17ce7b8527d110aa7ec5a4ff1 Mon Sep 17 00:00:00 2001 From: LawyZheng Date: Fri, 10 May 2024 10:47:08 +0800 Subject: [PATCH] remove scrollUpAndDown --- skyvern/webeye/scraper/domUtils.js | 31 ------------------------------ 1 file changed, 31 deletions(-) diff --git a/skyvern/webeye/scraper/domUtils.js b/skyvern/webeye/scraper/domUtils.js index f760b5792..6a332aec3 100644 --- a/skyvern/webeye/scraper/domUtils.js +++ b/skyvern/webeye/scraper/domUtils.js @@ -1141,7 +1141,6 @@ function removeBoundingBoxes() { function scrollToTop(draw_boxes) { removeBoundingBoxes(); window.scrollTo({ left: 0, top: 0, behavior: "instant" }); - scrollDownAndUp(); if (draw_boxes) { var elementsAndResultArray = buildTreeFromBody(); drawBoundingBoxes(elementsAndResultArray[0]); @@ -1158,39 +1157,9 @@ function scrollToNextPage(draw_boxes) { top: window.innerHeight - 200, behavior: "instant", }); - scrollUpAndDown(); if (draw_boxes) { var elementsAndResultArray = buildTreeFromBody(); drawBoundingBoxes(elementsAndResultArray[0]); } return window.scrollY; } - -function scrollUpAndDown() { - // remove select2-drop-above class to prevent dropdown from being rendered on top of the box - // then scroll up by 1 and scroll down by 1 - removeSelect2DropAbove(); - window.scrollBy({ left: 0, top: -1, behavior: "instant" }); - removeSelect2DropAbove(); - window.scrollBy({ left: 0, top: 1, behavior: "instant" }); -} - -function scrollDownAndUp() { - // remove select2-drop-above class to prevent dropdown from being rendered on top of the box - // then scroll up by 1 and scroll down by 1 - removeSelect2DropAbove(); - window.scrollBy({ left: 0, top: 1, behavior: "instant" }); - removeSelect2DropAbove(); - window.scrollBy({ left: 0, top: -1, behavior: "instant" }); -} - -function removeSelect2DropAbove() { - var select2DropAbove = document.getElementsByClassName("select2-drop-above"); - var allElements = []; - for (var i = 0; i < select2DropAbove.length; i++) { - allElements.push(select2DropAbove[i]); - } - allElements.forEach((ele) => { - ele.classList.remove("select2-drop-above"); - }); -}