PageSourceSearch

https://gesundheitsverbund.at/wp-content/themes/doloops_enfold-kavchild/js/custom.js?ver=26.08-wpkav

js gesundheitsverbund.at collected 2026-09-25 04:53:54 UTC 14,475 bytes, 419 lines download raw bytes

1/* jquery custom funktions */
2
3jQuery(document).ready(function($){
4  
5	//accessibility improvements
6	
7  var 
8      
9      
10      /**
11       * @WPSMS-184 Barrierfree Toggle Switches
12       * 
13       * - enhance Enfold menu keyboard usabillity
14       * - reachout to the toggles with tab key
15       * - change the switch status with space bar
16       * 
17       * @added 2025-02-07 Thomas Fellinger/fet9001 netzgestaltung.at
18       * @since 6.7-25.02-wpkav
19       * @see https://stackoverflow.com/questions/21749779/modify-element-tabindex-order
20       */
21      enfold_toggle_switch = function(){
22        var options = {
23              trigger_keys: ['Enter', ' '],
24              tabIndex: 0, // default order no changes - only activating tab key
25              selectors: {
26                toggle_switch: '.toggle-track'
27              }
28            },
29            toggle_switches = document.querySelectorAll(options.selectors.toggle_switch);
30                  
31        toggle_switches.forEach(function(toggle_switch){
32          toggle_switch.tabIndex = options.tabIndex;
33                    
34          toggle_switch.addEventListener('keydown', function(event){
35            if ( options.trigger_keys.includes(event.key) ) {
36              toggle_switch.click();
37              event.preventDefault();
38            }
39          });
40        });
41      },
42      
43      /**
44       * @WPSMS-184 Barrierfree Menu Close with ESC Key
45       * 
46       * - enhance Enfold menu keyboard usabillity
47       * 
48       * @added 2024-09-02 Thomas Fellinger/fet9001 netzgestaltung.at
49       * @since 6.5.5-24-12-wpkav
50       * @see https://kriesi.at/support/topic/menu-focus-trap-accessibility-keyboard-usage-improvement
51       */
52      enfold_menu_close_by_key = function(){
53        var options = {
54              key_code: 27, // ESC
55              classNames:{
56                active: 'is-active',
57                container_active: 'av-burger-overlay-active',
58                container_active_delayed: 'av-burger-overlay-active-delayed',
59              },
60              selectors: {
61                trigger: '.av-hamburger',
62                container: 'html',
63                overlay: '.av-burger-overlay',
64              }
65            },
66            trigger = document.querySelector(options.selectors.trigger),
67            container = document.querySelector(options.selectors.container),
68            overlay = null,
69            has_overlay = function(){
70              if ( !( overlay instanceof HTMLElement ) ) {
71                overlay = document.querySelector(options.selectors.overlay);
72              }
73              return overlay instanceof HTMLElement ? true : false;
74            },
75            menu_close = function(){
76              var classNames = options.classNames;
77              
78              if ( trigger.classList.contains(classNames.active) ) {
79                trigger.click();
80              }
81            };
82        
83        if ( trigger instanceof HTMLElement ) { // if a menu trigger is used
84          document.addEventListener('focusin', function(event){
85            if ( has_overlay() && !event.composedPath().includes(overlay) ) {
86              // close the menu if any
87              menu_close();
88            }
89          });
90        
91          document.addEventListener('keydown', function(event){
92            if ( has_overlay() && event.keyCode === options.key_code ) {
93              // close the menu
94              menu_close();
95            }
96          });
97        }
98      },
99      
100      
101      /**
102       * @WPSMS-184 Barrierfree Dropdown menu keyboard usabillity
103       * 
104       * - Doloops job filter
105       * 
106       * @added 2024-12-05 Thomas Fellinger/fet9001 netzgestaltung.at
107       * @since 6.7-24-17-wpkav
108       */
109      enfold_dropdown_by_key = function(){
110        var options = {
111              trigger_keys: ['Enter', ' '],
112              close_key_code: 27, // Esc
113              selectors: {
114                job_filter: '.ooo-solr-filter',
115                job_filter_trigger: 'h3',
116                job_filter_list:'.ooo-solr-filter-list'
117              }
118            },
119            job_filters = document.querySelectorAll(options.selectors.job_filter);
120        
121        job_filters.forEach(function(job_filter){
122          var trigger = job_filter.querySelector(options.selectors.job_filter_trigger),
123              list = job_filter.querySelector(options.selectors.job_filter_list);
124          
125          trigger.addEventListener('keydown', function(event){
126            if ( options.trigger_keys.includes(event.key) ) {
127              trigger.click();
128            }
129          });
130          list.addEventListener('keydown', function(event){
131            if ( options.close_key_code === event.keyCode ) {
132              trigger.click();
133              trigger.focus();
134            }
135          });
136        });
137      },
138      
139      
140      /**
141       * @WPSMS-183 GPDR Video Embed Click-To-Play with privacy hint
142       * 
143       * - Extended Enfold video block with privacy hint
144       * - checks privacy hint class and decides continueing video load
145       * - adds a WordPress/Avia filter that has been extended with the "clicked" argument
146       * 
147       * @filter aviaCookieConsent_allow_continue avia-clicktoplay
148       * 
149       * @added 2024-08-14 Thomas Fellinger/fet9001 netzgestaltung.at
150       * @since 6.5.5-22
151       */
152      enfold_video_clicktoplay = function(){
153        var options = {
154              filter_name: 'aviaCookieConsent_allow_continue',
155              namespace: 'avia-clicktoplay',
156              classNames:{
157                privacy_hint: 'av-privacy-hint',
158              },
159              selectors: {
160                preview: '.av-lazyload-video-embed',
161              }
162            },
163            check_privacy_hint = function(allow_continue, clicked){
164          		var container = clicked.parents(options.selectors.preview);
165		          
166		          if ( container[0].classList.contains(options.classNames.privacy_hint) ) {
167			          allow_continue = true;
168		          }
169		          
170		          return allow_continue;
171            };
172            
173        if ( window.hasOwnProperty('wp') && window.wp.hasOwnProperty('hooks') ) {
174          wp.hooks.addFilter(options.filter_name, options.namespace, check_privacy_hint);
175        }
176      },
177      
178      
179      /**
180       * @WPSMS-150 Better accessible lightbox close button
181       * 
182       * - sets the aria-label and the broken magnificPopup title
183       * - hides the nothing saying "x" with an aria-hidden span element
184       * 
185       * @added 2022-11-04 Thomas Fellinger/fet9001
186       * @since 5.5.11-1
187       */
188      magnificPopup_close_content = function(){
189        var selectors = {
190              lightbox_links: '.lightbox-added, .avia-cookie-info-btn',
191              lightbox_close: '.mfp-close',
192            },
193         // close_text = $.magnificPopup.defaults.tClose; // not translated to german
194            close_text = 'Schließen (Esc)',
195            lightbox_links = document.querySelectorAll(selectors.lightbox_links);
196        
197        lightbox_links.forEach(function(lightbox_link){
198          lightbox_link.addEventListener('click', function(){
199            var lightbox_closes = document.querySelectorAll(selectors.lightbox_close);
200            
201            lightbox_closes.forEach(function(lightbox_close){
202              lightbox_close.setAttribute('arial-label', close_text);
203              lightbox_close.setAttribute('title', close_text);
204            });
205          });
206        });
207      },
208      
209      /**
210       * @WPSMS-178 Inaccessible mobile cookie-settings-lightbox with "tabs"
211       * 
212       * Prevents the scrolling of the backgrounded page when clicks on some tabs occure
213       * Magnific popup measured the offset also an positions the lightbox with that value
214       * so the lightbox scrolled away
215       * 
216       * - Listens on .cookie-info-btn clicks and gets the window offset of the opened lightbox
217       * - Listens on .tab clicks inside of #av-consent-extra-info and sets the measured window offset back again
218       * 
219       * @added 2024-06-15 Thomas Fellinger/fet9001/netzgestaltung.at
220       * @since 6.4.3-19
221       * 
222       * @WPSMS-178 Bugfix wrong order of window.scroll and tab.parentNode.scrollIntoView
223       * 
224       * @added 2024-09-26 Thomas Fellinger/fet9001/netzgestaltung.at
225       * @since 6.5.5-24-14-wpkav
226       */
227      magnificPopup_cookie_settings_position = function(){
228        var selectors = {
229              lightbox_links: '.avia-cookie-info-btn',
230              cookie_settings_content: '#av-consent-extra-info',
231              tab: '.tab'
232            },
233            lightbox_links = document.querySelectorAll(selectors.lightbox_links),
234            cookie_settings_content = document.querySelector(selectors.cookie_settings_content),
235            avia_sc_tabs = cookie_settings_content.querySelectorAll(selectors.tab),
236            window_offset = 0;
237
238        // on lightbox open determine the current window offset
239        lightbox_links.forEach(function(lightbox_link){
240          lightbox_link.addEventListener('click', function(){
241            window_offset = window.pageYOffset;
242          });
243        });
244
245        // on tab event reset the window offset
246        avia_sc_tabs.forEach(function(tab){
247          tab.addEventListener('click', function(){
248            tab.parentNode.scrollIntoView();
249            window.scroll(0, window_offset);
250          });
251        });
252      };
253  
254  enfold_toggle_switch();
255  enfold_menu_close_by_key();
256  enfold_dropdown_by_key();
257  enfold_video_clicktoplay();
258  magnificPopup_close_content();
259  magnificPopup_cookie_settings_position();
260	
261	
262	//skiplinks targets
263	if ($('#main').length > 0) {
264		$('#main').prepend('<a name="inhalt"></a>');
265	}
266	if ($('nav.main_menu').length > 0) {
267		$('nav.main_menu').prepend('<a name="navigation"></a>');
268	}
269	
270	
271	if ($(".avia-slideshow-arrows").length > 0) {
272		$(".avia-slideshow-arrows a").removeAttr("aria-hidden");
273	}
274	
275	if ($(".av-hamburger-box").length > 0) {
276		$(".av-burger-menu-main .av-hamburger-box strong").text("Menü");
277	}
278	
279
280	$( '#kav_searchbar_toggle' ).click(function() {
281	 	$('#kav_searchbar').slideToggle('fast', function () {
282			$(this).find('input[name=q]').focus();
283		});
284	});
285	
286	
287	if ($(".leaflet-container").length > 0) {
288		var tempText = $("a.leaflet-control-fullscreen-button").attr("title");
289		$("a.leaflet-control-fullscreen-button").html('<span class="hidden">' + tempText + '</span>');
290	}
291	if ($(".leaflet-container").length > 0) {
292		var tempText = $("a.leaflet-control-layers-toggle").attr("title");
293		$("a.leaflet-control-layers-toggle").html('<span class="hidden">' + tempText + '</span>');
294	}
295	if ($(".leaflet-container .leaflet-tile-container").length > 0) {
296		$(".leaflet-container .leaflet-tile-container img").each(function () {
297			$(this).attr("alt","");
298		});
299	}
300	if ($(".leaflet-container").length > 0) {
301	
302		$(".leaflet-shadow-pane img.leaflet-marker-shadow").attr("alt","");
303	}
304	
305	
306	if ($("#kav_searchbar_toggle span.av-icon-char").length > 0) {
307		$("#kav_searchbar_toggle span.av-icon-char").html('<span class="hidden">Suche</span>');
308	}
309	if ($("main").length < 1) {
310		$("#main").attr("role", "main");
311	}
312
313	
314	//burger menu "only one open toggle allowed"
315	$('body').on( 'click touch', '.av-width-submenu > a', function () {
316		$(this).parent('li').siblings().removeClass('av-show-submenu');
317		$(this).parent('li').siblings().find('ul').slideUp( "fast");
318	});	
319	
320	
321	/*  29.5.2020 */
322	
323	//aria hidden bei cookies entfernen
324	if ($(".avia-cookie-consent-wrap").length > 0) {
325		$(".avia-cookie-consent-wrap").removeAttr("aria-hidden");
326		$(".avia-cookie-consent.avia-cookiemessage-bottom").removeAttr("aria-hidden");
327	}
328	
329	
330	//title bei read more
331	if ($(".avia-content-slider").length > 0) {
332		$(".avia-content-slider .slide-entry ").each(function () {
333				var tempTitle = $(this).find(".slide-entry-title a").html();
334				$(this).find("a.more-link").attr("title", tempTitle);
335		});
336	}
337	/*  / 29.5.2020 */
338	
339	
340	//old accessibility improvements - currently disabled
341	/*
342	function scCustomFunctions() {
343		
344		//menutext
345		if ($(".av-hamburger-box").length > 0) {
346			$(".av-burger-menu-main .av-hamburger-box strong").text("Menü ein bzw. ausklappen");
347		}
348		
349		//dropdownnav
350		if ($("#header_main .main_menu .avia-menu").length > 0) {
351			$( "#header_main .main_menu ul#avia-menu > li.menu-item > a" ).on( "focus", function() {
352				var temId = $(this).parent().attr("id");
353				$("#header_main .main_menu ul#avia-menu > li.menu-item").each(function () {
354					var temId2 = $(this).attr("id");
355					if (temId != temId2) {
356						$(this).find("ul.sub-menu").removeClass("active");
357					}
358				});
359			});
360			
361			$( ".logo a" ).on( "focus", function() {
362				$("#header_main .main_menu ul#avia-menu > li.menu-item").each(function () {
363						$(this).find("ul.sub-menu").removeClass("active");
364				});
365			});
366			
367			$( "#header_main .main_menu ul#avia-menu > li.menu-item-has-children > a" ).on( "focus", function() {
368				console.log("has-children a focus");
369				$(this).parent().find("ul.sub-menu").addClass("active");
370			});
371		}
372		
373		//remove aria hidden - set text in empty links
374		if ($("ul.social_bookmarks").length > 0) {
375			$("ul.social_bookmarks a").each(function () {
376				$(this).removeAttr("aria-hidden");
377			});
378		}
379		if ($("li.menu-item-search-dropdown").length > 0) {
380			$("li.menu-item-search-dropdown a").removeAttr("aria-hidden");
381		}
382		if ($(".avia-slideshow-arrows").length > 0) {
383			$(".avia-slideshow-arrows a").removeAttr("aria-hidden");
384		}
385		if ($(".av_font_icon a.av-icon-char").length > 0) {
386			$(".av_font_icon a.av-icon-char").each(function () {
387				$(this).removeAttr("aria-hidden");
388				var tempTxt = $(this).next().text();
389				$(this).html('<span class="texthidden">' + tempTxt + '</span>');
390			});
391		}
392		if ($("#advanced_menu_hide").length > 0) {
393			$("#advanced_menu_hide").removeAttr("aria-hidden");
394			$("#advanced_menu_hide").html('<span class="texthidden">schliessen</span>');
395		}
396		if ($("#advanced_menu_toggle").length > 0) {
397			$("#advanced_menu_toggle").removeAttr("aria-hidden");
398			$("#advanced_menu_toggle").html('<span class="texthidden">navigation</span>');
399		}
400		if ($(".scroll-down-link").length > 0) {
401			$(".scroll-down-link").html('<span class="texthidden">weiter</span>');
402		}
403		
404		//search label
405		if ($("input#s").length > 0) {
406			$("input#s").before('<label for="s" class="hidden">Suche</label>');
407		}
408		
409	}
410	//accessibility improvements
411	//scCustomFunctions();
412	*/
413
414
415}
415);
416
417
418
419

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.