PageSourceSearch

https://www.kolitzheim.de/__/scripts/script.js

js kolitzheim.de collected 2026-10-02 21:30:09 UTC 19,824 bytes, 508 lines download raw bytes

1runOnLoad(function() {
2    let quicknews = document.querySelector(".quicknews");
3    if (quicknews != undefined) {
4        quicknews.classList.add("show");
5        document.querySelectorAll('.quicknews .close-qn').forEach(qnClose => {
6            let closeQuicknews = (event) => {
7                if(event.type === 'click' || (event.type === 'keyup' && event.code === 'Enter')) {
8                    quicknews.classList.remove("show");
9                    window.setTimeout(() => {
10                        quicknews.style.display = "none";
11                    }, 1010);
12                    document.querySelector('.header__logo a').focus();
13                    document.querySelector('.header__logo a').blur();
14                }
15            }
16            qnClose.addEventListener("click", closeQuicknews);
17            qnClose.addEventListener("keyup", closeQuicknews);
18        });
19    }
20});
21
22window.addEventListener('DOMContentLoaded', () => {
23    //Map ausblenden -> Performance
24    initMap = initMap.createInterceptor(function (config) {
25        let container = document.getElementById(config.el);
26        if (!isVisible(container)) {
27            const intersectionObserver = new IntersectionObserver((entries) => {
28                let [entry] = entries;
29                if (entry.isIntersecting) {
30                    intersectionObserver.unobserve(container);
31                    initMap(config);
32                }
33            });
34            intersectionObserver.observe(container);
35            return false;
36        }
37        return true;
38    });
39    initMap.configs = [];
40    initMap.requests = 0;
41
42    document.querySelectorAll('.pagination .pagination__link').forEach(pagelink => {
43        pagelink.addEventListener(
44            'click',
45            event => {
46                if (!pagelink.dataset.module) {
47                    return;
48                }
49                let form = event.target.closest('form'),
50                    hiddenField = form.querySelector('[name="page_' + pagelink.dataset.module + '"]');
51                if (!hiddenField) {
52                    hiddenField = document.createElement('input');
53                    hiddenField.type = 'hidden';
54                    hiddenField.name = 'page_' + pagelink.dataset.module;
55                    form.append(hiddenField);
56                }
57                form.querySelector('[name="page_' + pagelink.dataset.module + '"]').value = pagelink.dataset.page - 1;
58                form.requestSubmit();
59            }
60        )
61    })
62    document.querySelectorAll('.search-form__sidebar').forEach(sidebar => {
63        sidebar.addEventListener(
64            'transitionend',
65            event => {
66                document.documentElement.style.setProperty(
67                    '--searchform-sidebar-height',
68                    'fit-content');
69            }
70        )
71    })
72    document.querySelectorAll('.topslider__infobox-closebtn').forEach((element) => {
73        element.addEventListener(
74            'click', () => {
75                element.parentElement.classList.toggle('closed');
76            }
77        )
78    });
79
80    document.querySelectorAll('.datepicker-autosubmit[name="ev[start]"]').forEach(element => {
81        element.addEventListener(
82            'change', () => {
83                element.form.requestSubmit();
84            }
85        )
86    });
87
88    let toplink = document.querySelector('#top-link');
89    toplink.addEventListener(
90        'click', () => {
91            window.scrollTo({
92                top: 0,
93                behavior: 'smooth'
94            })
95        }
96    );
97    if (document.querySelector('.equalheight-source') && document.querySelector('.equalheight-target')) {
98        const a = 1;
99        const resizeObserver = new ResizeObserver((entries) => {
100            for (const entry of entries) {
101                let size = 0;
102                if (entry.contentBoxSize) {
103                    size = entry.contentBoxSize[0].blockSize;
104                } else {
105                    size = entry.contentRect.height;
106                }
107                const equalheightId = entry.target.dataset.equalheightId;
108                const idSelector = equalheightId === undefined ? ':not([data-equalheight-id])' : '[data-equalheight-id="' + equalheightId + '"]';
109
110                document.querySelectorAll('.equalheight-target' + idSelector).forEach($target => {
111                    $target.style.minHeight = size + 'px';
112                })
113            }
114        });
115
116        document.querySelectorAll('.equalheight-source').forEach($source => {
117            resizeObserver.observe($source);
118        })
119    }
120    document.querySelectorAll('select[name="ev[ortsteil]"] option[value=""]').forEach( option => option.innerText = 'Alle Ortsteile');
121
122    document.querySelectorAll(':is(img, picture)[data-copyright]').forEach($img => {
123        let position = 'right';
124        if(!$img.closest('.catalog-details') && $img.parentNode.querySelector('.datebox')){
125            position = 'left';
126        }
127
128        const $wrapper = document.createElement('div');
129        $wrapper.classList.add('copyright-wrapper');
130        $img.parentNode.insertBefore($wrapper, $img);
131        $wrapper.appendChild($img);
132        const $copyright = document.createElement('a');
133        $copyright.href = '#';
134        $copyright.classList.add('copyright-icon');
135        if(position === 'left'){
136            $copyright.classList.add('copyright-icon--left');
137        }
138        $copyright.innerHTML = '©';
139        $copyright.addEventListener(
140            'click',
141            event => {
142                event.preventDefault();
143                const $msgbox = recon.Msg.show('©
143 Copyright Infos', $img.dataset.copyright, []);
144                $msgbox.dialog.classList.add('copyright-dialog');
145                const $closeButton = $msgbox.headerElement.querySelector('button');
146                if(!$closeButton.querySelector('svg')) {
147                    const $closeIcon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
148                    $closeIcon.dataset.src = '/__/icons/close.svg'
149                    $closeButton.appendChild($closeIcon);
150                }
151            }
152        )
153        $wrapper.appendChild($copyright);
154    })
155})
156
157window.addEventListener('DOMContentLoaded', async () => {
158        let {default: searchform} = await import("./searchform.js");
159        new searchform();
160    }
161)
162
163window.addEventListener('load', () => {
164    let rgNav = document.querySelector('rg-nav'),
165        registerToggleNav = function () {
166            if (rgNav.offcanvasNav) {
167                rgNav.offcanvasNav.on('toggle', (event) => {
168                    const headerOptions = document.querySelector('.header__options');
169                    if (event.data.action == 'open') {
170                        headerOptions.classList.add('menu-open');
171                    } else {
172                        headerOptions.classList.remove('menu-open');
173                    }
174                });
175            } else {
176                window.setTimeout(registerToggleNav, 100);
177            }
178        };
179    registerToggleNav();
180    document.querySelectorAll('#spsearch').forEach((el) => {
181        recon.callFn('SpSearch', [
182            el.dataset.uid,
183            {
184                count: el.dataset.limit,
185                pager: el.dataset.showpager,
186                suggest: el.dataset.showsuggestions,
187                showconfig: el.dataset.showconfig,
188                placeholder: el.dataset.placeholder,
189                instant: el.dataset.searchrealtime,
190                target: el.dataset.searchdir,
191                value: el.dataset.value
192            }
193        ]);
194        document.querySelectorAll('rg-search').forEach((s) => {
195            const replaceFields = function () {
196                if (!s.showSearch) {
197                    window.setTimeout(replaceFields, 50);
198                    return;
199                }
200                s.showSearch();
201                let searchInputField = s.getInputField(),
202                    spInput = document.querySelector('#spsearch input');
203                spInput.className = searchInputField.className;
204                spInput.name = 'q';
205                searchInputField.replaceWith(spInput);
206            }
207            replaceFields();
208        });
209    });
210
211    function scrollDetect($target) {
212        const topThreshold = 150;
213        let lastScrollPosition = window.scrollY;
214
215        window.addEventListener('scroll', event => {
216            if (getComputedStyle($target).getPropertyValue('--scroll-actions') !== 'on') {
217                return false;
218            }
219
220            if (window.scrollY <= topThreshold && !$target.classList.contains('preparetop') && !$target.classList.contains('top')) {
221                const $img = $target.querySelector('.header__logo img');
222                new Promise((resolve, reject) => {
223                    if ($img) {
224                        $target.classList.add('preparetop');
225                        $img.animate(
226                            [
227                                {height: '46px'},
228                                {height: 0}
229                            ],
230                            {
231                                duration: 500,
232                                iterations: 1,
233                            }
234                        ).onfinish = resolve
235                    } else {
236                        window.setTimeout(() => resolve('stop'), 500)
237                    }
238                })
239                    .then((result) => {
240                        $target.classList.add('top');
241                        $target.classList.remove('preparetop');
242                        $target.classList.remove('up');
243                        $target.classList.remove('down');
244                        if (result === 'stop') {
245                            return Promise.reject()
246                        } else {
247                            return Promise.resolve()
248                        }
249                    })
250                    .then(() => {
251                        $img.animate(
252                            [
253                                {height: 0},
254                                {height: $img.naturalOffsetHeight + 'px'}
255                            ],
256                            {
257                                duration: 500,
258                                iterations: 1,
259                            }
260                        )
261                        return Promise.resolve();
262                    })
263                    .catch(e => {
264                    })
265            } else if (window.scrollY > lastScrollPosition && window.scrollY > topThreshold && !$target.classList.contains('preparedown') && !$target.classList.contains('down')) {
266                const $img = $target.querySelector('.header__logo img');
267                new Promise((resolve, reject) => {
268                    if ($img && !$target.classList.contains('up')) {
269                        $img.naturalOffsetHeight = $img.offsetHeight;
270                        $target.classList.add('preparedown');
271                        $img.animate(
272                            [
273                                {height: $img.offsetHeight + 'px'},
274                                {height: 0}
275                            ],
276                            {
277                                duration: 500,
278                                iterations: 1,
279                            }
280                        ).onfinish = resolve
281                    } else {
282                        if ($target.classList.contains('up')) {
283                            resolve('stop');
284                        } else {
285                            window.setTimeout(() => resolve('stop'), 500)
286                        }
287                    }
288                })
289                    .then((result) => {
290                        $target.classList.add('down');
291                        $target.classList.remove('preparedown');
292                        $target.classList.remove('up');
293                        $target.classList.remove('top');
294                        if (result === 'stop') {
295                            return Promise.reject()
296                        } else {
297                            return Promise.resolve()
298                        }
299                    })
300                    .then(() => {
301                        $img.animate(
302                            [
303                                {height: 0},
304                                {height: '46px'}
305                            ],
306                            {
307                                duration: 500,
308                                iterations: 1,
309                            }
310                        )
311                        return Promise.resolve();
312                    })
313                    .catch(e => {
314                    })
315            } else if (window.scrollY < lastScrollPosition && window.scrollY > topThreshold && !$target.classList.contains('prepareup') && !$target.classList.contains('up')) {
316                $target.classList.add('up');
317                $target.classList.remove('down');
318            }
319            lastScrollPosition = window.scrollY;
320        })
321    }
322
323    document.querySelectorAll('[data-scrollwatch]').forEach($element => scrollDetect($element));
324
325    document.querySelectorAll('.timeline').forEach($timeline => {
326        const filterHeight = parseInt(getComputedStyle($timeline).getPropertyValue('--timeline-filter-height'));
327        const iconHeight = parseInt(getComputedStyle($timeline).getPropertyValue('--timeline-size-icon'));
328        let timelineObserverOptions = {
329            rootMargin: `${filterHeight}px 0px -${filterHeight * 0.6 + iconHeight}px 0px`,
330        };
331        let observer = new IntersectionObserver(
332            (entries) => {
333                console.log(entries);
334                entries.forEach(entry => {
335                    if (entry.isIntersecting) {
336                        entry.target.classList.add('timeline__icon--inview');
337                    } else {
338                        entry.target.classList.remove('timeline__icon--inview');
339                    }
340                })
341            }, timelineObserverOptions);
342        document.querySelectorAll('.timeline__icon').forEach($timelineIcon => {
343            observer.observe($timelineIcon);
344        })
345    })
346
347    sizeAdjust();
348
349    screen.orientation.addEventListener("change", sizeAdjust);
350
351    if(document.body.classList.contains('usebulletnav')) {
352        const bulletnav = new Bulletnav();
353    }
354
355
356})
357
358function sizeAdjust() {
359    document.querySelectorAll('[data-sizeadjust_group]').forEach($group => {
360        const id = $group.dataset.sizeadjust_id;
361        const sourceAttribute = $group.dataset.sizeadjust_sattribute ?? 'height';
362        const targetAttribute = $group.dataset.sizeadjust_tattribute ?? 'height';
363        const minmax = $group.dataset.sizeadjust_minmax ?? 'max';
364        const modifier = parseInt($group.dataset.sizeadjust_modifier ?? '0');
365
366        const $sources = $group.querySelectorAll('[data-sizeadjust_source][data-sizeadjust_id="' + id + '"]');
367        const $targets = $group.querySelectorAll('[data-sizeadjust_target][data-sizeadjust_id="' + id + '"]');
368
369        let targetSize
370
371        if (minmax === 'min') {
372            targetSize = Infinity;
373        } else {
374            targetSize = 0;
375        }
376
377        $sources.forEach($source => {
378            let sourceSize = null;
379            switch (sourceAttribute) {
380                case 'height':
381                    sourceSize = $source.offsetHeight;
382                    break;
383                case 'width':
384                    sourceSize = $source.offsetWidth;
385                    break;
386            }
387            if (sourceSize !== null) {
388                switch (minmax) {
389                    case 'min':
390                        targetSize = Math.min(targetSize, sourceSize);
391                        break;
392                    case 'max':
393                        targetSize = Math.max(targetSize, sourceSize);
394                        break;
395                }
396            }
397        })
398
399        targetSize += modifier;
400
401        $targets.forEach($target => {
402            $target.style[targetAttribute] = targetSize + 'px';
403        })
404    })
405}
406
407class Bulletnav {
408    #$bullets = new Map();
409    #$targets = null;
410    #observer = null;
411
412    constructor() {
413        this.#$targets = [...document.querySelectorAll('header, main>section, footer')].filter($target => {
414            return getComputedStyle($target)['display'] !== 'none';
415        });
416        this.buildBullets();
417        this.setupObserver();
418    }
419
420    buildBullets() {
421        const $navContainer = document.createElement('aside');
422        $navContainer.classList.add('bulletnav');
423        const $navList = document.createElement('ul');
424        $navContainer.append($navList);
425        for (const [index, $target] of this.#$targets.entries()) {
426            let targetID = $target.id;
427            if (targetID === '') {
428                targetID = 'bullet-' + index;
429                $target.id = targetID;
430            }
431            const $bullet = document.createElement('li');
432            $bullet.classList.add('bullet');
433
434            const $link = document.createElement('a');
435            $link.href = '#' + targetID;
436
437            $bullet.append($link);
438            $navList.append($bullet);
439
440            this.#$bullets.set($target, $bullet);
441        }
442        document.body.prepend($navContainer);
443    }
444
445    setupObserver() {
446        this.#observer = new IntersectionObserver(this.intersectionChanged.bind(this),
447            {
448                rootMargin: '-1px'
449            })
450
451        for (const $target of this.#$targets) {
452            this.#observer.observe($target);
453        }
454    }
455
456    intersectionChanged(entries) {
457        for (const entry of entries) {
458            if (entry.isIntersecting) {
459                this.#$bullets.get(entry.target).classList.add('active');
460            } else {
461                this.#$bullets.get(entry.target).classList.remove('active');
462            }
463        }
464    }
465}
466
467function isVisible(elem) {
468    if (!(elem instanceof Element)) {
469        throw Error('DomUtil: elem is not an element.');
470    }
471    const style = getComputedStyle(elem);
472    if (style.display === 'none') {
473        return false;
474    }
475    if (style.visibility !== 'visible') {
476        return false;
477    }
478    if (style.opacity < 0.1) {
479        return false;
480    }
481    if (elem.offsetWidth + elem.offsetHeight + elem.getBoundingClientRect().height +
482        elem.getBoundingClientRect().width === 0) {
483        return false;
484    }
485    const elemCenter = {
486        x: elem.getBoundingClientRect().left + elem.offsetWidth / 2,
487        y: elem.getBoundingClientRect().top + elem.offsetHeight / 2
488    };
489    if (elemCenter.x < 0) {
490        return false;
491    }
492    if (elemCenter.x > (document.documentElement.clientWidth || window.innerWidth)) {
493        return false;
494    }
495    if (elemCenter.y < 0) {
496        return false;
497    }
498    if (elemCenter.y > (document.documentElement.clientHeight || window.innerHeight)) {
499        return false;
500    }
501    let pointContainer = document.elementFromPoint(elemCenter.x, elem
501Center.y);
502    do {
503        if (pointContainer === elem) {
504            return true;
505        }
506    } while (pointContainer = pointContainer.parentNode);
507    return false;
508}

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.