/*
* @title nextH
* @description scroll into next headings (h1-6)
* @include http://*
* @include https://*
* @contributor yuggrdrasill http://let.hatelabo.jp/yuggrdrasill/let/gYC-xqSB3eS6NA
* @contributor noromanba http://let.hatelabo.jp/noromanba/let/hLHWrpDmo_lO (Fork of)
* @license MIT License https://opensource.org/licenses/MIT
* @javascript_url
*/
Array.from(document.body.querySelectorAll([
Array.from(Array(6).keys(), n => 'h' + (n + 1))
])).some(heading => {
// current scrolling values
// window.scrollY
// window.pageYOffset
// document.documentElement.scrollTop
// document.body.scrollTop
const absHPos = Math.trunc(heading.getBoundingClientRect().top + document.body.scrollTop);
if (absHPos > document.body.scrollTop) {
heading.scrollIntoView();
return true;
}
});