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

Function isInViewPort

Pagetual/pagetual.user.js:11515–11532  ·  view source on GitHub ↗
(element)

Source from the content-addressed store, hash-verified

11513 }
11514
11515 function isInViewPort(element) {
11516 const viewWidth = window.innerWidth || document.documentElement.clientWidth;
11517 const viewHeight = window.innerHeight || document.documentElement.clientHeight;
11518 const {
11519 top,
11520 right,
11521 bottom,
11522 left
11523 } = element.getBoundingClientRect();
11524
11525 return (
11526 top >= 0 &&
11527 left >= 0 &&
11528 right <= viewWidth + 1 &&
11529 top <= viewHeight * rate &&
11530 isVisible(element, _unsafeWindow)
11531 );
11532 }
11533
11534 function getPageBar() {
11535 let preBar = null, nextBar = null;

Callers 2

initListenerFunction · 0.85
checkPageFunction · 0.85

Calls 1

isVisibleFunction · 0.85

Tested by

no test coverage detected