PageSourceSearch

https://www.landesbibliothek-coburg.de/typo3temp/assets/vhs/vhs-assets-jsall.js

js landesbibliothek-coburg.de collected 2026-10-02 10:44:10 UTC 16,032 bytes, 589 lines download raw bytes

1// Functions
2
3// Function to set equal height for divs in one column, see http://stackoverflow.com/a/13162689/4461905
4$.fn.eqHeights = function(options) {
5
6	var defaults = {
7		child: false
8	};
9	var options = $.extend(defaults, options);
10
11	var el = $(this);
12	if (el.length > 0 && !el.data('eqHeights')) {
13		$(window).bind('resize.eqHeights', function() {
14			el.eqHeights();
15		});
16		el.data('eqHeights', true);
17	}
18
19	if( options.child && options.child.length > 0 ){
20		var elmtns = $(options.child, this);
21	} else {
22		var elmtns = $(this).children();
23	}
24
25	var prevTop = 0;
26	var max_height = 0;
27	var elements = [];
28	elmtns.height('auto').each(function() {
29
30		var thisTop = this.offsetTop;
31
32		if (prevTop > 0 && prevTop != thisTop) {
33			$(elements).height(max_height);
34			max_height = $(this).height();
35			elements = [];
36		}
37		max_height = Math.max(max_height, $(this).height());
38
39		prevTop = this.offsetTop;
40		elements.push(this);
41	});
42
43	$(elements).height(max_height);
44};
45
46
47
48// Document loaded
49$( document ).ready(function() {
50
51	// MDZ Ajax request for counter
52	if ( $( ".mdzcounter" ).length ) {
53		// Start ajax request
54		$.ajax({
55			type: "GET",
56			cache: false,
57			dataType: "json",
58			data: {
59				type: "3022"
60			}
61		}).done( function( result ) {
62			// Return counter formatted with blanks
63			$( ".mdzcounter" ).text( result[0]['Anzahl'].toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ") );
64		}).fail( function() {
65			// Return failure
66			$( ".mdzcounter" ).text( "Viele" );
67		});
68	}
69
70
71
72	// Shortcut links: Show or hide on click on icon
73	$( "#mobile-icon-shortcuts" ).click( function() {
74		$( "#shortcuts" ).toggleClass( "show" );
75	});
76
77	// Close shortcut links when clicked outside
78	$( window ).on( 'click', function(event) {
79		if ( $( "#shortcuts.show" ).is( ":visible" ) ) {
80			if ( !$(event.target).closest( "#shortcuts.show, #mobile-icon-shortcuts, #search-box-top, #socialmedia-box-top, .shortcut-link" ).length ) {
81				$( "#shortcuts.show" ).toggleClass( "show" )
82			}
83		}
84	});
85
86
87
88	// Search box
89
90	// Change form action according to option
91	$( "#engine_selectors input" ).change( function() {
92		var target = $( this ).data( "values" ).split( "|" );
93		$( "#searchform" ).attr( "action", target[0] );
94		$( "#searchform .SearchQueryTextInput" ).attr( "name", target[1] );
95		$( "#searchform" ).attr( "method", target[2] );
96		$( "#searchform .SearchStringExtraIdentifier" ).attr( "name", target[3] );
97		$( "#searchform .SearchStringExtraIdentifier" ).attr( "value", target[4] );
98	});
99	
100	// Prevent submit when empty
101	$( "#searchform" ).submit( function( event ) {
102		if ( $( ".SearchQueryTextInput" ).val() != "" ) {
103			// Disable selectors to not return values
104			$( "#engine_selectors input" ).attr( "disabled", "disabled" );
105			// Open new window if target blank
106			if ( $( "#engine_selectors input#Radio2:checked" ).hasClass( "new-window" ) ) {
107				$( "#searchform" ).attr( "target", "_blank" );
108			}
109			// Submit
110			this.submit();
111			// Restore default values after submit
112			setTimeout( function() {
113				$( "#searchform" ).removeAttr( "target" );
114				$( "#engine_selectors input" ).removeAttr( "disabled" );
115			}, 1000 );
116		} else {
117			// Prevent when empty
118			event.preventDefault();
119		}
120	});
121
122	// Header shortcuts: search box
123$( ".shortcut-link.search" ).click( function() {
124	if ( !$( "#search-box-top" ).is( ":visible" ) ) {
125		$( "#search-box-top" ).show();
126		$( "#search-box-top-input" ).focus();
127		$( "#search-box-top" ).animate({ "height": "73px" }, 225 );
128	} else {
129		$( "#search-box-top" ).animate({
130			height: 0
131		}, 225, function() {
132			$( "#search-box-top" ).hide();
133		});
134	}
135});
136
137// Fix for Primo: Add missing arguments to search box query
138$(document).ready(function() {
139	$("#searchform").submit(function(event) {
140		event.preventDefault(); // Prevent the default form submission for custom handling
141
142		if ($("#Radio1").is(':checked') == false) {
143			$("#search-box-top-input").val('any,contains,' + $("#search-box-top-input").val());
144			$("#typo3-lang").attr("disabled", "disabled");
145			// Submit the form before emptying the input field
146			$("#searchform")[0].submit();
147		}
148
149		// Clear the search box input and close the search box
150		$("#search-box-top").animate({
151			height: 0
152		}, 225, function() {
153			$("#search-box-top").hide();
154			$("#search-box-top-input").val(''); // Clear the input field
155			
156			
157		});
158	});
159});
160
161// Close search box when clicked outside
162$( window ).on( 'click', function(event) {
163	if ( $( "#search-box-top" ).is( ":visible" ) ) {
164		if ( !$(event.target).closest( "#search-box-top, .shortcut-link.search" ).length ) {
165			$( "#search-box-top" ).animate({
166				height: 0
167			}, 225, function() {
168				$( "#search-box-top" ).hide();
169			});
170		}
171	}
172});
173
174
175
176	// Social Media box
177
178	// Header shortcuts: social media box
179	$( ".shortcut-link.socialmedia" ).click( function() {
180		if ( !$( "#socialmedia-box-top" ).is( ":visible" ) ) {
181			$( "#socialmedia-box-top" ).show();
182			$( "#socialmedia-box-top" ).focus().animate({ "height": $( "#socialmedia-box-top ul" ).height() }, 225 );
183  		} else {
184			$( "#socialmedia-box-top" ).animate({
185				height: 0
186			}, 225, function() {
187				$( "#socialmedia-box-top" ).hide();
188			});
189		}
190	});
191
192	// Close social media box when clicked outside
193	$( window ).on( 'click', function(event) {
194		if ( $( "#socialmedia-box-top" ).is( ":visible" ) ) {
195			if ( !$(event.target).closest( "#socialmedia-box-top, .shortcut-link.socialmedia" ).length ) {
196				$( "#socialmedia-box-top" ).animate({
197					height: 0
198				}, 225, function() {
199					$( "#socialmedia-box-top" ).hide();
200				});
201			}
202		}
203	});
204
205
206
207	// Navigation boxes content element
208
209	// Mouse over
210	$( ".navigation-boxes .box" ).mouseenter(function() {
211		// Greyscale other images
212		$( this ).parent().find( ".box-image" ).addClass( "greyscale" );
213	});
214
215	// Mouse out
216	$( ".navigation-boxes .box" ).mouseleave(function() {
217		// Restore color of images
218		$( this ).parent().find( ".box-image" ).removeClass( "greyscale" );
219	});
220
221
222
223	// Accordion
224
225	// Open and close by click
226	$( ".frame-layout-1" ).find( ":header:eq(0)" ).click( function() {
227		var index_smallacc = this;
228		if ( $( index_smallacc ).hasClass( "open" ) ) {
229			$( index_smallacc ).parent().nextAll().slideUp( 300 );
230			$( index_smallacc ).removeClass( "open" );
231		} else {
232			$( index_smallacc ).parent().nextAll().slideDown( 300 );
233			$( index_smallacc ).addClass( "open" );
234		}
235	});
236
237	// Open.frame-layout-1 if URL calls anchor
238	if ( window.location.hash.substring(1) ) {
239		$( "#" + window.location.hash.substring(1) + ".frame-layout-1" ).find( ":header:eq(0)" ).click();
240	}
241
242
243
244	// Tables
245
246	// Add data-title to every <td>
247	$( "table" ).each( function( index, tableID ) {
248		if ( $( tableID ).find( "thead" ).length ) {
249			// Tables with <thead> tag
250			$( tableID ).find ("thead tr th" ).each( function( index ) {
251				index += 1;
252				$( tableID ).find( "tbody tr td:nth-child(" + index + ")" ).attr( "data-title", $(this).text() );
253				// Mark table as ready for responsive styling
254				$( tableID ).addClass( "responsive" );
255			});
256		} else {
257			// Tables without <thead> tag
258			$( tableID ).addClass( "responsive no-thead" );
259		}
260	});
261
262
263
264	// fancyBox configuration
265
266	// Apply fancyBox to lightbox images
267	$( ".lightbox" ).fancybox();
268
269	// Set language
270	if( $( "html" ).attr( "lang" ) !== "en" )
271		$.fancybox.defaults.lang = "de";
272
273	$( ".lightbox" ).each( function() {
274
275		// Set group identifier
276		$( this ).attr( 'data-fancybox', 'group-' + $( this ).parents( ".frame" ).attr( "id" ) );
277
278		// Use description from figcaption instead of title (it's more used in backend metadata)
279		if ( $( this ).next( "figcaption" ).length ) {
280			$( this ).attr( 'title', $( this ).next( "figcaption" ).html().replace( "<br>" , "" ).trim() );
281		}
282
283		// Set fancyBox caption
284		$( this ).data( 'caption', this.title );
285
286	});
287
288
289
290	// Image gallery
291
292	// Set label
293	if ( $( "html" ).attr( "lang" ) == "en" ) {
294		var imgLabel = "Images";
295	} else {
296		var imgLabel = "Bilder";
297	}
298
299	// Count images and insert button
300	$( ".gallerycenter, .galleryright, .galleryleft" ).each( function( index, el ) {
301		// Get number of images
302		var nrOfImages = $( el ).find( ".ce-gallery" ).data( "ce-images" );
303		// Insert button on first image of set
304		$( el ).find( ".image a:eq(0)" ).prepend( "<div class='gallery_imgnr'>" + nrOfImages + " " + imgLabel + "</div>" );
305	});
306
307
308
309	// Image band
310
311	// Prevent linked images, create link inside caption instead
312	$( ".imageband .owl-carousel .item figure.image > a" ).not( ".lightbox" ).each( function() {
313		// Get original attributes
314		var url = $( this ).attr( "href");
315		var target = $( this ).attr( "target");
316		var title = $( this ).attr( "title" );
317		var caption = $( this ).next( "figcaption" ).text();
318		if ( title === undefined )
319			title = "Info";
320		// Set new attributes for lightbox
321		$( this ).attr({
322			'class': 'lightbox',
323			'data-fancybox': "group-" + $( this ).parents( ".frame" ).attr( "id" ),
324			'data-caption': caption + "<br><a href='" + url + "' title='" + title + "' target='" + target + "' class='caption-link'>" + title + "</a>",
325			href: $( this ).parents( ".item" ).data( "source" ),
326			target: "",
327			title: caption
328		});
329		// Set title for image
330		$( this ).find( "img" ).attr( 'title', caption );
331	}).promise().done(function () {
332		$( ".lightbox" ).fancybox();
333	});
334
335	// Implement OwlCarousel for imageband
336	$(".imageband .owl-carousel").owlCarousel({
337		dots: false,
338		nav: true,
339		autoWidth: true,
340		navText: ["<img src='/_assets/e8b0b5e296badb0eebe8fbd4a35ce1c4/Images/Content/left.svg'>", "<img src='/_assets/e8b0b5e296badb0eebe8fbd4a35ce1c4/Images/Content/right.svg'>"],
341		stagePadding: 60,
342		margin: 5,
343		responsiveClass: true,
344		responsive:{
345			0:{
346				items:1,
347				nav:false,
348				loop:false
349			},
350			600:{
351				items:2,
352				nav:false,
353				loop:false
354			},
355			900:{
356				items:3,
357				nav:true,
358				loop:false
359			},
360			1300:{
361				items:4,
362				nav:true,
363				loop:false
364			}
365		}
366	});
367
368	// Slider
369
370	// Implement OwlCarousel for imageband
371	var owl = $( ".slider.owl-carousel" );
372	owl.owlCarousel({
373		autoplay: true,
374		autoplayHoverPause: true,
375		autoplayTimeout: 6000,
376		items: 1,
377		dots: true,
378		loop: true,
379		nav: true,
380		navText: ["<img src='/_assets/e8b0b5e296badb0eebe8fbd4a35ce1c4/Images/Content/SliderPrev.png'>", "<img src='/_assets/e8b0b5e296badb0eebe8fbd4a35ce1c4/Images/Content/SliderNext.png'>"]
381	});
382
383	// Inject start-stop button
384	$( ".slider .owl-dots" ).after( "<div class='start_stop'></div>" );
385
386	// Start/Stop
387	$( ".slider .start_stop" ).on( "click", function(){
388		if ( $( this ).hasClass( "paused" ) ) {
389			owl.trigger( "play.owl.autoplay", [6000] );
390			$( this ).removeClass( "paused" );
391		} else {
392			owl.trigger( "stop.owl.autoplay" );
393			$( this ).addClass( "paused" );
394		}
395	});
396
397
398
399	// Search form content element
400	$( ".ce-searchform" ).submit(function( event ) {
401		// Prevent form action
402		event.preventDefault();
403		// Prepare correct url: replace string 'test' by input text
404		var url = $( this ).find( "form" ).attr( "action" );
405		var s = $( this ).find( ".ce-searchform-input" ).val();
406		url = url.replace( "test", s );
407		// Clear input (prevent data on public terminals)
408		$( this ).find( ".ce-searchform-input" ).val( '' );
409		// Open new url
410		window.open( url, '_blank' );
411	});
412
413
414
415	// News
416
417
418
419	// Create backlink
420	if ( $( ".news-backlink-wrap a" ).length > 0 ) {
421		if ( document.referrer.indexOf( window.location.hostname ) != -1 ) {
422			$( ".news-backlink-wrap" ).html( "<a href='javascript:history.back();' class='generated_backlink'><svg width='48px' height='36px' viewBox='0 0 30 24'><path d='M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H26v-2z'></path></svg></a>" );
423		}
424	}
425
426
427
428	// News archive menu treat as.frame-layout-1
429
430	// Show active items on page load
431	$( ".news-menu-view > ul > li > ul > li.itemactive" ).parent().show();
432
433	// And add class
434	$( ".news-menu-view > ul > li > ul > li.itemactive" ).parent().parent().addClass( "open" );
435
436	// Open and close by click
437	$( ".news-menu-view > ul > li" ).click( function(e) {
438		var index_newsacc = this;
439		if ( !$( e.target ).closest( "a" ).length ) { // Target was no link?
440			if ( $( index_newsacc ).hasClass( "open" ) ) {
441				$( index_newsacc ).find( "ul" ).slideUp( 300 );
442				$( index_newsacc ).removeClass( "open" );
443			} else {
444				$( index_newsacc ).find( "ul" ).slideDown( 300 );
445				$( index_newsacc ).addClass( "open" );
446			}
447		}
448	});
449
450
451
452	// Cal / Events
453
454	// Replace page title on single news page
455	if ( $( "#calendar-event" ).length )
456		$( "#pagetitle" ).text( $( "#calendar-event h3" ).text() );
457
458
459
460	// Create backlink
461	if ( document.referrer.indexOf( window.location.hostname ) != -1 ) {
462		$( "#calendar-event-backlink" ).html( "<a href='javascript:history.back();' class='generated_backlink'><svg width='48px' height='36px' viewBox='0 0 30 24'><path d='M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H26v-2z'></path></svg></a>" );
463	}
464
465
466
467	// Forms
468
469	// Hide Honeypot
470	$( "input.website.url" ).css( "margin", "0 0 0 -999em" );
471
472
473
474	// Smooth scrolling for anchor links
475	// jquery plugin, see https://github.com/kswedberg/jquery-smooth-scroll
476
477	// Click on anchor link
478	$( 'a[href*="#"]' ).click( function( event ) {
479		// If target url has same path as current (= same page)
480		if ( this.pathname == window.location.pathname ) {
481			// Scroll to target and respect sticky menu
482			$.smoothScroll( { scrollTarget: this.hash, offset: -90 } );
483			// Update url
484			history.pushState( null, null, this.hash );
485			// Prevent default link action
486			event.preventDefault();
487		}
488	});
489
490	// On page load with hash in url
491	if ( window.location.hash )
492		// Respect sticky menu
493		window.scrollBy(0,-90);
494
495
496
497	// Search: start search after submitting shortcut
498	if ( $( "#tx_indexedsearch" ).length ) {
499		// If no results, but text in form found
500		if ( !$( ".tx-indexedsearch-res, .tx-indexedsearch-no-result" ).length && !$( "#tx-indexedsearch-searchbox-sword" ).val() == '' )
501			// Submit
502			$( "#tx_indexedsearch" ).submit();
503	}
504
505
506
507	// 404 error page search plugin
508	// Deactivated for search plugin migration
509	if ( $( "#pagetitle" ).text() === '404' && $( "#tx-indexedsearch-searchbox-sword" ).val() === '' ) {
510		var a = window.location.pathname.split("/");
511		var searchString = a[a.length - 2];
512		searchString = searchString.replace(/-/g, ' ');
513		searchString = searchString.replace(/ue/g, "ü");
514		searchString = searchString.replace(/oe/g, "ö");
515		searchString = searchString.replace(/ae/g, "ä");
516		if ( searchString != '404' ) {
517			$( "#tx-indexedsearch-searchbox-sword" ).val( searchString );
518			$( "#tx_indexedsearch" ).submit();
519		}
520	}
521
522
523
524	// Yewno feedback form handling
525
526	// Click on action button german version
527	$( "#c6170 a.button, #c6225 a" ).click( function() {
528		// Scroll to form
529		$.smoothScroll( { scrollTarget: '#c6174', offset: -140 } );
530		// Mark form with color
531		$( "#c6174" ).css({
532			'background-color': 'rgba(11,165,217,0.8)',
533			'padding': '0 2em',
534			'margin': '0 -2em'
535		});
536	});
537
538	// Click on action button english version
539	$( "#c6539 a.button, #c6541 a" ).click( function() {
540		// Scroll to form
541		$.smoothScroll( { scrollTarget: '#c6544', offset: -140 } );
542		// Mark form with color
543		$( "#c6544" ).css({
544			'background-color': 'rgba(11,165,217,0.8)',
545			'padding': '0 2em',
546			'margin': '0 -2em'
547		});
548	});
549
550
551
552});
553
554
555
556// Page loaded (with images)
557
558$(window).on("load", function (e) {
559
560
561
562	// Set equal height on items of content element 'teaser menu with images'
563	$('.teaser-menu-with-image').eqHeights({child:'.item'});
564
565
566
567	// List with images and text
568
569	// Set equal height
570	$('.list-image-text').eqHeights({child:'.listitem'});
571
572
573
574	// New CE Test
575
576	// Set equal height
577	$('#c8127 .navigation-boxes-with-image').eqHeights({child:'.box'});
578
579	setTimeout( function() {
580		$(".owl-carousel").trigger('refresh.owl.carousel');
581	}, 1000);
582
583});
584
585// fix loading bug of owl slider in chrome
586Promise.all(Array.from(document.images).filter(img => !img.complete).map(img => new Promise(resolve => { img.onload = img.onerror = resolve; }))).then(() => {
587	$(".owl-carousel").trigger('refresh.owl.carousel');
588});
589

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.