PageSourceSearch

https://hispanica.cz/assets/js/scroll-top.js?v=2026091901

js hispanica.cz collected 2026-09-25 11:21:52 UTC 1,022 bytes, 48 lines download raw bytes

1/**
2 * Tlačítko "Přejít nahoru".
3 *
4 * Dodaná verze na tohle měla frontend.min.js ze šablony Astra. CSS zůstalo
5 * převzaté, takže se musí přepínat třída, na kterou reaguje: #ast-scroll-top
6 * je skrytý, dokud nedostane 'ast-scroll-to-top-show'.
7 */
8(function () {
9	'use strict';
10
11	var btn = document.getElementById('ast-scroll-top');
12	if (!btn) {
13		return;
14	}
15
16	var THRESHOLD = 300;
17
18	function update() {
19		var show = window.scrollY > THRESHOLD;
20		btn.classList.toggle('ast-scroll-to-top-show', show);
21	}
22
23	function toTop() {
24		window.scrollTo({ top: 0, behavior: 'smooth' });
25	}
26
27	update();
28
29	var ticking = false;
30	window.addEventListener('scroll', function () {
31		if (ticking) {
32			return;
33		}
34		ticking = true;
35		window.requestAnimationFrame(function () {
36			update();
37			ticking = false;
38		});
39	}, { passive: true });
40
41	btn.addEventListener('click', toTop);
42	btn.addEventListener('keydown', function (e) {
43		if (e.key === 'Enter' || e.key === ' ') {
44			e.preventDefault();
45			toTop();
46		}
47	});
48})();

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.