PageSourceSearch

https://www.landkreistag-bw.de/typo3temp/assets/vhs-assets-landkre…artyProgressJs-script-script2.js?1790302124

js landkreistag-bw.de collected 2026-09-25 04:51:38 UTC 20,913 bytes, 707 lines download raw bytes

1$(document).ready(function(){
2    // show submenu on click
3    let submenues = $( "#navigation-main .menu-sub" );
4    submenues.click(function(event) {
5        let isOpen = $( this ).hasClass( "open" );
6        
7        if (!isOpen) {
8            submenues.removeClass( "open" );
9            $( this ).addClass( "open" );
10            $( this ).parents('.menu-sub').addClass( "open" );
11        }
12        else {
13            $( this ).removeClass( "open" );
14        }
15        
16        event.preventDefault();
17        event.stopPropagation();
18    });
19    $( "#navigation-main .menu-sub li" ).click(function(event) {
20        event.stopPropagation();
21    });
22    
23    // open / close tab item (Klappelement)
24    $(".tabitem-content").hide();
25    $( ".tabitem .tabitem-header" ).click(function(event) {
26        $( this ).parent().toggleClass( "opened" );
27        $( this ).siblings( ".tabitem-content").slideToggle();
28
29    });
30    // open via enter key
31    $( ".tabitem .tabitem-header" ).keydown(function(event) {
32        console.dir(event);
33        if(event.which==13 || event.which==32) {
34            $( this ).click();
35        }
36    });
37    
38    // show / hide searchbox
39    var searchButton = document.querySelector('#btn-search');
40    searchButton.addEventListener('click', function() {
41        let searchBox = document.querySelector('#search-box');
42            searchBox.classList.toggle('opened');
43    });
44    
45    // don't start slider when "prefers-reduced-motion"
46    const isReduced = window.matchMedia(`(prefers-reduced-motion: reduce)`) === true || window.matchMedia(`(prefers-reduced-motion: reduce)`).matches === true;
47    if (!!isReduced) {
48        slickUids.forEach((number, index) => {
49            $('#slickid-'+number).slick('slickPause');
50        });
51    }
52    // stop slider after 5s
53    setTimeout(function() {
54        slickUids.forEach((number, index) => {
55            $('#slickid-'+number).slick('slickPause');
56        });
57    }, 5000);
58});
59    
60// menu collpase
61$(".hamburger").click(function(){
62
63    //close other menus; requires unique id
64    let $source = $(this);
65    $(".hamburger").each(function () {
66        let $this = $(this);
67
68        if ($source.attr('id') !== $this.attr('id')) {
69          $this
70              .attr("aria-expanded", "false")
71              .removeClass("is-active")
72              .next()
73              .removeClass("opened")
74          ;
75        }
76    });
77
78    // set attributes / classes
79    let expanded = this.getAttribute('aria-expanded') === 'true' || false;
80    expanded = !expanded;
81    this.setAttribute('aria-expanded', expanded);
82    if (expanded) {
83        this.classList.add('is-active');
84    }
85    else {
86        this.classList.remove('is-active');
87    }
88    
89    // open menu
90    let menu = this.nextElementSibling;
91    //menu.hidden = !menu.hidden;
92    if (expanded) {
93        menu.classList.add("opened");
94    }
95    else {
96        menu.classList.remove("opened");
97    }
98});
99
100// change height of header / footer on scroll position
101if (
102    "IntersectionObserver" in window &&
103    "IntersectionObserverEntry" in window &&
104    "intersectionRatio" in window.IntersectionObserverEntry.prototype
105) {
106    let observer = new IntersectionObserver(entries => {
107        if (entries[0].boundingClientRect.y < 0) {
108            document.body.classList.add("header-not-at-top");
109        } else {
110            document.body.classList.remove("header-not-at-top");
111        }
112    });
113    observer.observe(document.querySelector("#top-of-site-pixel-anchor"));
114}
115
116/*
117var resizeTimer = null;
118$(window).bind('resize', function() {
119
120});
121*/
122
123$( document ).ready(function() {
124    // console.log('ready');
125    
126    // Klappelemente
127    $('.frame-custom-55').hide();
128    $('.frame-custom-54').click(function() {
129        let tab = $( this ).nextAll('.frame-custom-55').first();
130        tab.slideToggle("slow"); // take first matching element after this
131        /*$('html, body').animate({
132            scrollTop: tab.offset().top - 100
133        }, 1000);*/
134    });
135    
136    // Klappelement geöffnet
137    $('.frame-layout-5 .tabitem').addClass('opened');
138    $('.frame-layout-5 .tabitem-content').show();
139    
140    // different views
141    /*if( Cookies.get('grad') == 'large'){
142        $('html').addClass('grad');
143    }*/
144    
145    /*if( Cookies.get('kontr') == 'blackWhite'){
146        $('html').addClass('kontrast');
147    }*/
148
149    $('a[href*="javascript"], a[href*="mailto"], a[href*="Mailto"], a[href*="tel:"]').addClass('dark-link');
150
151    $('#main-content a').html(function(index, html){
152        return html.replace(/@/g, '@\u200B');
153    });
154    
155    // lightbox (magnific popup)
156    $('a[rel*="lightbox"]').magnificPopup({
157        type: 'image',
158        tLoading: 'Lade Bild...',
159        tClose: 'Schließen (Esc)',
160        image: {
161            titleSrc: function(item) {
162                var title = item.el.attr('title');
163                var description = item.el.attr('alt');
164                return ((title)?title:'') + ((description)?'<small>'+ description +'</small>':'');
165            }
166        },
167        gallery: {
168            enabled: true,
169            navigateByImgClick: true,
170            preload: [0, 1],
171            tCounter: '%curr% von %total%',
172            tPrev: 'Zurück (Linke Pfeiltaste)',
173            tNext: 'Vorwärts (Rechte Pfeiltaste)'
174        },
175        mainClass: 'mfp-with-zoom', // this class is for CSS animation below
176        zoom: {
177            enabled: true, // By default it's false, so don't forget to enable it
178            duration: 300, // duration of the effect, in milliseconds
179            //   easing: 'ease-in-out', // CSS transition easing function
180        }
181    });
182});
183
184// function grad(){
185//   if( Cookies.get('grad') == 'large'){
186//       Cookies.set('grad', 'small', { expires: 365 });
187//   }
188//   else{
189//       Cookies.set('grad', 'large', { expires: 365 });
190//   }
191//
192//   $('html').toggleClass('grad');
193// }
194
195function search(){
196  $('#searchcontainer').toggleClass('search');
197  
198  $('body').toggleClass('search_active');
199}
200
201function klapp_geschichte_praesidenten(){  
202  $('#c729.frame-custom-55 .one-col > div > div').toggle();
203  $('#c730').show();
204}
205
206function klapp_geschichte_hoehepunkte(){
207  $('#c791').toggle();
208}
209 
210function schiebStart()
211 {
212  window.setTimeout('schieben()', 10000);
213 }
214 
215function schieben()
216 {
217  /*alert(parseInt(window.getComputedStyle(document.getElementById('bildfeld')).width));*/
218  /*alert(window.getComputedStyle(document.getElementById('bild-v')).marginLeft);*/
219  delta = parseInt(window.getComputedStyle(document.getElementById('bildfeld')).width) / 100;
220  
221  if(parseInt(window.getComputedStyle(document.getElementById('bild-v')).marginLeft) < parseInt(window.getComputedStyle(document.getElementById('bildfeld')).width))
222   {
223    document.getElementById('bild-v').style.marginLeft = parseInt(window.getComputedStyle(document.getElementById('bild-v')).marginLeft) + delta + 'px';
224    document.getElementById('bild-v').style.opacity = window.getComputedStyle(document.getElementById('bild-v')).opacity - 0.01;
225    window.setTimeout('schieben()', 20);
226   }
227  else
228   {
229    document.getElementById('bild-v').style.opacity = 1;
230    document.getElementById('bild-v').src = 'pix/' + folder + '/header_' + bildNr + '.jpg';
231    window.setTimeout('wechsel()', 20);
232   }
233 }
234 
235function wechsel()
236 {
237  document.getElementById('bild-v').style.marginLeft = '0px';
238   if(bildNr < bildmax)
239    {
240     bildNr++;
241    }
242    else
243    {
244     bildNr = 1;
245    }
246   document.getElementById('bild-h').src = 'pix/' + folder + '/header_' + bildNr + '.jpg';
247   schiebStart(folder, bildmax);
248
249 }
250 
251 function roll(farbe)
252   {
253    document.getElementById('home').src='pix/home-' + farbe + '.gif';
254   } 
255   
256
257const KEYCODE = {
258	ENTER: 13,
259	LEFT: 37,
260	UP: 38,
261	RIGHT: 39,
262	DOWN: 40,
263	ESC: 27
264};
265
266// add aria attribute when opened
267var menuItems = document.querySelectorAll('li.menu-sub');
268Array.prototype.forEach.call(menuItems, function(el, i){
269	el.querySelector('a').addEventListener("click",  function(event){
270		if (this.parentNode.className == "has-submenu") {
271			this.setAttribute('aria-expanded', "true");
272		} else {
273			this.setAttribute('aria-expanded', "false");
274		}
275		event.preventDefault();
276		return false;
277	});
278});
279
280// make sub menu tabbable
281document.addEventListener("DOMContentLoaded", function() {
282	const menuitems = document.querySelectorAll("#menu-list a");
283	// get all main menu links
284	const allMainMenu = document.querySelectorAll("#menu-list ul a");
285	const submenus = document.getElementsByClassName("menu-sub");
286	
287	let tabindex = 0;
288	
289	Array.from(menuitems).forEach(function(menuitem) {
290		menuitem.addEventListener('keyup', (event) => {
291			switch (event.keyCode) {
292				case KEYCODE.ESC:
293					// deactivate all menu items
294					[].forEach.call(allMainMenu, function(item) {
295						item.tabIndex = -1;
296					});
297					
298					// close open main menu items
299					[].forEach.call(submenus, function(item) {
300						item.classList.remove("open");
301					});
302					
303					// close menu
304					const menulist = document.getElementById("menu-list");
305					menulist.classList.remove("opened");
306					const hamburger = document.getElementById("hamburger-main");
307					hamburger.classList.remove("is-active");
308					hamburger.setAttribute('aria-expanded', "false");
309					hamburger.focus();
310					break;
311			}
312		});
313	});
314	Array.from(submenus).forEach(function(submenu) {
315		submenu.addEventListener('keydown', (event) => {
316			// get entered element
317			let targetElement = event.target || event.srcElement;
318			
319			// get its parent and sub items
320			let targetParent = targetElement.parentNode;
321			let submenuitems = targetParent.children[1].children;
322			
323			switch (event.keyCode) {
324				case KEYCODE.ENTER:
325					// check if target is open
326					if (targetParent.classList.contains('open')) {
327						tabindex = -1;
328					}
329					// deactivate all menu items
330					[].forEach.call(allMainMenu, function(item) {
331						item.tabIndex = -1;
332					});
333					
334					// activate submenu items
335					submenuitems = targetParent.children[1].children;
336					[].forEach.call(submenuitems, function(item) {
337						item.firstChild.tabIndex = tabindex;
338					});
339					break;
340			}
341		});
342	});
343});
344
345
346$(document).ready(function() {
347	//replace with non-breaking-hyphens
348	$('#landkreise-menu .lkt-header .lkt-title .content').text(
349		$('#landkreise-menu .lkt-header .lkt-title .content').text().replace(/-/g, '‑')
350	);
351	//start slider
352	if ($(".slick-list").length){
353		$(".slick-list").first().css("border-top-left-radius","60px");
354	}
355	//portrait slider
356	if ($("#impressionslider").length) {
357		var clicked = 0
358		$( ".tabitem .tabitem-header" ).click(function(event) {
359			if (clicked === 0){
360				$('#impressionslider').slick({
361					slidesToShow: 1,
362					slidesToScroll: 1,
363					arrows: true,
364					dots: false,
365					autoplay: false,
366					infinite: false,
367
368					responsive: [{
369
370						breakpoint: 1279,
371						settings: {
372							arrows: true
373						}
374					}, {
375						breakpoint: 767,
376						settings: {
377							arrows: false
378						}
379
380					}, {
381						breakpoint: 480,
382						settings: {
383							arrows: false
384						}
385					}]
386				});
387				clicked = 1;
388			}
389
390		});
391	}
392    // startpage list and map
393	$('#triangle-list').click(function(ev) {
394		$(this).toggleClass('opened');
395		$('#triangle-map').removeClass('opened');
396		$('#landkreis-tab-list').slideToggle("slow");
397		$('#landkreis-tab-map').hide();
398		if (!$('#icon-map').hasClass('opened')) {
399			$('#icon-map').addClass('opened');
400		}
401	});
402	$('#triangle-map').click(function(ev) {
403		$(this).toggleClass('opened');
404		$('#triangle-list').removeClass('opened');
405		$('#landkreis-tab-map').slideToggle("slow", function () {
406			mapMouseClick( selectedLandkreis );
407		});
408		$('#landkreis-tab-list').hide();
409		if ($('#triangle-map').hasClass('opened')) {
410			$('#icon-map').removeClass('opened');
411		} else {
412			$('#icon-map').addClass('opened');
413		}
414	});
415	$('#landkreise-menu li').on('click', function(e){
416		e.preventDefault();
417		let landkreis = $(this).data('id');
418		mapMouseClick(landkreis)
419		return false;
420	})
421
422    /*// header menu
423    $('.header-drop-header').after( $('.header-drop-menu') );
424    
425    // show and hide menu in header
426    $('.header-drop-header').click(function(ev) {
427        ev.stopPropagation();
428        if ($('.header-drop-menu').hasClass('opened')) {
429            $('.header-drop-menu').slideUp().removeClass('opened');
430        }
431        else {
432            $('.header-drop-menu').slideDown().addClass('opened');
433        }
434    });
435    
436    // hide on click elsewhere
437    $(document).click(function() {
438        $('.header-drop-menu').slideUp().removeClass('opened');
439    });*/
440    /*
441    $(window).on("touchend", function(){
442    	$('.header-drop-menu').slideUp().removeClass('opened');
443    });
444    */
445	// responsive image map (Landkreise-Karte)
446    // $('img[usemap]').rwdImageMaps();
447	// //height not clculated correctly, so use aspect image to recalculate
448	// let mapContainer = $('#map-container');
449	// if (mapContainer.length) {
450	// 	let bgImage = $('#map-background');
451	// 	bgImage.on('load', function() {
452	// 		console.log("start image loaded fully");
453	// 		checkMapHeight(mapContainer);
454	// 	});
455	// }
456	// window.addEventListener('resize', resizeMapHeight);
457
458	// if( $('#map-container.interactive').length > 0){
459	// 	//$("#map-container img.map.single.dark, #map-container img.map.single.red").css('display','none');
460	// 	$("img.map").on( "mouseout", function() {
461	// 		mapMouseout();
462	// 	});
463	function mapMouseOver(id) {
464		let $source = $('#text-'+id);
465		let $textOverlay = $('#map-text-overlay');
466		let oX = $source.attr("x");
467		let oY = $source.attr("y");
468		let $interactiveMap = $('#interactive-map');
469		let startX = $interactiveMap.position().left;
470		let currentWidth = $interactiveMap.outerWidth();
471		let currentHeight = $interactiveMap.outerHeight();
472		let scaleX = Math.round(currentWidth / 1340 * 100 ) / 100;
473		let scaleY = Math.round(currentHeight / 1540 * 100 ) / 100;
474
475		var posTextX = Math.round(startX + oX * scaleX);
476		var posTextY = Math.round(oY * scaleY);
477
478		let styles = {
479			"visibility": "visible",
480			"left": posTextX + "px",
481			"top": posTextY + "px"
482		};
483		// console.log("mapMouseOver", styles);
484		$textOverlay.text( $source.text() ).css( styles );
485	}
486
487	function mapMouseOut(id) {
488		// console.log("mapMouseOut",id)
489		let $textOverlay = $('#map-text-overlay');
490		let styles = {
491			"visibility": "hidden",
492			"left": 0,
493			"top": 0
494		};
495		$textOverlay.text("").css( styles );
496	}
497
498	function mapMouseClick(id) {
499
500		let $source = $('#l'+id);
501		let $landkreise = $('#interactive-map .landkreis');
502
503		if( $('#landkreise-menu').length ) {
504			if( $('#landkreise-menu .hamburger').hasClass('is-active') ) {
505				$('#landkreise-menu .hamburger').click();
506			}
507			//set header content from svg data
508			$('#landkreise-menu .lkt-header .of-the-week').toggle(id === selectedLandkreis);
509			$('#landkreise-menu .lkt-header .lkt-title .content').text($source.data("titel").replace(/-/g, '‑'));
510			$('#landkreise-menu .lkt-header .lkt-district .content').text($source.data("district-name"));
511
512			//hide/show portrait link(s)
513			$('#landkreise-menu .lkt-header .lkt-link .portraitlink').hide();
514			$('#ll' + id).show();
515
516			$('#landkreise-menu .lkt-drop-menu li').each(function () {
517				let $this = $(this);
518
519				if ($source.data('id') === $this.data('id')) {
520					$this.addClass('active');
521				} else {
522					$this.removeClass('active');
523				}
524			});
525		}
526
527		$landkreise.each(function() {
528			let $this = $( this );
529			$this.removeClass('selected');
530			if( $source.data('district-id') === $this.data('district-id')){
531				$this.addClass('active-district');
532			} else {
533				$this.removeClass('active-district');
534			}
535		});
536		$source.addClass('selected');
537	}
538
539	// }
540	if( $('#interactive-map').length > 0){
541        let $interactiveMap = $("#interactive-map .landkreis.linked");
542        $interactiveMap.on( "mouseover", function() {
543		    if(!$(this).hasClass('selected'))
544			    mapMouseOver($(this).data('id'));
545		}).on( "mouseout", function() {
546			mapMouseOut($(this).data('id'));
547		}).on( "click", function() {
548            if(!$(this).hasClass('selected'))
549		    mapMouseClick($(this).data('id'));
550		});
551	}
552
553	// $( ".portrait-container .tabitem .tabitem-header" ).click(function(event) {
554	// 	console.log('protrait click');
555	// 	checkMapHeight(mapContainer);
556	// });
557
558	/*if( window.location.hash != ""){
559		fakeMenuClick( getAnchor( window.location.hash ) );
560	}
561	else{
562		//console.log('else');
563		var sectionI=0;
564		$(".tx-dx-landkreis .section").each( function(){
565			if( sectionI > 0){
566			 	$( this ).hide();
567			 }
568			 sectionI++;
569		});
570	}*/
571
572});
573
574// // menu collpase
575// var dropButton = document.querySelector('.lkt-single-overview button');
576// if(dropButton) {
577// 	dropButton.addEventListener('click', function () {
578// 		// set attributes / classes
579// 		let expanded = this.getAttribute('aria-expanded') === 'true' || false;
580// 		expanded = !expanded;
581// 		this.setAttribute('aria-expanded', expanded);
582// 		if (expanded) {
583// 			this.classList.add('is-active');
584// 		} else {
585// 			this.classList.remove('is-active');
586// 		}
587//
588// 		// open menu
589// 		let menu = this.nextElementSibling;
590// 		//menu.hidden = !menu.hidden;
591// 		if (expanded) {
592// 			menu.classList.add("opened");
593// 		} else {
594// 			menu.classList.remove("opened");
595// 		}
596// 	});
597// }
598
599// function fakeMenuClick( element ){
600// 	console.log('fake menu'+element);
601// 	$('.tx-dx-landkreis .section').hide();
602// 	$('.tx-dx-landkreis .fake-menu a').removeClass('active');
603// 	$( '#'+element ).show();
604// 	$( '#'+element+'-link' ).addClass('active');
605// 	if( element == 'impressions' || element == '#impressions'){
606// 		$( '#impressionslider' ).data('flexslider').resize();
607// 	}
608// 	if ( $('ul.header-drop-menu').length > 0 ){
609// 		$('ul.header-drop-menu a').each( function(){
610// 			$(this).attr('href', stripAnchor( $(this).attr('href') ) + '#' + element );
611// 		});
612// 	}
613// 	// set height of map container
614// 	if (element == "geo") {
615// 		console.log('geo');
616// 		let mapContainer = $('#map-container');
617// 		checkMapHeight(mapContainer);
618// 	}
619// }
620
621// function stripAnchor( url ){
622// 	temp = url.split('#');
623// 	return temp[0];
624// }
625//
626// function getAnchor( url ){
627// 	temp = url.split('#');
628// 	return temp[1];
629// }
630
631// function mapClick(landkreis, bezirk, weiterleiten){
632//
633// 	console.log({
634// 		'function': 'mapClick',
635// 		'landkreis': landkreis,
636// 		'bezirk': bezirk,
637// 		'weiterleiten': weiterleiten
638// 	});
639//
640// 	if( selectedLandkreis == landkreis && weiterleiten == true){
641// 		window.location.assign( $('#overlay-text-landkreis'+landkreis+' .portraitlink').attr('href') );
642// 	}
643//
644// 	selectedLandkreis = landkreis
645// 	selectedBezirk = bezirk
646//
647// 	$(".tx-dx-landkreis .header-drop-menu li.active").removeClass('active');
648// 	$(".tx-dx-landkreis .header-drop-menu li.u"+landkreis).addClass('active');
649//
650// 	$("#map-container img.map.single.dark, #map-container img.map.single.red, #map-container .overlay-text,	#map-large div.info-text").css('display','none');
651// 	$('#map-container img.single.dark.b'+bezirk+',	#map-container img.single.red.l' + landkreis + ', #overlay-text-landkreis'+landkreis +',#info-text-landkreis'+landkreis	).css('display','block');
652// 	$('.overlay-text').removeClass('active');
653// 	$('#overlay-text-landkreis'+landkreis	).addClass('active');
654//
655// 	return false;
656// }
657
658// function mapMouseover(landkreis, bezirk){
659// 	$('#map-container .dark.single.l'+landkreis+', #map-container .yellow.single.l'+landkreis).css('opacity', 0.6);
660// 	$("#map-container .overlay-text").css('display','none');
661// 	$('#overlay-text-landkreis'+landkreis).css('display', 'block');
662// }
663
664// function mapMouseout(){
665// 	$('#map-container img.map.single').css('opacity', 1);
666// 	$("#map-container .overlay-text").css('display','none');
667// 	$('#overlay-text-landkreis'+selectedLandkreis).css('display', 'block');
668// }
669
670// function checkMapHeight(mapContainer) {
671// 	console.log('map container found');
672// 	let mapHeight = $('#map-background').height();
673// 	console.log('mapHeight: '+mapHeight);
674// 	if (mapHeight > 0) {
675// 		console.log('height > 0');
676// 		let mapWidth = $('#map-background').width();
677// 		$('#map-container').height(mapHeight);
678// 		$('#city-container').height(mapHeight);
679// 		$('#city-container').width(mapWidth);
680// 	}
681// }
682//
683// function resizeMapHeight() {
684// 	console.log('resizeMapHeight');
685// 	let mapContainer = $('#map-container');
686// 	if (mapContainer.length) {
687// 		checkMapHeight(mapContainer);
688// 	}
689// }
690
691// function isHidden(el) {
692// 	return (el.offsetParent === null)
693// }
694
695$(document).ready(function() {
696
697    $("#sitz").click(function(){
698        setTimeout(function(){
699            $(".balken").each(function(){
700                maxWidth = $(this).data("width");
701                $(this).animate({width: maxWidth},1250);
702
703            });
704        }, 100);
705    });
706});
707

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.