PageSourceSearch

https://joswlv.github.io/js/main.js

js joswlv.github.io collected 2026-10-03 09:25:12 UTC 1,626 bytes, 54 lines download raw bytes

1/**
2 * some JavaScript code for this blog theme
3 */
4/* jshint asi:true */
5
6/////////////////////////header////////////////////////////
7/**
8 * clickMenu
9 */
10(function() {
11    if (window.innerWidth <= 770) {
12        var menuBtn = document.querySelector('#headerMenu')
13        var nav = document.querySelector('#headerNav')
14        menuBtn.onclick = function(e) {
15            e.stopPropagation()
16            if (menuBtn.classList.contains('active')) {
17                menuBtn.classList.remove('active')
18                nav.classList.remove('nav-show')
19            } else {
20                nav.classList.add('nav-show')
21                menuBtn.classList.add('active')
22            }
23        }
24        document.querySelector('body').addEventListener('click', function() {
25            nav.classList.remove('nav-show')
26            menuBtn.classList.remove('active')
27        })
28    }
29}());
30
31
32//////////////////////////back to top////////////////////////////
33(function() {
34    var backToTop = document.querySelector('.back-to-top')
35    var backToTopA = document.querySelector('.back-to-top a')
36        // console.log(backToTop);
37    window.addEventListener('scroll',function () {
38
39
40        // 页面顶部滚进去的距离
41        var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop)
42
43        if (scrollTop > 200) {
44            backToTop.classList.add('back-to-top-show')
45        } else {
46            backToTop.classList.remove('back-to-top-show')
47        }
48    })
49
50    // backToTopA.addEventListener('click',function (e) {
51    //     e.preventDefault()
52    //     window.scrollTo(0,0)
53    // })
54}());

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.