PageSourceSearch

https://www.rosenheim.de/typo3conf/ext/in2template/Resources/Public/JavaScripts/navbar-Cg1zX9Wp.js

js rosenheim.de collected 2026-10-02 07:31:26 UTC 2,921 bytes, 79 lines download raw bytes

1import { t as getBodyAfterString } from "./getbodyafterstring-Dky44Dtg.js";
2//#region assets/javascripts/libs/navbar.js
3function setScrollPositionToBody() {
4	const { body } = document;
5	body.dataset.savedscrollposition = window.scrollY;
6}
7/**
8* change classes on body if is scrolled up or down
9*/
10function addScrollSettings() {
11	const { body } = document;
12	const bodyDataset = document.body.dataset;
13	window.addEventListener("scroll", () => {
14		const lastSavedScrollPosition = parseInt(bodyDataset.savedscrollposition, 10);
15		const scrollPosition = parseInt(window.scrollY, 10);
16		const mobilePadding = parseInt(bodyDataset.mobilepadding, 10);
17		const calculatedTargetScrollDown = lastSavedScrollPosition + mobilePadding;
18		const calculatedTargetScrollUp = lastSavedScrollPosition - mobilePadding;
19		if (calculatedTargetScrollDown < scrollPosition) {
20			body.classList.add("js-scrolldown");
21			setScrollPositionToBody();
22			document.dispatchEvent(new CustomEvent("navbarScrollDown"));
23		} else if (calculatedTargetScrollUp > scrollPosition) {
24			body.classList.remove("js-scrolldown");
25			setScrollPositionToBody();
26			document.dispatchEvent(new CustomEvent("navbarScrollUp"));
27		}
28	}, false);
29}
30/**
31* Set the padding to body and sectionMenu if the view is mobile
32*/
33function setBodyPadding() {
34	const { body } = document;
35	let navbarHeight = 0;
36	if (body.dataset.mobilepadding) {
37		navbarHeight = body.dataset.mobilepadding;
38		document.dispatchEvent(new CustomEvent("setNavbarHeight"));
39	}
40	if (!getBodyAfterString().includes("mobile")) body.style.paddingTop = "0px";
41	else body.style.paddingTop = `${navbarHeight}px`;
42}
43/**
44* adds the classes and other settings for the fixex mobile header
45*/
46function setFixedElements() {
47	const { body } = document;
48	addScrollSettings();
49	body.classList.add("js-navbar-fixed");
50	setBodyPadding();
51	setScrollPositionToBody();
52	body.classList.add("js-initscroll");
53}
54/**
55* Configure the navbar if the navbar outside the view scrolled
56*/
57function configureNavbar() {
58	const navbarContainer = document.querySelector(".c-pageheader__container");
59	const navbarHeight = navbarContainer.offsetHeight;
60	const { body } = document;
61	if (body.dataset.mobilepadding === void 0 || body.dataset.mobilepadding === null) {
62		body.dataset.mobilepadding = navbarHeight;
63		document.dispatchEvent(new CustomEvent("setNavbarHeight"));
64	}
65	if (getBodyAfterString().includes("mobile")) setFixedElements();
66	document.addEventListener("mobileMenuTrigger", () => {
67		setFixedElements();
68	});
69	window.addEventListener("resize", () => {
70		body.dataset.mobilepadding = navbarContainer.offsetHeight;
71		setBodyPadding();
72		if (getBodyAfterString().includes("mobile")) setFixedElements();
73	});
74}
75const ioNavbar = new IntersectionObserver(configureNavbar, { threshold: [0, 1] });
76ioNavbar.POLL_INTERVAL = 100;
77const navbar = document.querySelector(".c-pageheader__fixedheader");
78ioNavbar.observe(navbar);
79//#endregion

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.