PageSourceSearch

https://tropy.github.io/assets/javascripts/elements/scroll-nav.js

js tropy.github.io collected 2026-10-03 10:06:20 UTC 492 bytes, 19 lines download raw bytes

1import { CustomElement } from './custom-element.js'
2
3
4export class ScrollNav extends CustomElement {
5  connectedCallback() {
6    this.role = 'nav'
7
8    if (this.scrollWidth > this.clientWidth) {
9      const list = this.querySelector('ul');
10      const selected = list.querySelector('.selected')
11      const offset = (selected.offsetLeft + selected.offsetWidth / 2)
12        - this.offsetWidth / 2
13
14      this.scrollTo(offset, 0)
15    }
16  }
17}
18
19customElements.define('tpy-scroll-nav', ScrollNav)

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.