PageSourceSearch

https://www.essbay.de/_assets/1d08ad6d04e98e14156b3431099088f7/JavaScript/Src/Application.js?1744024726

js essbay.de collected 2026-10-04 13:24:54 UTC 13,815 bytes, 452 lines download raw bytes

1// IE console fix
2window.console || (console = {}, console.log=function(){});
3
4/* ===============================
5 * M O D U L E S
6 * =============================== */
7
8(function($) {
9
10  /**
11   * Copyright 2012, Digital Fusion
12   * Licensed under the MIT license.
13   * http://teamdf.com/jquery-plugins/license/
14   *
15   * @author Sam Sehnert
16   * @desc A small plugin that checks whether elements are within
17   *     the user visible viewport of a web browser.
18   *     only accounts for vertical position, not horizontal.
19   */
20
21  $.fn.visible = function(partial) {
22
23      let $t            = $(this),
24          $w            = $(window),
25          viewTop       = $w.scrollTop(),
26          viewBottom    = viewTop + $w.height(),
27          _top          = $t.offset().top,
28          _bottom       = _top + $t.height(),
29          compareTop    = partial === true ? _bottom : _top,
30          compareBottom = partial === true ? _top : _bottom;
31
32    return ((compareBottom <= viewBottom) && (compareTop >= viewTop));
33
34  };
35
36})(jQuery);
37
38/**
39 * scroll to a section and set the hash
40 */
41function goTo(hash){
42	let pos = 0;
43	if(hash != '#') {
44		let height = $('#page-header').height();
45		pos = Math.round($(hash).offset().top) - height  +10;  // offset
46	}
47	if(pos < 0) pos = 0;
48	$('.rows-wrap').removeClass('highlighted');
49	$(hash).addClass('highlighted');
50	$("html,body").animate({ scrollTop: pos }, "slow");
51}
52
53/**
54 * check for emty string
55 *
56 * @param str
57 * @returns {Boolean}
58 */
59function isEmpty(str) {
60    return (!str || 0 === str.length);
61}
62
63/**
64 * check if it is mobile view
65 *
66 * @returns {Boolean}
67 */
68function isMobile() {
69    return $('.navbar-toggler').is(":visible") ;
70}
71
72
73// document ready
74$(function(){
75
76	// get info
77	let hash = window.location.hash;
78
79	// action
80	if(hash.indexOf("#") > -1) {
81		if(hash != "#") {
82			location.hash = hash;
83			$( hash ).addClass('in').addClass('show');
84			goTo(hash);
85			// return false;
86		}
87	}
88
89	setTimeout(() => {
90		$(".leaflet-container svg").each(function(i, el) {
91	  		$(el).attr("alt", "Open Streetmap Karte zur Darstellung der Standorte");
92		});
93		$('.leaflet-marker-shadow').each(function(i, el) {
94	  		$(el).attr("alt", "");
95		});
96	}, 500);
97
98	$('.carousel-item.initial').addClass('zoom').removeClass('initial');
99
100	$('[data-bs-toggle="tooltip"]').tooltip()
101
102	//$.datepicker.setDefaults($.datepicker.regional['de']);
103
104     // Navigation toggle
105	 /*
106	$(".navbar-toggler").click(function(event){
107        event.preventDefault();
108
109        if($("#mainnavigation").is(":visible") ) {
110			$('#page-header').addClass('navbar-fixed-top');
111			$('.body-bg-top').css('padding-top','70px');
112		} else {
113			$('#page-header').removeClass('navbar-fixed-top');
114			$('.body-bg-top').css('padding-top','0px');
115		}
116    });*/
117
118	// Navigation toggle from ksw
119	/*
120	$("a.dropdown-toggle").click(function(event){
121        event.preventDefault();
122        if($(this).parent().find("ul.dropdown-menu").css("display") == 'block'  ) {
123			$("ul.dropdown-menu").hide();
124			$('.navbar-submenu-toggle').addClass('fa-chevron-right');
125			$('.navbar-submenu-toggle').removeClass('fa-chevron-down')
126			$(this).find('.navbar-submenu-toggle').addClass('fa-chevron-right');
127			$(this).find('.navbar-submenu-toggle').removeClass('fa-chevron-down')
128		} else {
129			$("ul.dropdown-menu").hide();
130			$('.navbar-submenu-toggle').addClass('fa-chevron-right');
131			$('.navbar-submenu-toggle').removeClass('fa-chevron-down')
132			$(this).parent().find("ul.dropdown-menu").show();
133			$(this).find('.navbar-submenu-toggle').removeClass('fa-chevron-right');
134			$(this).find('.navbar-submenu-toggle').addClass('fa-chevron-down')
135		}
136
137    });
138    */
139
140
141
142	// gridelements slider
143    $('.rsys-flex-direction-nav .flex-prev').click(function(event){
144        event.preventDefault();
145   		 $(this).parent().parent().parent().flexslider('prev');
146    });
147     $('.rsys-flex-direction-nav .flex-next').click(function(event){
148        event.preventDefault();
149   		 $(this).parent().parent().parent().flexslider('next');
150    });
151
152	 // lightbox text
153    if(jQuery('a.lightbox-text').length > 0){
154        let jQuerylightboxModal = "\
155            <div class='modal fade' id='lightbox-text' tabindex='-1' role='dialog' aria-hidden='true'>\
156                <div class='modal-dialog modal-lightbox modal-dialog-centered\"'>\
157                    <div class='modal-content'>\
158                        <div class='modal-body'></div>\
159                        <div class=\"modal-footer\">\
160        					<button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Schließen</button>\
161						</div>\
162                    </div>\
163                </div>\
164            </div>\
165        ";
166        jQuery('body').append(jQuerylightboxModal);
167        jQuery('.lightbox-text').click(function(event){
168            event.preventDefault();
169            let jQuerylightbox = jQuery('#lightbox-text');
170            let jQuerymodalBody = jQuerylightbox.find('.modal-body');
171            let jQuerymodalDialog = jQuerylightbox.find('.modal-dialog');
172            jQuerymodalBody.empty();
173
174            let jQuerysrc = jQuery(this).attr("href");
175			jQuery.get( jQuerysrc, function( data ) {
176				//jQuerymodalDialog.width("80%");
177				//jQuerymodalDialog.css({ "max-width": '85%' });
178				jQuerymodalBody.append(data);
179
180			});
181			const myModal = new bootstrap.Modal('#lightbox-text', {
182  				keyboard: true
183			});
184			myModal.show();
185
186			return false;
187        });
188    }
189
190	// accordion icon change
191	$('.panel-collapse').on('show.bs.collapse', function () {
192		toggleIcon = $(this).prev().find('.fas');console.log(toggleIcon);
193        toggleIcon.addClass('fa-chevron-up').removeClass('fa-chevron-down');
194		target = $(this).parent();
195		$(target).addClass('stay-visible');
196		$(target).removeClass('visible-on-hover');
197    });
198    $('.panel-collapse').on('hide.bs.collapse', function () {
199       	toggleIcon = $(this).prev().find('.fas');console.log(toggleIcon);
200		toggleIcon.removeClass('fa-chevron-up').addClass('fa-chevron-down');
201		target = $(this).parent();
202		$(target).removeClass('stay-visible');
203		$(target).addClass('visible-on-hover');
204    });
205
206	// accordion icon change
207	$('.shoptext-toggle').click(function () {
208		toggleIcon = $(this).find('.fas');
209		if ( $(toggleIcon).hasClass('fa-chevron-up') ) {
210			 toggleIcon.addClass('fa-chevron-down').removeClass('fa-chevron-up');
211		} else {
212			 toggleIcon.addClass('fa-chevron-up').removeClass('fa-chevron-down');
213		}
214		target = $(this).parent();
215    });
216
217
218	/* -------------------------------
219	 * SCROLL ANIMATION
220	 *  ------------------------------- */
221
222	let element = null;
223
224	// Already visible modules
225	$(".content-slide-in").each(function(i, el) {
226		element = $(el);
227	  	if (element.visible(true)) {
228			element.addClass("already-visible");
229	  	}
230	});
231
232	$(window).scroll(function(event) {
233	  $(".content-slide-in").not( ".already-visible" ).each(function(i, el) {
234		  element = $(el);
235		  if (element.visible(true)) {
236			  element.addClass("come-in");
237		  }
238	  });
239	});
240
241
242	$(window).scroll(function(event) {
243	  $(".content-slide-left").not( ".already-visible" ).each(function(i, el) {
244		element = $(el);
245		if (element.visible(true)) {
246			element.addClass("come-in-left");
247		}
248	  });
249	});
250
251	$(window).scroll(function(event) {
252	  $(".content-slide-right").not( ".already-visible" ).each(function(i, el) {
253		element = $(el);
254		if (element.visible(true)) {
255			element.addClass("come-in-right");
256		}
257	  });
258	});
259
260	//--------------------------
261	// Address Plugin
262	//--------------------------
263	$('.cat-filter').click(function(event){
264        event.preventDefault();
265		let dataAddress = $(this).data('cat-filter');
266		$(this).parent().parent().children('.rsystemplate_bootstrap-address-list-wrap').hide();
267		$(this).parent().parent().children('.cat-' + dataAddress).show();
268		$(this).parent().children('.cat-filter').removeClass('active');
269		$(this).parent().children('.cat-filter-clear').removeClass('active');
270		$(this).addClass('active');
271    });
272	$('.cat-filter-clear').click(function(event){
273        event.preventDefault();
274		$(this).parent().parent().children('.rsystemplate_bootstrap-address-list-wrap').show();
275		$(this).parent().children('.cat-filter').removeClass('active');
276		$(this).addClass('active');
277    });
278	$('.cat-filter ').each(function( index ) {
279		let dataAddressFilter = $(this).data('cat-filter');
280		let count = $(this).parent().parent().children('.cat-' + dataAddressFilter).length;
281		if(count == 0) {
282			$(this).hide();
283		} else {
284			$(this).html( $(this).html() + ' <span class="badge bg-secondary">' + count + '</span>');
285		}
286	});
287
288	$('.cat-filter-clear').each(function( index ) {
289		let countClear = $(this).parent().parent().children('.rsystemplate_bootstrap-address-list-wrap').length;
290		$(this).html( $(this).html() + ' <span class="badge bg-secondary">' + countClear + '</span>');
291
292	});
293
294	//--------------------------
295	// Search
296	//--------------------------
297	$('#tx-indexedsearch-searchbox-button-submit-NO').click(function(event){
298
299		let srch_term = $(this).parent().prev('#srch-term');
300		let srch_term_visible = $(srch_term).is(":visible");
301		if(! srch_term_visible ) {
302			event.preventDefault();
303			$(srch_term).animate({width:'toggle'},350);
304			$(srch_term).focus();
305		}
306    });
307
308	//--------------------------
309	// Shop
310	//--------------------------
311	$('.addtocart').keyup(function(event){
312        event.preventDefault();
313		let cookie = Cookies.get('cart');
314		let entries = {};
315		if(cookie) {
316			entries = JSON.parse(cookie);
317		}
318		let id = $(this).attr('id').substring(5, 100);
319		entries[id] = $(this).val(); // quantity
320		let store = JSON.stringify(entries);
321		Cookies.set('cart', store, { expires: 365, path: '/' });
322		$(this).parent().parent().parent().next('.feedback').show().html('&nbsp;<div class="alert alert-small alert-info">Der Warenkorb wurde aktualisiert</div>').delay(3000).fadeOut();
323    });
324
325	$('.updatecart').keyup(function(event){
326        event.preventDefault();
327		let cookie = Cookies.get('cart');
328		let entries = {};
329		if(cookie) {
330			entries = JSON.parse(cookie);
331		}
332		let id = $(this).attr('id').substring(5, 100);
333		entries[id] = $(this).val(); // quantity;
334		let store = JSON.stringify(entries);
335		Cookies.set('cart', store, { expires: 365, path: '/' });
336		$('.feedback').show().html('&nbsp;<span class="alert alert-small alert-info">Der Warenkorb wurde aktualisiert</span>').delay(3000).fadeOut();
337    });
338	$('.deletecart').click(function(event){
339        event.preventDefault();
340		let cookie = Cookies.get('cart');
341		let entries = {};
342		if(cookie) {
343			entries = JSON.parse(cookie);
344		}
345		let id = $(this).data('id');
346		entries[id] = 0;
347		let store = JSON.stringify(entries);
348		Cookies.set('cart', store, { expires: 365, path: '/' });
349		$(this).closest('.small-row').remove();
350		$('.feedback').show().html('&nbsp;<span class="alert alert-small alert-info">Der Artikel wurde aus dem Warenkorb entfernt</span>').delay(3000).fadeOut();
351
352    });
353
354	let cookie = Cookies.get('cart');
355	let entries = null;
356	if(cookie) {
357		entries = JSON.parse(cookie);
358	}
359	if (typeof(entries) != "undefined") {
360		for (key in entries) {
361			let value = entries[key];
362			$('#item_' + key).val(value);
363		}
364	}
365
366	// -------------------------------
367	// rwdImageMaps
368	// -------------------------------
369	// $('img[usemap]').rwdImageMaps();
370
371
372	// -------------------------
373	// confirm
374	// -------------------------
375	$('a[data-confirm]').click(function(ev) {
376		let href = $(this).attr('href');
377		if (!$('#dataConfirmModal').length) {
378			html = '<div id="dataConfirmModal" class="modal" tabindex="-1"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><h5 class="modal-title">Datensatz löschen</h5><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div><div class="modal-body"><p>Modal body text goes here.</p></div><div class="modal-footer"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Abbrechen</button><button type="button" class="btn btn-danger" id="dataConfirmOK">Löschen</button></div></div></div></div>';
379			$('body').append(html);
380		}
381		$('#dataConfirmModal').find('.modal-body').html($(this).attr('data-confirm'));
382		$('#dataConfirmModal').find('.modal-title').html($(this).attr('data-title'));
383		$('#dataConfirmOK').attr('href', href);
384
385		let confirmModal = new bootstrap.Modal(document.getElementById('dataConfirmModal'), {
386		  keyboard: false
387		})
388		confirmModal.show()
389		let modalConfirm = function(callback){
390			$("#dataConfirmOK").on("click", function(){
391			  callback(true);
392			  $("#dataConfirmModal").modal('hide');
393			});
394		  };
395		  modalConfirm(function(confirm){
396			if(confirm){
397			  location.href =  href;
398			}
399		  });
400		  return false;
401	});
402
403
404	// -------------------------------
405	// Search slide in
406	// -------------------------------
407	/*
408	$('#tx-indexedsearch-searchbox-button-submit').click(function(event){
409
410		srch_term = $(this).parent().prev('#srch-term');
411		srch_term_visible = $(srch_term).is(":visible");
412		if(! srch_term_visible ) {
413			 event.preventDefault();
414
415
416			 // Set the effect type
417			var effect = 'slide';
418
419			// Set the options for the effect type chosen
420			var options = { direction: 'right' };
421
422			// Set the duration (default: 400 milliseconds)
423			var duration = 500;
424
425			$(srch_term).toggle(effect, options, duration);
426			$(srch_term).focus();
427		}
428    });
429	*/
430
431	/**
432	 * check if element is in viewport
433	 * @returns {Boolean}
434	 */
435	$.fn.isInViewport = function () {
436		let elementTop = $(this).offset().top;
437		let elementBottom = elementTop + $(this).outerHeight();
438
439		let viewportTop = $(window).scrollTop();
440		let viewportBottom = viewportTop + $(window).height();
441		let viewportWidth = $(window).width();
442		if(viewportWidth < 600) {
443			return true;
444		} else {
445			return elementTop > viewportTop && elementBottom < viewportBottom;
446		}
447
448	};
449
450
451
vendor: 4 bytes, line 452
452});

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.