MCPcopy Index your code
hub / github.com/hoothin/UserScripts / findFirstVisibleElement

Function findFirstVisibleElement

X-Downloader/X-Downloader.user.js:137–143  ·  view source on GitHub ↗
(selector)

Source from the content-addressed store, hash-verified

135 return rect.top < window.innerHeight && rect.top > 0 && rect.bottom >= 0;
136 }
137 function findFirstVisibleElement(selector) {
138 const elements = document.querySelectorAll(selector);
139 const firstVisibleElement = Array.from(elements).find(el => {
140 return isElementVisible(el);
141 });
142 return firstVisibleElement;
143 }
144 let checkTimer;
145 const touchCheck = e => {
146 clearTimeout(checkTimer);

Callers 1

touchCheckFunction · 0.85

Calls 1

isElementVisibleFunction · 0.85

Tested by

no test coverage detected