1// Accessibility Settings State Management (jQuery Version) 2class AccessibilitySettings { 3 constructor() { 4 this.storageKey = 'accessibility_settings'; 5 this.settings = this.loadSettings(); 6 //this.$affectedElements = $("p, h1, h2, h3, h4, h5, h6, .btn, .uk-accordion li, .uk-accordion-title, .uk-accordion-content ul li"); 7 this.$affectedElements = $("p, h1, h2, h3, h4, h5, h6, .btn:not(#btn-decrease):not(#btn-orig):not(#btn-increase), .uk-accordion li, .uk-accordion-title, .uk-accordion-content ul li"); 8 this.init(); 9 } 10 11 // Load settings from localStorage 12 loadSettings() { 13 try { 14 const stored = localStorage.getItem(this.storageKey); 15 return stored ? JSON.parse(stored) : { 16 darkMode: false, 17 fontSizeOffset: 0, // Track offset from original size 18 activeTab: null 19 }; 20 } catch (e) { 21 console.warn('Failed to load accessibility settings:', e); 22 return { 23 darkMode: false, 24 fontSizeOffset: 0, 25 activeTab: null 26 }; 27 } 28 } 29 30 // Save settings to localStorage 31 saveSettings() { 32 try { 33 localStorage.setItem(this.storageKey, JSON.stringify(this.settings)); 34 } catch (e) { 35 console.warn('Failed to save accessibility settings:', e); 36 } 37 } 38 39 // Initialize and apply saved settings 40 init() { 41 this.storeOriginalSizes(); 42 this.applySettings(); 43 this.setupEventListeners(); 44 } 45 46 // Store original font sizes in data attributes 47 storeOriginalSizes() { 48 this.$affectedElements.each(function() { 49 const $this = $(this); 50 if (!$this.data("orig-size")) { 51 $this.data("orig-size", $this.css("font-size")); 52 } 53 }); 54 } 55 56 // Apply current settings to the page 57 applySettings() { 58 // Apply dark mode 59 if (this.settings.darkMode) { 60 document.body.classList.add('dark-mode'); 61 this.updateDarkModeButton(true); 62 } 63 64 // Apply font size offset 65 if (this.settings.fontSizeOffset !== 0) { 66 this.applyFontSizeOffset(this.settings.fontSizeOffset); 67 } 68 69 this.updateFontSizeButtons(); 70 } 71 72 // Apply font size offset to all affected elements 73 applyFontSizeOffset(offset) { 74 this.$affectedElements.each(function() { 75 const $this = $(this); 76 const origSize = parseInt($this.data("orig-size")); 77 $this.css("font-size", origSize + offset); 78 }); 79 } 80 81 // Update dark mode button appearance 82 updateDarkModeButton(isDark) { 83 const $darkModeLink = $('a[onclick="darkmode()"]'); 84 if ($darkModeLink.length) { 85 if (isDark) { 86 $darkModeLink.addClass('active'); 87 $darkModeLink.attr('aria-pressed', 'true'); 88 } else { 89 $darkModeLink.removeClass('active'); 90 $darkModeLink.attr('aria-pressed', 'false'); 91 } 92 } 93 } 94 95 // Update font size button states based on current offset 96 updateFontSizeButtons() { 97 const $buttons = $('.btn-fs'); 98 $buttons.removeClass('active'); 99 100 if (this.settings.fontSizeOffset > 0) { 101 $('#btn-increase').addClass('active'); 102 } else if (this.settings.fontSizeOffset < 0) { 103 $('#btn-decrease').addClass('active'); 104 } else { 105 $('#btn-orig').addClass('active'); 106 } 107 } 108 109 // Toggle dark mode 110 toggleDarkMode() { 111 this.settings.darkMode = !this.settings.darkMode; 112 document.body.classList.toggle('dark-mode'); 113 this.updateDarkModeButton(this.settings.darkMode); 114 this.saveSettings(); 115 } 116 117 // Change font size by direction (positive or negative) 118 changeFontSize(direction) { 119 const self = this; 120 this.settings.fontSizeOffset += direction; 121 122 this.$affectedElements.each(function() { 123 const $this = $(this); 124 const currentSize = parseInt($this.css("font-size")); 125 $this.css("font-size", currentSize + direction); 126 }); 127 128 this.updateFontSizeButtons(); 129 this.saveSettings();
130 } 131 132 // Reset font size to original 133 resetFontSize() { 134 const self = this; 135 this.settings.fontSizeOffset = 0; 136 137 this.$affectedElements.each(function() { 138 const $this = $(this); 139 $this.css("font-size", $this.data("orig-size")); 140 }); 141 142 this.updateFontSizeButtons(); 143 this.saveSettings(); 144 } 145 146 // Setup event listeners 147 setupEventListeners() { 148 const self = this; 149 150 // Replace the original darkmode function 151 window.darkmode = () => this.toggleDarkMode(); 152 153 // Replace font size button handlers 154 $("#btn-increase").off('click').on('click', function() { 155 self.changeFontSize(5); 156 }); 157 158 $("#btn-decrease").off('click').on('click', function() { 159 self.changeFontSize(-5); 160 }); 161 162 $("#btn-orig").off('click').on('click', function() { 163 self.resetFontSize(); 164 }); 165 166 // Handle dynamic content loading (for CMS) 167 $(document).on('DOMSubtreeModified DOMNodeInserted', function() { 168 // Debounce this to avoid too many calls 169 clearTimeout(self.dynamicContentTimer); 170 self.dynamicContentTimer = setTimeout(function() { 171 self.handleDynamicContent(); 172 }, 250); 173 }); 174 } 175 176 // Handle dynamically loaded content 177 handleDynamicContent() { 178 // Update affected elements to include new content 179 // this.$affectedElements = $("p, h1, h2, h3, h4, h5, h6, .btn, .uk-accordion li, .uk-accordion-title, .uk-accordion-content ul li"); 180 this.$affectedElements = $("p, h1, h2, h3, h4, h5, h6, .btn:not(#btn-decrease):not(#btn-orig):not(#btn-increase), .uk-accordion li, .uk-accordion-title, .uk-accordion-content ul li"); 181 182 // Store original sizes for new elements 183 this.$affectedElements.each(function() { 184 const $this = $(this); 185 if (!$this.data("orig-size")) { 186 $this.data("orig-size", $this.css("font-size")); 187 // Apply current offset to new elements 188 if (window.accessibilitySettings && window.accessibilitySettings.settings.fontSizeOffset !== 0) { 189 const origSize = parseInt($this.data("orig-size")); 190 $this.css("font-size", origSize + window.accessibilitySettings.settings.fontSizeOffset); 191 } 192 } 193 }); 194 } 195 196 // Get current settings (useful for debugging) 197 getCurrentSettings() { 198 return { ...this.settings }; 199 } 200 201 // Reset all settings 202 resetSettings() { 203 this.settings = { 204 darkMode: false, 205 fontSizeOffset: 0, 206 activeTab: null 207 }; 208 209 // Remove dark mode 210 document.body.classList.remove('dark-mode'); 211 212 // Reset font sizes 213 this.$affectedElements.each(function() { 214 const $this = $(this); 215 $this.css("font-size", $this.data("orig-size")); 216 }); 217 218 this.applySettings(); 219 this.saveSettings(); 220 } 221 222 // Public method to manually refresh affected elements (useful after AJAX loads) 223 refreshAffectedElements() { 224 //this.$affectedElements = $("p, h1, h2, h3, h4, h5, h6, .btn, .uk-accordion li, .uk-accordion-title, .uk-accordion-content ul li"); 225 this.$affectedElements = $("p, h1, h2, h3, h4, h5, h6, .btn:not(#btn-decrease):not(#btn-orig):not(#btn-increase), .uk-accordion li, .uk-accordion-title, .uk-accordion-content ul li"); 226 this.storeOriginalSizes(); 227 if (this.settings.fontSizeOffset !== 0) { 228 this.applyFontSizeOffset(this.settings.fontSizeOffset); 229 } 230 } 231} 232 233// Initialize when jQuery and DOM are ready 234$(document).ready(function() { 235 // Small delay to ensure CMS content is loaded 236 setTimeout(function() { 237 window.accessibilitySettings = new AccessibilitySettings(); 238 }, 200); 239}); 240 241// Alternative initialization for late-loading scripts 242if (typeof jQuery !== 'undefined') { 243 if (document.readyState === 'loading') { 244 $(document).ready(function() { 245 setTimeout(function() { 246 if (!window.accessibilitySettings) { 247 window.accessibilitySettings = new AccessibilitySettings();
248 } 249 }, 200); 250 }); 251 } else { 252 setTimeout(function() { 253 if (!window.accessibilitySettings) { 254 window.accessibilitySettings = new AccessibilitySettings(); 255 } 256 }, 200); 257 } 258} 259 260$(document).ready(function() { 261 "use strict"; // Start of use strict 262 263 // Hide the div 264 //$("main").hide(); 265 266 // Show the div in 5s 267 //$("main").delay(2000).fadeIn(200); 268 $("#loadingDiv").delay(2000).fadeOut(200); 269 /*$(window).bind('load', function(){ 270 $("#loadingDiv").fadeOut(100); 271 })*/ 272 273 274//------------------------------------------------------------------------------------------------------------------- 275// SHRINKING HEADER// 276//------------------------------------------------------------------------------------------------------------------- 277 // When the user scrolls down 50px from the top of the document, resize the header's font size 278 279 var throttle = function(func, delay) { 280 var timer = null; 281 return function() { 282 var context = this; 283 var args = arguments; 284 if (!timer) { 285 timer = setTimeout(function() { 286 func.apply(context, args); 287 timer = null; 288 }, delay); 289 } 290 } 291} 292function handle() { 293 if (document.body.scrollTop > 200 || document.documentElement.scrollTop > 200) { 294 console.log("add shrink"); 295 if(!$("#mainnav").hasClass("shrink")){ $("#mainnav").addClass("shrink"); }; 296 } else { 297 console.log("remove shrink"); 298 $("#mainnav").removeClass("shrink"); 299 } 300} 301window.addEventListener('scroll', throttle(handle, 1500)); 302 303 304 305//------------------------------------------------------------------------------------------------------------------- 306// OFFCANVAS NOT SCROLL // 307//------------------------------------------------------------------------------------------------------------------- 308 309 $(window).on('resize load', function() { 310 if ($(window).width() < 767) { 311 $(".offcanvas-start").attr("data-bs-scroll","false") 312 } 313 }); 314 315 316//------------------------------------------------------------------------------------------------------------------- 317// TOGGLE BUTTON OFFCANVAS // 318//------------------------------------------------------------------------------------------------------------------- 319 /*$('.navbar-toggler').click( function(){ 320 if ( $(this).hasClass('show') ) { 321 $(this).removeClass('show'); 322 } else { 323 $('.navbar-toggler.show').removeClass('show'); 324 $(this).addClass('show'); 325 } 326 }); 327 328 329 $('#offcanvasScrolling .btn-close').click(function() { 330 $('.navbar-toggler').toggleClass('show'); 331 });*/ 332 333//------------------------------------------------------------------------------------------------------------------- 334//SCROLL TO ANCHOR FROM OTHER PAGE 335//------------------------------------------------------------------------------------------------------------------- 336 337 // direct browser to top right away 338// if (window.location.hash) 339// scroll(0,0); 340 // takes care of some browsers issue 341// setTimeout(function(){scroll(0,0);},1); 342 343 $(function(){ 344 //your current click function 345 /*$('a').on('click',function(e){ 346 e.preventDefault(); 347 $('html,body').animate({ 348 scrollTop:$($(this).attr('href')).offset().top + 200 349 },1000,'linear'); 350 });*/ 351 352 // if we have anchor on the url (calling from other page) 353 if(window.location.hash){ 354 //console.log("t:"+window.location.hash.indexOf("filter=")); 355 if(window.location.hash.indexOf("filter=")!=1){ 356 // smooth scroll to the anchor id 357 358 $('html,body').animate({ 359 scrollTop:$(window.location.hash).offset().top - 200 360 },1000,'linear'); 361 } 362 363 } 364 }); 365 366 367 368//------------------------------------------------------------------------------------------------------------------- 369//PREVENT A CLICK ON A '#' LINK FROM JUMPING TO TOP 370//------------------------------------------------------------------------------------------------------------------- 371 $(function(){ 372 $('a.uk-accordion-title').on('click',function(e){
373 e.preventDefault(); 374 375 }); 376 }); 377 378 379//------------------------------------------------------------------------------------------------------------------- 380//DATA-IMAGE-SRC 381//------------------------------------------------------------------------------------------------------------------- 382 $('section, div').each(function() { 383 var attr = $(this).attr('data-image-src'); 384 if (typeof attr !== typeof undefined && attr !== false) { 385 $(this).css('background-image', 'url('+attr+')'); 386 } 387 }); 388 389//------------------------------------------------------------------------------------------------------------------- 390//VIDEO CHANGE MOBILE 391//------------------------------------------------------------------------------------------------------------------- 392 //get all vids 393 var video = document.querySelectorAll('video') 394 395 //add source to video tag 396 function addSourceToVideo(element, src) { 397 var source = document.createElement('source'); 398 source.src = src; 399 source.type = 'video/mp4'; 400 console.log(src); 401 element.appendChild(source); 402 403 } 404 405 //determine screen size and select mobile or desktop vid 406 function whichSizeVideo(element, src) { 407 var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); 408 if (windowWidth > 992 ) { 409 addSourceToVideo( element, src.dataset.desktopVid); 410 } else { 411 addSourceToVideo(element, src.dataset.mobileVid); 412 } 413 } 414 415 //init only if page has videos 416 function videoSize() { 417 if (video !== undefined) { 418 video.forEach(function(element, index) { 419 whichSizeVideo( 420 element, //element 421 element //src locations 422 ); 423 }); 424 } 425 } 426 videoSize(); 427 428//------------------------------------------------------------------------------------------------------------------- 429//FOLLOWING TOOLTIP 430//------------------------------------------------------------------------------------------------------------------- 431 $(window).on('resize load', function() { 432 if ($(window).width() > 1024) { 433 434 $('[data-tooltip]').hover(function(){ 435 $('<div class="div-tooltip"></div>').text($(this).attr('data-tooltip')).appendTo('body').fadeIn('slow'); 436 }, function() { 437 $('.div-tooltip').remove(); 438 }).mousemove(function(e) { 439 $('.div-tooltip').css({ top: e.pageY + 30, left: e.pageX - 30 }) 440 }); 441 442 } 443 }); 444//------------------------------------------------------------------------------------------------------------------- 445//CHATBOX 446//------------------------------------------------------------------------------------------------------------------- 447 448 $('.btn-chat, .btn-chat-close').click( function(){ 449 if ( $('.chatbox').hasClass('open') ) { 450 $('.chatbox').removeClass('open'); 451 } else { 452 $('.chatbox.open').removeClass('open'); 453 $('.chatbox').addClass('open'); 454 } 455 }); 456 457//------------------------------------------------------------------------------------------------------------------- 458//DATEPICKER - CALENDAR 459//------------------------------------------------------------------------------------------------------------------- 460 $('#datepicker').datepicker({ 461 language: 'de', 462 calendarWeeks: false, 463 autoclose: false, 464 todayBtn: "linked", 465 todayHighlight: true, 466 orientation: "top auto", 467 format: 'dd.mm.yyyy', 468 immediateUpdates: true, 469 maxViewMode: 0, 470 leftArrow: '<i class="icon-left-open-big"></i>', 471 rightArrow: '<i class="icon-right-open-big"></i>', 472 }); 473 474 475//------------------------------------------------------------------------------------------------------------------- 476//FLIPPING CARDS 477//------------------------------------------------------------------------------------------------------------------- 478 $('.card-flip').click( function(){ 479 if ( $(this).hasClass('active') ) { 480 $(this).removeClass('active'); 481 } else { 482 $('.card-flip.active').removeClass('active'); 483 $(this).addClass('active'); 484 } 485 }); 486 487//------------------------------------------------------------------------------------------------------------------- 488//OPEN DETAILS 489//------------------------------------------------------------------------------------------------------------------- 490 $('.open-details').click( function(){ 491 if ( $(this).hasClass('active') ) { 492 $(this).removeClass('active'); 493 } else { 494 $('.open-details.active').removeClass('active'); 495 $(this).addClass('active'); 496 } 497 }); 498 499//------------------------------------------------------------------------------------------------------------------- 500//READ MORE CONTENT 501//------------------------------------------------------------------------------------------------------------------- 502 503 $('.btn-read-more').click(function () { 504 const pathArray = window.location.pathname.split("/"); 505 const segment_1 = pathArray[1]; 506 507 var open_txt = 'Mehr lesen'; 508 var close_txt = 'Schliessen'; 509 510 if(segment_1=='en'){ 511 open_txt = 'Read more'; 512 close_txt = 'Close'; 513 } 514 515 $(this).prev().slideToggle(); 516 if ($(this).html() == open_txt + ' <i class="icon-down-open"></i>') { 517 $(this).html(close_txt + ' <i class="icon-up-open"></i>'); 518 } else { 519 $(this).html(open_txt + ' <i class="icon-down-open"></i>'); 520 } 521 }); 522 523//------------------------------------------------------------------------------------------------------------------- 524// ALPHABET LIST 525//------------------------------------------------------------------------------------------------------------------- 526 527 $('.nav[role="tablist"] button').on('click', function(){ 528 var that = this; 529 $(this).parents('section').find('.tab-content .tab-pane').not($(that).data('bs-target')).removeClass('show','active'); 530 }); 531 532 533//------------------------------------------------------------------------------------------------------------------- 534// BROSCHURE ORDER FORM 535//------------------------------------------------------------------------------------------------------------------- 536 $(function() { 537 $("input[name='delivery']").click(function() { 538 if ($("#delivery_digital").is(":checked")) { 539 $(".form-group.address").hide(); 540 } else { 541 $(".form-group.address").show(); 542 } 543 if ($("#delivery_classic").is(":checked")) { 544 $(".form-group.address").show(); 545 } else { 546 $(".form-group.address").hide(); 547 } 548 });
549 }); 550 551 var sep = '\uE000'; 552 window.addEventListener('pagehide', (event) => { 553 if (event.persisted) { 554 console.log("pagehide persisted"); 555 } 556 window.name += sep + window.pageXOffset + sep + window.pageYOffset; 557 }); 558 window.addEventListener('pageshow', (event) => { 559 const navigationType = performance.getEntriesByType('navigation')[0].type; 560 }); 561 if(window.name && window.name.indexOf(sep) > -1) 562 { 563 var parts = window.name.split(sep); 564 if(parts.length >= 3) 565 { 566 if (window.location.pathname=="/de/programm/") { 567 //console.log("Lets scroll to"+parts[parts.length - 1]); 568 //console.log("Lets scroll x"+parseFloat(parts[parts.length - 2])); 569 //console.log("Lets scroll y"+parseFloat(parts[parts.length - 1])); 570 window.name = parts[0]; 571 //window.scrollTo(parseFloat(parts[parts.length - 2]), parseFloat(parts[parts.length - 1])); 572 } 573 } 574 } 575 576}); // End of use strict
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.