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

Function getPageBar

Pagetual/pagetual.user.js:11534–11565  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11532 }
11533
11534 function getPageBar() {
11535 let preBar = null, nextBar = null;
11536 let pageBars = [].slice.call(document.querySelectorAll(".pagetual_pageBar"));
11537 for (let i = 0; i < pageBars.length; i++) {
11538 let pageBar = pageBars[i];
11539 if (!pageBar || !getBody(document).contains(pageBar)) continue;
11540 let {
11541 top,
11542 right,
11543 bottom,
11544 left
11545 } = pageBar.getBoundingClientRect();
11546 if (top > 500) {
11547 nextBar = pageBar;
11548 preBar = (i - 1 >= 0 ? pageBars[i - 1] : null);
11549 if (pageBar && getBody(document).contains(pageBar)) {
11550 let {
11551 top,
11552 right,
11553 bottom,
11554 left
11555 } = pageBar.getBoundingClientRect();
11556 if (top < -500) {
11557 preBar = pageBar;
11558 } else preBar = (i - 2 >= 0 ? pageBars[i - 2] : null);
11559 }
11560 break;
11561 }
11562 }
11563 if (!nextBar) preBar = pageBars[pageBars.length - 2];
11564 return {preBar: preBar, nextBar: nextBar};
11565 }
11566
11567 var urlChanged = false;
11568 var urlChanging = false;

Callers 2

initMethod · 0.85
initListenerFunction · 0.85

Calls 2

containsMethod · 0.80
getBodyFunction · 0.70

Tested by

no test coverage detected