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

Function scrollToPageBar

Pagetual/pagetual.user.js:12050–12061  ·  view source on GitHub ↗
(bar)

Source from the content-addressed store, hash-verified

12048
12049 var targetY = -1;
12050 function scrollToPageBar(bar) {
12051 if (window.pageYOffset == 0) {
12052 bar.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" });
12053 } else {
12054 let yOffset = -20;
12055 if (typeof ruleParser.curSiteRule.pageBarTop !== 'undefined') {
12056 yOffset = -ruleParser.curSiteRule.pageBarTop;
12057 }
12058 targetY = bar.getBoundingClientRect().top + window.pageYOffset + yOffset;
12059 window.scrollTo({ top: targetY, behavior: 'smooth'});
12060 }
12061 }
12062
12063 const pageNumReg=/[&\/\?](p=|page[=\/_-]?)\d+|[_-]\d+\./;
12064 function createPageBar(url) {

Callers 3

initMethod · 0.85
initListenerFunction · 0.85
createPageBarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected