PageSourceSearch

https://www.harusailive.jp/assets/js/goto-top-button.js

js harusailive.jp collected 2026-10-04 21:55:58 UTC 965 bytes, 28 lines download raw bytes

1/*
2    add goto top button to body
3*/
4(()=>{
5    //console.log('add!');
6    let _div = document.createElement("div");
7    _div.id = "totop";
8	_div.className = 'btninactive';
9    _div.innerText = "▲TOP";
10    _div.onclick = ()=>{
11//        document.body.scrollTop = 0;
12//        document.documentElement.scrollTop = 0;
13        window.scrollTo({ top: 0, behavior: 'smooth' });
14    }
15    document.body.appendChild(_div);
16
17    window.onscroll = ()=>{
18        if (window.pageYOffset >= window.innerHeight*0.5) {
19            //document.getElementById('totop').style.visibility = "visible";
20			document.getElementById('totop').classList.add('btnactive');
21			document.getElementById('totop').classList.remove('btninactive');
22        } else {
23            //document.getElementById('totop').style.visibility = "hidden";
24			document.getElementById('totop').classList.add('btninactive');
25			document.getElementById('totop').classList.remove('btnactive');
26        }
27    }
28})()

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.