PageSourceSearch

https://www.imlanghome.com/assets/js/unit/landing-nav.js

js imlanghome.com collected 2026-10-05 02:54:34 UTC 1,207 bytes, 33 lines download raw bytes

1class ScriptLandingNav extends Script {
2  constructor(params) {
3    super(params)
4    this.$mainModule = document.querySelector('[package-block-type="main"]')
5    this.$anchorList = this.$mainModule.querySelectorAll('[anchor-name][is-show-top="1"]')
6    this.$navInfo = document.querySelector(`#${this.attrId}`)
7    this.$hrefList = this.$navInfo.querySelectorAll('[anchor-href]')
8    this.$navContainer = document.querySelector('[package-block-type="breadcrumb"]')
9  }
10  get navHeight() {
11    return this.$navContainer.offsetHeight
12  }
13  async init() {
14    window.addEventListener('scroll', () => {
15      this.landingScrollPosition()
16    })
17    window.addEventListener('resize', () => {
18      this.landingScrollPosition()
19    })
20  }
21  /** 广告页时,滚动时,显示相对应的导航 */
22  landingScrollPosition() {
23    const scrollTop = window.pageYOffset
24    for (var i = 0; i < this.$hrefList.length; i++) {
25      if (scrollTop + this.navHeight >= this.$anchorList[i].offsetTop) {
26        for (var j = 0; j < this.$hrefList.length; j++) {
27          this.$hrefList[j].className = 'unit-landing-nav__a'
28        }
29        this.$hrefList[i].className = 'unit-landing-nav__a active'
30      }
31    }
32  }
33}

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.