1window.megamenu_breakpoint = 1023; 2 3$(function() { 4 bitv(); 5// initLebenslagen(); 6// smartmenus_init(); 7 mobileOnlyPages(); 8 smartmenus_init_go4(); 9// initTagCloud(); 10 fakeAside(); 11 fakeTextblock2_3(); 12 initTabsLinkHead(); 13 moveSpecBreadcrumbs(); 14 fixContentHeight(); 15 touristikInit(); 16 initSidebarButtons(); 17 dwarubrikbaum(); 18 specSearch(); 19 uploadButton(); 20// hideLeft(); 21 initTablesaw(); 22 init_pdfIcon(); 23 initExtTeaserLinks(); 24 initInfoTeaser(); 25 initKachelHover(); 26 dynKachelHover(); 27 dynSpecFallBackImg(); 28// pagetitle_move(); 29// subsiteScroll(); 30 anchorLinks(); 31 topNewsStart(); 32 mobile_nav(); 33 butterflyItemHeight(); 34 oldTeaserItemHeight(); 35 acTeaserItemHeight(); 36 headerImgSize(); 37 sidebarMove(); 38}); 39 40$(window).on("load", function() { 41 fixContentHeight(); 42 createTabsObserver(); 43 calcTabsSizes(); 44 butterflyItemHeight(); 45 oldTeaserItemHeight(); 46 acTeaserItemHeight(); 47 dynKachelHover(); 48 printTabs(); 49}); 50 51$(window).resize(function() { 52 calcTabsSizes(); 53 init_megamenu(); 54 touristikInit(); 55 dwarubrikbaum(); 56 mobile_nav(); 57 butterflyItemHeight(); 58 oldTeaserItemHeight(); 59 acTeaserItemHeight(); 60 dynKachelHover(); 61 dynSpecFallBackImg(); 62 dynSideMenuHeight(); 63 dynHeaderImgSize(); 64 sidebarMove(); 65}); 66 67$(window).on("orientationchange", function() { 68 calcTabsSizes(); 69 init_megamenu(); 70 touristikInit(); 71 dwarubrikbaum(); 72 mobile_nav(); 73 butterflyItemHeight(); 74 oldTeaserItemHeight(); 75 acTeaserItemHeight(); 76 dynKachelHover(); 77 dynSpecFallBackImg(); 78 dynHeaderImgSize(); 79 sidebarMove(); 80}); 81 82/* Smartmenu-Anpassungen */ 83function smartmenus_init_go4(){ 84 $("div#center").addClass("SP-OffCanvas"); 85 $('#sidemenu ul.level_1').addClass("sm sm-simple"); 86 87 $('#sidemenu ul.level_1').smartmenus({ 88 mainMenuSubOffsetX: 0, 89 mainMenuSubOffsetY: 5, 90 subMenusSubOffsetX: 0, 91 subMenusSubOffsetY: 5, 92 subMenusMinWidth: '13em' 93 }); 94 $('#sidemenu ul.level_1').smartmenus('keyboardSetHotkey', 123, 'shiftKey'); 95 96 97 $('#sidemenu ul.level_1').on('hide.smapi', function(e, menu) { 98 if( $(menu).hasClass('mega-menu')){ 99 $(menu).removeClass('open'); 100 } 101 }); 102 103 // SmartMenus mobile menu toggle button 104 var $mainMenuState = $('#main-menu-state'); 105 if ($mainMenuState.length) { 106 // animate mobile menu 107 $mainMenuState.change(function(e) { 108 if (this.checked) { 109 $("div#center").addClass("SP--movedRightIn"); 110 //SideMenuBug umgehen 111 $("#links #sidemenu").css("max-height", $("#links .bf_wrapper").height() - 50 ); 112 113 } else { 114 $("div#center").removeClass("SP--movedRightIn"); 115 } 116 117 }); 118/* $mainMenuState.focus(function() { 119 $(this).siblings("main-menu-btn-label").addClass("focus"); 120 if (!$(this).checked) { 121 $("div#center").addClass("SP--movedRightIn"); 122 $mainMenuState[0].click(); 123 $("#links a[name='Navigation']").focus(); 124 } 125 }); 126 $("#links a:last-child").off("focus", function() { 127 $mainMenuState.siblings("main-menu-btn-label").removeClass("focus"); 128 if ($(this).checked) { 129 $("div#center").removeClass("SP--movedRightIn"); 130 $mainMenuState[0].click(); 131 } 132 }); 133 $mainMenuState.off("focusin", function() { 134 if ($mainMenuState[0].checked) { 135 $mainMenuState[0].click(); 136 } 137 }); 138*/ 139 $(window).bind('beforeunload unload', function() { 140 if ($mainMenuState[0].checked) { 141 $mainMenuState[0].click(); 142 } 143 }); 144 } 145 146 /* Menu an aktueller Stelle aufklappen */ 147 var obj = $("#sidemenu .menucontainer li.item_active"); 148 149 obj.each(function() { 150 $(this).addClass("highlighted"); 151 $(this).parents("ul").addClass("highlighted").attr("aria-expanded", "true").attr("aria-hidden", "false").css("width", "auto").css("display", "block") 152 }); 153 154 /* + / - der Elternelemente des aktiven Men�punktes anpassen */ 155 var obj2 = $("#sidemenu .menucontainer li.item_parent_active > a"); 156 157 obj2.each(function() { 158 $(this).addClass("highlighted"); 159 }); 160} 161 162/* go stuff in general */ 163/* indicates pdf-downloads with icon */ 164function init_pdfIcon(){ 165 /* pdf icons on dokument list in general */ 166 $(".textblock_wrapper a[title~='(pdf)'], #content_wrapper .content_border a[title~='(pdf)'], .datasetdescription a[title~='(pdf)'], .beschreibung a[title~='(pdf)']").addClass("pdf_download"); 167 $("div.ac_teaser_more").find("a").removeClass("pdf_download"); 168 var obj = $("a.pdf_download"); 169 obj.each(function() { 170 if($(this).hasClass("ac_teaser_link") || $(this).parents(".dokument_list_object")){ 171 return; 172 } else { 173 $(this).html("" + 174 "<span class='filename'>" + linkText + "</span>" + 175 "<span class='image_wrapper ac_button_img'>" + 176 "<span class='svg_wrapper svg_85' context='11:85' style='width: 24px; height: 24px'>" + 177 "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24' height='24' viewBox='0 0 24 24'>" + 178 "<defs><style type='text/css'><![CDATA[ .sys_icon_c1 { fill: rgba(0,0,0,1); } ]]></style></defs>" + 179 "<path class='sys_icon_c1' d='M12.819 14.427c.064.267.077.679-.021.948-.128.351-.381.528-.754.528h-.637v-2.12h.496c.474 0 .803.173.916.644zm3.091-8.65c2.047-.479 4.805.279 6.09 1.179-1.494-1.997-5.23-5.708-7.432-6.882 1.157 1.168 1.563 4.235 1.342 5.703zm-7.457 7.955h-.546v.943h.546c.235 0 .467-.027.576-.227.067-.123.067-.366 0-.489-.109-.198-.341-.227-.5
17976-.227zm13.547-2.732v13h-20v-24h8.409c4.858 0 3.334 8 3.334 8 3.011-.745 8.257-.42 8.257 3zm-12.108 2.761c-.16-.484-.606-.761-1.224-.761h-1.668v3.686h.907v-1.277h.761c.619 0 1.064-.277 1.224-.763.094-.292.094-.597 0-.885zm3.407-.303c-.297-.299-.711-.458-1.199-.458h-1.599v3.686h1.599c.537 0 .961-.181 1.262-.535.554-.659.586-2.035-.063-2.693zm3.701-.458h-2.628v3.686h.907v-1.472h1.49v-.732h-1.49v-.698h1.721v-.784z'></path>" + 180 "</svg>" + 181 "</span>" + 182 "</span>" 183 ); 184 } 185 }); 186 187 /* pdf icons on dokument list objects */ 188 $(".dokument_list_object a img[alt='Dateityp pdf']").parent().addClass("doclist_pdf"); 189 var listObj = $("a.doclist_pdf") 190 listObj.each(function() { 191 var linkText = $(this).find(".filename").text(); 192 $(this).html("" + 193 "<span class='filename'>" + linkText + "</span>" + 194 "<span class='image_wrapper ac_button_img'>" + 195 "<span class='svg_wrapper svg_85' context='11:85' style='width: 24px; height: 24px'>" + 196 "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24' height='24' viewBox='0 0 24 24'>" + 197 "<defs><style type='text/css'><![CDATA[ .sys_icon_c1 { fill: rgba(0,0,0,1); } ]]></style></defs>" + 198 "<path class='sys_icon_c1' d='M12.819 14.427c.064.267.077.679-.021.948-.128.351-.381.528-.754.528h-.637v-2.12h.496c.474 0 .803.173.916.644zm3.091-8.65c2.047-.479 4.805.279 6.09 1.179-1.494-1.997-5.23-5.708-7.432-6.882 1.157 1.168 1.563 4.235 1.342 5.703zm-7.457 7.955h-.546v.943h.546c.235 0 .467-.027.576-.227.067-.123.067-.366 0-.489-.109-.198-.341-.227-.576-.227zm13.547-2.732v13h-20v-24h8.409c4.858 0 3.334 8 3.334 8 3.011-.745 8.257-.42 8.257 3zm-12.108 2.761c-.16-.484-.606-.761-1.224-.761h-1.668v3.686h.907v-1.277h.761c.619 0 1.064-.277 1.224-.763.094-.292.094-.597 0-.885zm3.407-.303c-.297-.299-.711-.458-1.199-.458h-1.599v3.686h1.599c.537 0 .961-.181 1.262-.535.554-.659.586-2.035-.063-2.693zm3.701-.458h-2.628v3.686h.907v-1.472h1.49v-.732h-1.49v-.698h1.721v-.784z'></path>" + 199 "</svg>" + 200 "</span>" + 201 "</span>" 202 ); 203 }); 204 205 /* pdf icons on go4-teasers - works only with essential go4-Script */ 206 var teaserObj = $(".teaser_element.download, .ac_teaser_item.download") 207 teaserObj.each(function() { 208 var linkText = $(this).find(".filename").text(); 209 $("" + 210 "<span class='image_wrapper ac_button_img'>" + 211 "<span class='svg_wrapper svg_85' context='11:85' style='width: 24px; height: 24px'>" + 212 "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='16' height='16' viewBox='0 0 16 16'>" + 213 "<defs><style type='text/css'><![CDATA[ .sys_icon_c1 { fill: rgba(0,0,0,1); } ]]></style></defs>" + 214 "<path class='sys_icon_c1' d='M13.341 3.579c-0.347-0.473-0.831-1.027-1.362-1.558s-1.085-1.015-1.558-1.362c-0.806-0.591-1.197-0.659-1.421-0.659h-6.75c-0.689 0-1.25 0.561-1.25 1.25v3.75l0.5 11 0.5-11v-3.75c0-0.135 0.115-0.25 0.25-0.25 0 0 6.749-0 6.75 0v3.5c0 0.276 0.224 0.5 0.5 0.5h3.5l0.5 11 0.5-11c0-0.224-0.068-0.615-0.659-1.421zM10 4v-2.405c0.359 0.278 0.792 0.654 1.271 1.134s0.856 0.912 1.134 1.271h-2.406z'></path>" + 215 "<path class='sys_icon_c1' d='M9 7h-3v5h-2.5l4 4 4-4h-2.5z'></path>" + 216 "</svg>" + 217 "</span>" + 218 "</span>" 219 ).prependTo($(this).find(".marker")); 220 }); 221} 222 223/* go-4 stuff: ext Link icons on go4-teasers - works only with essential go4-Script */ 224function initExtTeaserLinks(){ 225 /* ext link icons on go4-teasers */ 226 var teaserObj = $(".teaser_element.ext_link, .ac_teaser_item.ext_link") 227 teaserObj.each(function() { 228 $("" + 229 "<span class='image_wrapper ac_button_img'>" + 230 "<span class='svg_wrapper svg_1' style='width: 20px; height: 20px'>" + 231 "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24' height='24' viewBox='0 0 24 24'>" + 232 "<defs><style type='text/css'><![CDATA[ .sys_icon_c1 { fill: rgba(0,0,0,1); } ]]></style></defs>" + 233 "<path class='sys_icon_c1' d='M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z'></path>" + 234 "</svg>" + 235 "</span>" + 236 "</span>" 237 ).prependTo($(this).find(".marker")); 238 }); 239} 240 241/* go-4 stuff: Info icons on go4-teasers - works only with essential go4-Script */ 242function initInfoTeaser(){ 243 /* ext link icons on go4-teasers */ 244 var teaserObj = $(".teaser_element.no_link, .ac_teaser_item.no_link") 245 teaserObj.each(function() { 246 $("" + 247 "<span class='image_wrapper ac_button_img'>" + 248 "<span class='svg_wrapper svg_1' style='width: 24px; height: 24px'>" + 249 "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24' height='24' viewBox='0 0 24 24'>" + 250 "<defs><style type='text/css'><![CDATA[ .sys_icon_c1 { fill: rgba(0,0,0,1); } ]]></style></defs>" + 251 "<path class='sys_icon_c1' d='M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm-.001 5.75c.69 0 1.251.56 1.251 1.25s-.561 1.25-1.251 1.25-1.249-.56-1.249-1.25.559-1.25 1.249-1.25zm2.001 12.25h-4v-1c.484-.179 1-.201 1-.735v-4.467c0-.534-.516-.618-1-.797v-1h3v6.265c0 .535.517.558 1 .735v.999z'></path>" + 252 "</svg>" + 253 "</span>" + 254 "</span>" 255 ).prependTo($(this).find(".marker")); 256 }); 257} 258 259/* adds static teaser entries in normal teaser */
260function topNewsStart(){ 261 var topItems = $("#top_meldung .teaser_item_list") 262 263 topItems.each(function() { 264 $(this).children(".teaser_element").insertBefore("#news .wrapper .teaser_item_list .teaser_element_1"); 265 }); 266 267 $("#top_meldung").remove(); 268} 269 270/* go3 stuff */ 271/* - moving pagetitle into #logo */ 272function pagetitle_move(){ 273 if(!$("body").hasClass("rs_design_id_1080")){ 274 $("#content div.pagetitle_div").appendTo("#logo #headline_start"); 275 $("#logo #headline_start .image_wrapper").remove(); 276 } 277} 278 279/* moving quicklinks into mobile menu container */ 280function mobile_nav() { 281 var wwidth = $(window).width(); 282 283 if(wwidth <= 768){ 284 $("#quicklinks .menucontainer > ul").addClass("quicklinks").appendTo("#topmenu .menucontainer"); 285 } else { 286 $("#topmenu .menucontainer > ul.quicklinks").appendTo("#quicklinks .menucontainer").removeClass("quicklinks"); 287 } 288} 289 290/* hiding submenu column */ 291function hideLeft(){ 292 var pathMenuTest = $("#links #path_menu .menucontainer"); 293 294 if(!pathMenuTest.length){ 295 $("body").addClass("has_no_lside"); 296 } 297} 298 299/* go3/go4 stuff */ 300/* for jumping into content on sites with large banners */ 301function anchorLinks() { 302 $("#center a[href]").addClass("internal_link"); 303 $("#center a[href^='http']").addClass("external_link").removeClass("internal_link"); 304 $("#center a[href^='mailto']").addClass("mail_link").removeClass("internal_link"); 305 306 var internalLinks = $("body a.internal_link"); 307 308 internalLinks.each(function() { 309 var linkURL = $(this).attr("href"); 310 var lastChar = linkURL.substr(-1); 311 312 if(lastChar == "?"){ 313 var linkURLneu = linkURL.substr(0, linkURL.length - 1); 314 $(this).prop("href", linkURLneu); 315 } 316 }); 317} 318 319/* Hoehe wird fuer jedes Teaser-Objekt (ALT) auf einer Seite neu bestimmt */ 320function butterflyItemHeight(){ 321 var maxFrontHeight = 0; 322 var maxBackHeight = 0; 323 var finalCardHeight = 0; 324 325 $(".teaser.butterfly").each(function(){ 326 var maxFrontHeight = 0; 327 var maxBackHeight = 0; 328 var finalCardHeight = 0; 329 330 $($(this).find('.butterfly_card')).each(function(){ 331 var currentCard = $(this); 332 var currentCardFrontHeight = 0; 333 var currentCardBackHeight = 0; 334 335 currentCard.find('.butterfly_front').children().each( 336 function(){ 337 var currentCardButterflyFrontChild = $(this); 338 currentCardFrontHeight += currentCardButterflyFrontChild.outerHeight(); 339 } 340 ) 341 currentCard.find('.butterfly_back').children().each( 342 function(){ 343 var currentCardButterflyBackChild = $(this); 344 currentCardBackHeight += currentCardButterflyBackChild.outerHeight(); 345 } 346 ) 347 if(currentCardFrontHeight > maxFrontHeight){ 348 maxFrontHeight = currentCardFrontHeight; 349 } 350 if(currentCardBackHeight > maxBackHeight){ 351 maxBackHeight = currentCardBackHeight; 352 } 353 }); 354 finalCardHeight = maxFrontHeight>maxBackHeight?maxFrontHeight:maxBackHeight; 355 $(this).find('.butterfly_card, .butterfly_card .butterfly_face').outerHeight(finalCardHeight); 356 357 if($(this).hasClass("go4-teaser_top")){ 358 var teaserContentHeight = $(this).find(".teasercontent").outerHeight(); 359 console.log(teaserContentHeight); 360 $(this).find(".butterfly_back, .teasercontent").css("bottom",teaserContentHeight); 361 } 362 }); 363} 364 365function oldTeaserItemHeight(){ 366 $(".teaser").each(function(){ 367 if($(this).hasClass("go4-teaser_1") || $(this).hasClass("go4-teaser_3") || $(this).hasClass("go4-teaser_5")){ 368 $(this).find(".teaser_element").each(function(){ 369 var teaserHeight = $(this).outerHeight(); 370 var teaserTitleDateHeight = $(this).find(".teaser_titledate").outerHeight(); 371 var teaserTextHeight = teaserHeight - teaserTitleDateHeight;
372// $(this).find(".wrapper").css("height", teaserHeight); 373 $(this).find(".teasertext").css("height", teaserTextHeight); 374 }); 375 } 376 }); 377} 378 379/* Hoehe wird fuer jeden Teaser (NEU) auf einer Seite neu bestimmt */ 380function acTeaserItemHeight(){ 381 $(".ac_teaser").each(function(){ 382 if($(this).hasClass("go4-teaser_1") || $(this).hasClass("go4-teaser_3") || $(this).hasClass("go4-teaser_5")){ 383 $(this).find(".ac_teaser_item").each(function(){ 384 var teaserHeight = $(this).outerHeight(); 385 var teaserDateHeight = $(this).find(".ac_teaser_date").outerHeight(); 386 var teaserTitleHeight = $(this).find(".ac_teaser_title").outerHeight(); 387 var teaserTextHeight = teaserHeight - teaserDateHeight - teaserTitleHeight; 388 389 $(this).find(".ac_teaser_text").css("height", teaserTextHeight); 390 }); 391 } 392 }); 393} 394 395 396/* go 4 stuff */ 397function mobileOnlyPages(){ 398 console.log("mobileOnlyPages"); 399 if($("#topmenu .menucontainer").hasClass("mobile_only")){ 400 $("body").addClass("mobile_only_menu"); 401 } else { 402 if($("#sidemenu .menucontainer").hasClass("mobile_only")){ 403 $("body").addClass("offcanvas_menu mobile_only_menu"); 404 /* Menu-Toggle-Button positionieren */ 405 $("#toggle_mobil").prependTo("#center"); 406 } 407 else { 408 $("body").addClass("desktop_popup_menu"); 409 } 410 } 411} 412 413/* go-4 stuff: preparation für hover arrow on kachel and footer-karussell */ 414function initKachelHover(){ 415 var menuObj = $(".menucontainer.kachel_menu .menuitemicon, #footer #other_interests .menuitemicon"); 416 417 menuObj.each(function(){
418 $("<div class='img_hover'></div>").insertBefore($(this)); 419 }); 420} 421 422function dynKachelHover(){ 423 var menuObj = $(".menucontainer.kachel_menu .menuitemicon, #footer #other_interests .menuitemicon"); 424 425 menuObj.each(function(){ 426 var imgHeight = $(this).outerHeight(); 427 var imgWidth = $(this).outerWidth(); 428 429 $(this).siblings(".img_hover").css("height", imgHeight).css("width", imgWidth); 430 }); 431 432 var teaserObj = $(".go4-teaser_top .teaser_element"); 433 434 teaserObj.each(function(){ 435 var imgHeight = $(this).find("div.teaserimg").outerHeight(); 436 var imgWidth = $(this).find("div.teaserimg").outerWidth(); 437 var textHeight = $(this).find(".teasercontent").outerHeight(); 438 439 $(this).find("div.teaserimg").siblings(".img_hover").css("height", (imgHeight - textHeight)).css("width", imgWidth); 440 $(this).find(".teasercontent").css("margin-top", -textHeight); 441 }); 442 443 var topObj = $("#top_news .menucontainer.kachel_menu a"); 444 445 topObj.each(function(){ 446 var textHeight = $(this).find(".item_text").outerHeight(); 447 var descHeight = $(this).find(".item_description").outerHeight(); 448 var textMargin = textHeight + descHeight; 449 var hoverHeight = $(this).outerHeight(); 450 451 $(this).find(".item_text").css("margin-top", -textMargin); 452 $(this).find(".img_hover").css("height", (hoverHeight - textMargin)); 453 }); 454} 455 456function initSlider() { 457 $('#logo #quicklink_karussell ul, #footer #other_interests ul').bxSlider({ 458 auto: true, 459 controls: false, 460 mode: 'horizontal', 461 speed: 2000, 462 pause: 10000 463 }); 464} 465 466/* Karussell Config */ 467function getKarussellTopConfig() { 468 var wWidth = $(window).width(); 469 470 /* Quicklinks */ 471 var slideWidthQuick = $('#logo #quicklink_karussell').innerWidth(); 472 473 if(wWidth >= 1200){ 474 slideWidthQuick = slideWidthQuick / 5; 475 476 var bxConfig = { 477 auto: true, 478 controls: true, 479 autoHover: true, 480 mode: 'horizontal', 481 minSlides: 4, 482 maxSlides: 5, 483 moveSlides: 1, 484 slideWidth: slideWidthQuick, 485 speed: 1000, 486 pause: 8000 487 }; 488 } else if(wWidth >= 1024){ 489 slideWidthQuick = slideWidthQuick / 4; 490 491 var bxConfig = { 492 auto: true, 493 controls: true, 494 autoHover: true, 495 mode: 'horizontal', 496 minSlides: 3, 497 maxSlides: 4, 498 moveSlides: 1, 499 slideWidth: slideWidthQuick, 500 speed: 1000, 501 pause: 8000 502 }; 503 } else if((wWidth >= 480) && (wWidth <= 1023)){ 504 console.log($(window).width() + " im Bereich 480-768"); 505 slideWidthQuick = slideWidthQuick / 3; 506 507 var bxConfig = { 508 auto: true, 509 controls: true, 510 autoHover: true, 511 mode: 'horizontal', 512 minSlides: 1, 513 maxSlides: 3, 514 moveSlides: 1, 515 slideWidth: slideWidthQuick, 516 speed: 1000, 517 pause: 8000 518 }; 519 } else if(wWidth <= 479){ 520 521 console.log($(window).width() + " im Bereich < 480"); 522 523 var bxConfig = { 524 auto: true, 525 controls: true, 526 autoHover: true, 527 mode: 'fade', 528 minSlides: 1, 529 maxSlides: 1, 530 moveSlides: 1, 531 slideWidth: slideWidthQuick, 532 speed: 1000, 533 pause: 8000 534 }; 535 } 536 return bxConfig; 537} 538 539function getKarussellBottomConfig() { 540 if($('body').hasClass('rs_design_id_1408')){ 541 var wWidth = $(window).width(); 542 543 /* Other Interests */ 544 var slideWidthOther = $('body.rs_design_id_1408 #other_interests .wrapper').innerWidth(); 545 546 if(wWidth >= 1024){ 547 slideWidthOther = slideWidthOther / 3; 548 549 var bxConfig = { 550 auto: true, 551 controls: true, 552 autoHover: true, 553 mode: 'horizontal', 554 minSlides: 2, 555 maxSlides: 3, 556 moveSlides: 1, 557 slideWidth: slideWidthOther, 558 speed: 1000, 559 pause: 8000 560 }; 561 } else if((wWidth >= 480) && (wWidth <= 1023)){ 562 console.log($(window).width() + " im Bereich 480-768"); 563 slideWidthOther = slideWidthOther / 2; 564 565 var bxConfig = { 566 auto: true, 567 controls: true, 568 autoHover: true, 569 mode: 'horizontal', 570 minSlides: 1, 571 maxSlides: 2, 572 moveSlides: 1, 573 slideWidth: slideWidthOther, 574 speed: 1000, 575 pause: 8000 576 }; 577 } else if(wWidth <= 479){ 578 579 console.log($(window).width() + " im Bereich < 480"); 580 581 var bxConfig = { 582 auto: true, 583 controls: true, 584 autoHover: true, 585 mode: 'fade', 586 minSlides: 1, 587 maxSlides: 1, 588 moveSlides: 1, 589 slideWidth: slideWidthOther, 590 speed: 1000, 591 pause: 8000 592 }; 593 } 594 $('body.rs_design_id_1408 #other_interests .item_text').css("width", $('body.rs_design_id_1408 #other_interests img').outerWidth()); 595 return bxConfig; 596 } 597} 598 599$(document).ready(function(){ 600 $(initSlider); 601 bxSliderTopConfig = getKarussellTopConfig(); 602 if($('body').hasClass('rs_design_id_1408')){ 603 bxSliderBottomConfig = getKarussellBottomConfig(); 604 } 605 606 window.bx_quicklinks = $('#logo #quicklink_karussell ul').bxSlider( bxSliderTopConfig ); 607 if($('body').hasClass('rs_design_id_1408')){ 608 window.bx_others = $('#content #other_interests ul').bxSlider( bxSliderBottomConfig ); 609 } 610 611 $(window).resize(function(e) { 612 console.log(e); 613 initSlider(); 614 615 bxSliderTopConfig = getKarussellTopConfig(); 616 if($('body').hasClass('rs_design_id_1408')){ 617 bxSliderBottomConfig = getKarussellBottomConfig(); 618 } 619 window.bx_quicklinks.reloadSlider( bxSliderTopConfig ); 620 if($('body').hasClass('rs_design_id_1408')){ 621 window.bx_others.reloadSlider( bxSliderBottomConfig ); 622 } 623 }); 624 625 $(window).on("orientationchange",function(e) { 626 console.log(e); 627 initSlider(); 628 629 bxSliderTopConfig = getKarussellTopConfig(); 630 if($('body').hasClass('rs_design_id_1408')){ 631 bxSliderBottomConfig = getKarussellBottomConfig(); 632 } 633 window.bx_quicklinks.reloadSlider( bxSliderTopConfig ); 634 if($('body').hasClass('rs_design_id_1408')){ 635 window.bx_others.reloadSlider( bxSliderBottomConfig ); 636 } 637 }); 638}); 639 640/* go-4 stuff: header settings for search moving */ 641function headerImgSize(){ 642 var wWidth = $(window).width(); 643 var obenHeight = $("#oben_logo").outerHeight(); 644 var searchHeight = $("#unten_logo #suche").outerHeight(); 645 var aspectRatioStart = 550 / 1920; 646 var aspectRatioDefault = 400 / 1920; 647 648 console.log("Header-Bild: " + $("#mitte_logo").height()); 649 650 $("#oben_logo").css("height", Math.floor(obenHeight)); 651 $("#mitte_logo").css("margin-top", Math.floor(obenHeight)); 652 $("#header_bild").css("height", Math.floor(wWidth * aspectRatioDefault)); 653 $("body.rs_design_id_1408").find("#header_bild").css("height", Math.floor(wWidth * aspectRatioStart)); 654 655 if(wWidth >= 768){ 656 if(wWidth > 1920){ 657 $("#logo #suche").css("top", Math.floor(1920 * aspectRatioDefault - searchHeight/2)); 658 $("body.rs_design_id_1408").find("#logo #suche").css("top", Math.floor(1920 * aspectRatioStart - searchHeight/2)); 659 } else{ 660 $("#logo #suche").css("top", Math.floor(wWidth * aspectRatioDefault - searchHeight/2)); 661 $("body.rs_design_id_1408").find("#logo #suche").css("top", Math.floor(wWidth * aspectRatioStart - searchHeight/2)); 662 } 663 } else { 664 $("#logo #suche").css("top", Math.floor(wWidth * aspectRatioDefault)); 665 $("body.rs_design_id_1408").find("#logo #suche").css("top", Math.floor(wWidth * aspectRatioStart)); 666 } 667 668 var bannerHeight = $("#mitte_logo").height(); 669 670 if(bannerHeight == 0){ 671 $("#logo").addClass("search_moved"); 672 $("#unten_logo #suche .search_wrapper").appendTo("#oben_logo #suche_oben"); 673 } 674} 675 676function dynHeaderImgSize(){ 677 var wWidth = $(window).width(); 678 var obenHeight = $("#oben_logo").outerHeight(); 679 var searchHeight = $("#unten_logo #suche").outerHeight(); 680 var aspectRatioStart = 550 / 1920; 681 var aspectRatioDefault = 400 / 1920; 682 683 console.log("Header-Bild: " + $("#mitte_logo").height()); 684 685 $("#oben_logo").css("height", Math.floor(obenHeight)); 686 $("#mitte_logo").css("margin-top", Math.floor(obenHeight)); 687 $("#header_bild").css("height", Math.floor(wWidth * aspectRatioDefault)); 688 $("body.rs_design_id_1408").find("#header_bild").css("height", Math.floor(wWidth * aspectRatioStart)); 689 690 if(wWidth >= 768){ 691 if(wWidth > 1920){ 692 $("#logo #suche").css("top", Math.floor(1920 * aspectRatioDefault - searchHeight/2)); 693 $("body.rs_design_id_1408").find("#logo #suche").css("top", Math.floor(1920 * aspectRatioStart - searchHeight/2)); 694 } else{ 695 $("#logo #suche").css("top", Math.floor(wWidth * aspectRatioDefault - searchHeight/2)); 696 $("body.rs_design_id_1408").find("#logo #suche").css("top", Math.floor(wWidth * aspectRatioStart - searchHeight/2)); 697 } 698 } else { 699 $("#logo #suche").css("top", Math.floor(wWidth * aspectRatioDefault)); 700 $("body.rs_design_id_1408").find("#logo #suche").css("top", Math.floor(wWidth * aspectRatioStart)); 701 } 702 703 var bannerHeight = $("#mitte_logo").height(); 704 705 if(bannerHeight == 0){ 706 $("#logo").addClass("search_moved"); 707 $("#unten_logo #suche .search_wrapper").appendTo("#oben_logo #suche_oben"); 708 } 709} 710 711/* go-4 stuff: moving search on scrolling action */ 712$(window).scroll(function () { 713 var wWidth = $(window).width(); 714 var imgwidth = $("#header_bild").width(); 715 var imgheight = $("#header_bild").height(); 716 var imgsize = imgheight / imgwidth; 717 var searchHeight = $("#unten_logo #suche").outerHeight(); 718 var searchMargin = 42; 719 var ref = Math.round(($(this).width() * imgsize) - (searchHeight / 2) ); 720 var bannerHeight = $("#mitte_logo").height(); 721 722 $("#unten_logo #suche").css("height", searchHeight); 723 724 if(bannerHeight > 0){ 725 if($(this).scrollTop() > ref) { 726 if(wWidth >= 768){ 727 $("#logo").addClass("search_moved"); 728 $("#unten_logo #suche .search_wrapper").appendTo("#oben_logo #suche_oben"); 729 } 730 } else { 731 if(wWidth >= 768){ 732 $("#oben_logo #suche_oben .search_wrapper").appendTo("#unten_logo > #suche"); 733 $("#logo").removeClass("search_moved"); 734 } 735 } 736 } 737}); 738 739function sidebarMove(){ 740 var wWidth = $(window).width(); 741 742 if(wWidth < 600){ 743 $("#logo").addClass("sidebar_moved"); 744 $("#mitte_logo #sidebar_neu").appendTo("#oben_logo .wrapper_rechts"); 745 } 746 else { 747 $("#oben_logo #sidebar_neu").appendTo("#mitte_logo"); 748 $("#logo").removeClass("sidebar_moved"); 749 } 750} 751 752/* Place individual functions here */ 753 754function dynSideMenuHeight(){ 755 $("#links #sidemenu").css("max-height", $("#links .bf_wrapper").height() - 50 ); 756} 757 758function printTabs(){ 759 if($("#content").find("#tabs_head").length){ 760 var obj = $("#tabs_head .tpl_div_element.hasValue"); 761 obj.each(function(){ 762 var tabId = "#tab_content_" + $(this).attr("id").split("_")[2]; 763 var tabTitle = $(this).find("a").text(); 764 $(this).parents(".wrapper").find(tabId).prepend("<span class='hidden print'>"+tabTitle+"</span>"); 765 }); 766 } 767} 768 769function dynSpecFallBackImg(){ 770 var wWidth = $(window).width(); 771 var obj = $("body.event_default .teaser_element"); 772 var aspectRatio = 330 / 600; 773 774 if(wWidth < 768){ 775 obj.each(function() { 776 var elementWidth = $(this).outerWidth(); 777 778 $(this).find(".no_teaser_img").css("height", elementWidth * aspectRatio); 779 }); 780 } 781} 782 783/** 784 * Accessible Tabs (Vanilla) â Final + iframe-resizer support + height cache 785 * ------------------------------------------------------------------------ 786 * - mehrere Tabsets pro Seite 787 * - nested Tabsets möglich 788 * - ARIA Tabs Pattern 789 * - Keyboard: Left/Right/Home/End/Enter/Space 790 * - leere Panels => zugehöriger Head + Panel komplett hidden 791 * - automatische Initialisierung 792 * - automatische Re-Initialisierung bei später eingefügten Tabsets 793 * - iframe-resizer Support bei Tabwechseln 794 * - reduziert Layout-Sprünge durch Height-Cache / temporäre min-height 795 * 796 * WICHTIG: 797 * CSS muss enthalten: 798 * [hidden] { display: none !important; } 799 */ 800 801(function () { 802 "use strict"; 803 804 // -------------------------------------------------- 805 // Helper 806 // -------------------------------------------------- 807 const $ = (sel, root = document) => root.querySelector(sel); 808 const $$ = (sel, root = document) => Array.from(root.querySelectorAll(sel)); 809 810 let uidCounter = 0; 811 const uid = (prefix = "tabs") => `${prefix}_${++uidCounter}`; 812 813 const debounce = (fn, wait = 80) => { 814 let t; 815 return (...args) => { 816 clearTimeout(t); 817 t = setTimeout(() => fn(...args), wait); 818 }; 819 }; 820 821 const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); 822 823 // -------------------------------------------------- 824 // Config 825 // -------------------------------------------------- 826 const CFG = { 827 setSel: ".tabs_set[data-tabs-set]", 828 titleSel: ".tabs_title", 829 headerSel: ".tabs_header", 830 contentsSel: ".tabs_contents, .tabs_content", 831 headItemSel: ":scope > .tpl_div_element", 832 tabSel: "a[role='tab']", 833 panelSel: ":scope > section[role='tabpanel']", 834 wrapperSel: ".tabs_content_wrapper, .tab_content_wrapper", 835 warmupEnabled: true, 836 warmupDelay1: 30, 837 warmupDelay2: 150, 838 warmupDelay3: 250, 839 minHeightClearDelay: 500 840 }; 841 842 // -------------------------------------------------- 843 // Height helpers 844 // -------------------------------------------------- 845 function getPanelWrapper(panel) { 846 return panel ? $(CFG.wrapperSel, panel) : null; 847 } 848 849 function getPanelHeight(panel) { 850 const wrapper = getPanelWrapper(panel); 851 return wrapper ? Math.ceil(wrapper.offsetHeight) : 0; 852 } 853 854 function storePanelHeight(panel) { 855 if (!panel) return 0; 856 const height = getPanelHeight(panel); 857 if (height > 0) { 858 panel.dataset.lastHeight = String(height); 859 } 860 return height; 861 } 862 863 function getStoredPanelHeight(panel) { 864 if (!panel) return 0; 865 const val = parseInt(panel.dataset.lastHeight || "0", 10); 866 return Number.isFinite(val) ? val : 0; 867 } 868 869 function setTemporaryMinHeight(panel, height) { 870 const wrapper = getPanelWrapper(panel); 871 if (!wrapper || !height || height < 1) return; 872 wrapper.style.minHeight = `${height}px`; 873 } 874 875 function clearTemporaryMinHeight(panel, delay = CFG.minHeightClearDelay) { 876 const wrapper = getPanelWrapper(panel); 877 if (!wrapper) return; 878 879 setTimeout(() => { 880 wrapper.style.minHeight = ""; 881 }, delay); 882 } 883 884 function updatePanelHeightLater(panel, delays = [120, 300, 600]) { 885 delays.forEach((delay) => { 886 setTimeout(() => { 887 const h = storePanelHeight(panel); 888 if (h > 0) { 889 savePanelHeightToSession(panel); 890 } 891 }, delay); 892 }); 893 } 894 895 // -------------------------------------------------- 896 // Session cache 897 // -------------------------------------------------- 898 function getIframeCacheKey(panel) { 899 const iframe = $("iframe", panel); 900 if (!iframe) return null; 901 902 const src = iframe.getAttribute("src") || ""; 903 const width = Math.round(window.innerWidth || 0); 904 return `tabs-iframe-height::${src}::${width}`; 905 } 906 907 function savePanelHeightToSession(panel) {
908 const key = getIframeCacheKey(panel); 909 const h = getStoredPanelHeight(panel); 910 if (!key || !h) return; 911 912 try { 913 sessionStorage.setItem(key, String(h)); 914 } catch (err) { 915 // unkritisch 916 } 917 } 918 919 function loadPanelHeightFromSession(panel) { 920 const key = getIframeCacheKey(panel); 921 if (!key) return 0; 922 923 try { 924 const val = parseInt(sessionStorage.getItem(key) || "0", 10); 925 return Number.isFinite(val) ? val : 0; 926 } catch (err) { 927 return 0; 928 } 929 } 930 931 // -------------------------------------------------- 932 // iframe helpers 933 // -------------------------------------------------- 934 function triggerIframeResize(iframe) { 935 if (!iframe) return; 936 937 try { 938 if (iframe.iFrameResizer) { 939 if (typeof iframe.iFrameResizer.resize === "function") { 940 iframe.iFrameResizer.resize(); 941 return; 942 } 943 944 if (typeof iframe.iFrameResizer.trigger === "function") { 945 iframe.iFrameResizer.trigger("resize"); 946 return; 947 } 948 949 if (typeof iframe.iFrameResizer.sendMessage === "function") { 950 iframe.iFrameResizer.sendMessage({ type: "resize" }); 951 return; 952 } 953 } 954 955 if (iframe.contentWindow) { 956 iframe.contentWindow.dispatchEvent(new Event("resize")); 957 } 958 } catch (err) { 959 // cross-domain darf hier ruhig scheitern 960 } 961 } 962 963 function refreshIframesInPanel(panel) { 964 if (!panel) return; 965 966 const iframes = $$("iframe", panel); 967 if (!iframes.length) return; 968 969 requestAnimationFrame(() => { 970 iframes.forEach(triggerIframeResize); 971 window.dispatchEvent(new Event("resize")); 972 }); 973 974 setTimeout(() => { 975 iframes.forEach(triggerIframeResize); 976 window.dispatchEvent(new Event("resize")); 977 }, 120); 978 979 setTimeout(() => { 980 iframes.forEach(triggerIframeResize); 981 }, 300); 982 } 983 984 function refreshNestedTabsets(panel) { 985 if (!panel) return; 986 987 const nestedTabsets = $$(CFG.setSel, panel); 988 if (!nestedTabsets.length) return; 989 990 nestedTabsets.forEach((nestedSet) => { 991 const activePanel = $( 992 `${CFG.contentsSel} > section[role='tabpanel'].active`, 993 nestedSet 994 ); 995 if (activePanel) { 996 refreshIframesInPanel(activePanel); 997 updatePanelHeightLater(activePanel); 998 } 999 }); 1000 } 1001 1002 // -------------------------------------------------- 1003 // Warm-up für versteckte iframe-Panels 1004 // -------------------------------------------------- 1005 function makePanelMeasurable(panel, width) { 1006 const old = { 1007 hidden: panel.hidden, 1008 ariaHidden: panel.getAttribute("aria-hidden"), 1009 position: panel.style.position, 1010 visibility: panel.style.visibility, 1011 left: panel.style.left, 1012 top: panel.style.top, 1013 width: panel.style.width, 1014 display: panel.style.display, 1015 pointerEvents: panel.style.pointerEvents 1016 }; 1017 1018 panel.hidden = false; 1019 panel.setAttribute("aria-hidden", "true"); 1020 panel.style.position = "absolute"; 1021 panel.style.visibility = "hidden"; 1022 panel.style.left = "-99999px"; 1023 panel.style.top = "0"; 1024 panel.style.display = "block"; 1025 panel.style.pointerEvents = "none"; 1026 1027 if (width > 0) { 1028 panel.style.width = `${width}px`; 1029 } 1030 1031 return old; 1032 } 1033 1034 function restoreMeasuredPanel(panel, old) { 1035 panel.hidden = old.hidden; 1036 1037 if (old.ariaHidden == null) { 1038 panel.removeAttribute("aria-hidden"); 1039 } else { 1040 panel.setAttribute("aria-hidden", old.ariaHidden); 1041 } 1042 1043 panel.style.position = old.position; 1044 panel.style.visibility = old.visibility; 1045 panel.style.left = old.left; 1046 panel.style.top = old.top; 1047 panel.style.width = old.width; 1048 panel.style.display = old.display; 1049 panel.style.pointerEvents = old.pointerEvents; 1050 } 1051 1052 async function warmupPanelIframes(panel, width) { 1053 const iframes = $$("iframe", panel); 1054 if (!iframes.length) { 1055 const h = storePanelHeight(panel); 1056 if (h > 0) savePanelHeightToSession(panel); 1057 return; 1058 } 1059 1060 const old = makePanelMeasurable(panel, width); 1061 1062 await wait(CFG.warmupDelay1); 1063
1064 iframes.forEach(triggerIframeResize); 1065 window.dispatchEvent(new Event("resize")); 1066 1067 await wait(CFG.warmupDelay2); 1068 1069 iframes.forEach(triggerIframeResize); 1070 window.dispatchEvent(new Event("resize")); 1071 1072 await wait(CFG.warmupDelay3); 1073 1074 const h = storePanelHeight(panel); 1075 if (h > 0) savePanelHeightToSession(panel); 1076 1077 restoreMeasuredPanel(panel, old); 1078 } 1079 1080 async function warmupTabsetIframes(tabset) { 1081 if (!CFG.warmupEnabled) return; 1082 1083 const contents = getContents(tabset); 1084 if (!contents) return; 1085 1086 const panels = getPanels(tabset); 1087 const width = Math.ceil(contents.getBoundingClientRect().width); 1088 1089 for (const panel of panels) { 1090 if (panel.classList.contains("is-hidden-empty")) continue; 1091 if (!$("iframe", panel)) continue; 1092 1093 // vorhandene Sitzungshöhe sofort merken 1094 const cached = loadPanelHeightFromSession(panel); 1095 if (cached > 0) { 1096 panel.dataset.lastHeight = String(cached); 1097 } 1098 1099 await warmupPanelIframes(panel, width); 1100 } 1101 } 1102 1103 // -------------------------------------------------- 1104 // Content check 1105 // -------------------------------------------------- 1106 function nodeHasMeaningfulContent(node) { 1107 if (!node) return false; 1108 1109 if (node.nodeType === Node.TEXT_NODE) { 1110 const text = (node.textContent || "").replace(/\u00a0/g, " ").trim(); 1111 return text.length > 0; 1112 } 1113 1114 if (node.nodeType !== Node.ELEMENT_NODE) return false; 1115 1116 const tag = node.tagName.toLowerCase(); 1117 1118 if (["br", "wbr", "hr", "script", "style", "template"].includes(tag)) { 1119 return false; 1120 } 1121 1122 if ( 1123 [ 1124 "img", 1125 "iframe", 1126 "video", 1127 "audio", 1128 "embed", 1129 "object", 1130 "svg", 1131 "canvas", 1132 "input", 1133 "select", 1134 "textarea", 1135 "button" 1136 ].includes(tag) 1137 ) { 1138 return true; 1139 } 1140 1141 if (node.getAttribute?.("aria-hidden") === "true" || node.hidden) { 1142 return false; 1143 } 1144 1145 if (tag === "a") { 1146 const text = (node.textContent || "").replace(/\u00a0/g, " ").trim(); 1147 if (text.length > 0) return true; 1148 if (node.querySelector("img, svg, canvas, iframe, video, audio")) return true; 1149 } 1150 1151 for (const child of node.childNodes) { 1152 if (nodeHasMeaningfulContent(child)) return true; 1153 } 1154 1155 return false; 1156 } 1157 1158 function panelHasContent(panel) { 1159 const wrapper = getPanelWrapper(panel); 1160 if (!wrapper) return false; 1161 return nodeHasMeaningfulContent(wrapper); 1162 } 1163 1164 // -------------------------------------------------- 1165 // Scoped getters (nested-safe) 1166 // -------------------------------------------------- 1167 function getHeader(tabset) { 1168 return $(CFG.headerSel, tabset); 1169 } 1170 1171 function getContents(tabset) { 1172 return $(CFG.contentsSel, tabset); 1173 } 1174 1175 function getHeadItems(tabset) { 1176 const header = getHeader(tabset); 1177 if (!header) return []; 1178 return $$(CFG.headItemSel, header); 1179 } 1180 1181 function getTabs(tabset) { 1182 return getHeadItems(tabset) 1183 .map((item) => $(CFG.tabSel, item)) 1184 .filter(Boolean); 1185 } 1186 1187 function getPanels(tabset) { 1188 const contents = getContents(tabset); 1189 if (!contents) return []; 1190 return $$(CFG.panelSel, contents); 1191 } 1192 1193 // -------------------------------------------------- 1194 // ARIA / IDs 1195 // -------------------------------------------------- 1196 function ensureTabsetLabel(tabset) { 1197 const header = getHeader(tabset); 1198 const title = $(CFG.titleSel, tabset); 1199 1200 if (!header) return; 1201 1202 header.setAttribute("role", "tablist"); 1203 1204 if (title) { 1205 if (!title.id) title.id = uid("tabs_label"); 1206 header.setAttribute("aria-labelledby", title.id); 1207 } else if ( 1208 !header.hasAttribute("aria-label") && 1209 !header.hasAttribute("aria-labelledby") 1210 ) { 1211 header.setAttribute("aria-label", "Tabs"); 1212 } 1213 } 1214 1215 function ensureIdsAndRelations(tabset) { 1216 const tabs = getTabs(tabset); 1217 const panels = getPanels(tabset); 1218 const pairCount = Math.min(tabs.length, panels.length); 1219 1220 for (let i = 0; i < pairCount; i++) { 1221 const tab = tabs[i]; 1222 const panel = panels[i]; 1223 1224 if (!tab.id) tab.id = uid("tab"); 1225 if (!panel.id) panel.id = uid("panel"); 1226 1227 tab.setAttribute("role", "tab"); 1228 tab.setAttribute("aria-controls", panel.id); 1229 tab.setAttribute("aria-selected", "false"); 1230 tab.setAttribute("tabindex", "-1"); 1231 1232 panel.setAttribute("role", "tabpanel"); 1233 panel.setAttribute("aria-labelledby", tab.id); 1234 panel.setAttribute("aria-hidden", "true"); 1235 } 1236 } 1237 1238 // -------------------------------------------------- 1239 // Empty panels 1240 // -------------------------------------------------- 1241 function hideEmptyPairs(tabset) { 1242 const headItems = getHeadItems(tabset); 1243 const tabs = getTabs(tabset); 1244 const panels = getPanels(tabset); 1245 const pairCount = Math.min(headItems.length, tabs.length, panels.length); 1246 1247 for (let i = 0; i < pairCount; i++) { 1248 const item = headItems[i]; 1249 const tab = tabs[i]; 1250 const panel = panels[i]; 1251 const hasContent = panelHasContent(panel); 1252 1253 if (!hasContent) { 1254 item.hidden = true; 1255 item.setAttribute("aria-hidden", "true"); 1256 item.classList.add("is-hidden-empty"); 1257 1258 tab.setAttribute("aria-disabled", "true"); 1259 tab.setAttribute("aria-selected", "false"); 1260 tab.setAttribute("tabindex", "-1"); 1261 tab.classList.remove("active"); 1262 1263 panel.hidden = true; 1264 panel.setAttribute("aria-hidden", "true"); 1265 panel.classList.add("is-hidden-empty"); 1266 panel.classList.remove("active"); 1267 } else { 1268 item.hidden = false;
1269 item.removeAttribute("aria-hidden"); 1270 item.classList.remove("is-hidden-empty"); 1271 1272 tab.removeAttribute("aria-disabled"); 1273 panel.classList.remove("is-hidden-empty"); 1274 } 1275 } 1276 } 1277 1278 // -------------------------------------------------- 1279 // Activation 1280 // -------------------------------------------------- 1281 function activateTab(tabset, activeIndex, focusTab = false) { 1282 const headItems = getHeadItems(tabset); 1283 const tabs = getTabs(tabset); 1284 const panels = getPanels(tabset); 1285 const pairCount = Math.min(headItems.length, tabs.length, panels.length); 1286 1287 let previousActivePanel = null; 1288 let activePanel = null; 1289 1290 for (let i = 0; i < pairCount; i++) { 1291 if (panels[i].classList.contains("active") && !panels[i].hidden) { 1292 previousActivePanel = panels[i]; 1293 storePanelHeight(previousActivePanel); 1294 savePanelHeightToSession(previousActivePanel); 1295 break; 1296 } 1297 } 1298 1299 for (let i = 0; i < pairCount; i++) { 1300 const item = headItems[i]; 1301 const tab = tabs[i]; 1302 const panel = panels[i]; 1303 1304 const isAvailable = 1305 !item.hidden && 1306 tab.getAttribute("aria-disabled") !== "true" && 1307 !panel.classList.contains("is-hidden-empty"); 1308 1309 const isActive = isAvailable && i === activeIndex; 1310 1311 item.classList.toggle("active", isActive); 1312 tab.classList.toggle("active", isActive); 1313 panel.classList.toggle("active", isActive); 1314 1315 tab.setAttribute("aria-selected", isActive ? "true" : "false"); 1316 tab.setAttribute("tabindex", isActive ? "0" : "-1"); 1317 1318 if (isActive) { 1319 panel.hidden = false; 1320 panel.setAttribute("aria-hidden", "false"); 1321 activePanel = panel; 1322 } else { 1323 panel.hidden = true; 1324 panel.setAttribute("aria-hidden", "true"); 1325 } 1326 } 1327 1328 if (focusTab && tabs[activeIndex]) { 1329 tabs[activeIndex].focus({ preventScroll: true }); 1330 } 1331 1332 if (activePanel) { 1333 const ownStoredHeight = 1334 getStoredPanelHeight(activePanel) || loadPanelHeightFromSession(activePanel); 1335 1336 const previousHeight = previousActivePanel 1337 ? getPanelHeight(previousActivePanel) || getStoredPanelHeight(previousActivePanel) 1338 : 0; 1339 1340 const reserveHeight = ownStoredHeight || previousHeight; 1341 1342 if (reserveHeight > 0) { 1343 setTemporaryMinHeight(activePanel, reserveHeight); 1344 } 1345 1346 refreshIframesInPanel(activePanel); 1347 refreshNestedTabsets(activePanel); 1348 updatePanelHeightLater(activePanel); 1349 clearTemporaryMinHeight(activePanel, CFG.minHeightClearDelay); 1350 } 1351 } 1352 1353 function getFirstVisibleIndex(tabset) { 1354 const headItems = getHeadItems(tabset); 1355 const tabs = getTabs(tabset); 1356 const panels = getPanels(tabset); 1357 const pairCount = Math.min(headItems.length, tabs.length, panels.length); 1358 1359 for (let i = 0; i < pairCount; i++) { 1360 if ( 1361 !headItems[i].hidden && 1362 tabs[i].getAttribute("aria-disabled") !== "true" && 1363 !panels[i].classList.contains("is-hidden-empty") 1364 ) { 1365 return i; 1366 } 1367 } 1368 1369 return -1; 1370 } 1371 1372 // -------------------------------------------------- 1373 // Setup one tabset 1374 // -------------------------------------------------- 1375 function setupTabset(tabset) { 1376 const header = getHeader(tabset); 1377 const contents = getContents(tabset); 1378 1379 if (!header || !contents) return; 1380 1381 ensureTabsetLabel(tabset); 1382 ensureIdsAndRelations(tabset); 1383 hideEmptyPairs(tabset); 1384 1385 const panels = getPanels(tabset); 1386 panels.forEach((panel) => { 1387 const cached = loadPanelHeightFromSession(panel); 1388 if (cached > 0 && !panel.dataset.lastHeight) { 1389 panel.dataset.lastHeight = String(cached); 1390 } 1391 }); 1392 1393 const startIndex = getFirstVisibleIndex(tabset); 1394 1395 if (startIndex >= 0) { 1396 header.hidden = false; 1397 contents.hidden = false; 1398 tabset.classList.remove("is-empty"); 1399 activateTab(tabset, startIndex, false); 1400 } else { 1401 header.hidden = true; 1402 contents.hidden = true; 1403 tabset.classList.add("is-empty"); 1404 } 1405 } 1406 1407 // -------------------------------------------------- 1408 // Events 1409 // -------------------------------------------------- 1410 function bindTabset(tabset) { 1411 const header = getHeader(tabset); 1412 if (!header || header.dataset.tabsBound === "1") return; 1413 1414 header.dataset.tabsBound = "1"; 1415 1416 header.addEventListener("click", function (e) { 1417 const tab = e.target.closest(CFG.tabSel); 1418 if (!tab || !header.contains(tab)) return; 1419 1420 e.preventDefault(); 1421 1422 if (tab.getAttribute("aria-disabled") === "true") return; 1423 1424 const tabs = getTabs(tabset); 1425 const index = tabs.indexOf(tab); 1426 if (index === -1) return; 1427 1428 activateTab(tabset, index, true); 1429 }); 1430 1431 header.addEventListener("keydown", function (e) { 1432 const currentTab = e.target.closest(CFG.tabSel); 1433 if (!currentTab || !header.contains(currentTab)) return; 1434 1435 const tabs = getTabs(tabset).filter((tab) => { 1436 const item = tab.closest(".tpl_div_element"); 1437 return ( 1438 tab.getAttribute("aria-disabled") !== "true" && 1439 item && 1440 !item.hidden 1441 ); 1442 }); 1443 1444 const currentIndex = tabs.indexOf(currentTab); 1445 if (currentIndex === -1) return; 1446 1447 switch (e.key) { 1448 case "ArrowLeft": 1449 case "Left": 1450 e.preventDefault(); 1451 tabs[currentIndex === 0 ? tabs.length - 1 : currentIndex - 1].focus({ preventScroll: true }); 1452 break; 1453 1454 case "ArrowRight": 1455 case "Right": 1456 e.preventDefault(); 1457 tabs[currentIndex === tabs.length - 1 ? 0 : currentIndex + 1].focus({ preventScroll: true }); 1458 break; 1459 1460 case "Home": 1461 e.preventDefault(); 1462 tabs[0].focus({ preventScroll: true }); 1463 break; 1464 1465 case "End": 1466 e.preventDefault(); 1467 tabs[tabs.length - 1].focus({ preventScroll: true }); 1468 break; 1469 1470 case "Enter": 1471 case " ": 1472 e.preventDefault(); 1473 currentTab.click(); 1474 break; 1475 } 1476 }); 1477 } 1478 1479 // -------------------------------------------------- 1480 // Public init 1481 // -------------------------------------------------- 1482 function initTabsAll(scope = document) { 1483 const tabsets = $$(CFG.setSel, scope); 1484
1485 tabsets.forEach((tabset) => { 1486 setupTabset(tabset); 1487 bindTabset(tabset); 1488 }); 1489 1490 // Warm-up nach Setup/Binding anstoÃen 1491 if (CFG.warmupEnabled) { 1492 tabsets.forEach((tabset) => { 1493 warmupTabsetIframes(tabset); 1494 }); 1495 } 1496 } 1497 1498 window.initTabsAll = initTabsAll; 1499 1500 // -------------------------------------------------- 1501 // Auto init 1502 // -------------------------------------------------- 1503 function startTabs() { 1504 initTabsAll(); 1505 } 1506 1507 if (document.readyState === "loading") { 1508 document.addEventListener("DOMContentLoaded", startTabs); 1509 } else { 1510 startTabs(); 1511 } 1512 1513 // -------------------------------------------------- 1514 // Observe new tabsets 1515 // -------------------------------------------------- 1516 const observeNewTabsets = debounce(() => { 1517 initTabsAll(); 1518 }, 80); 1519 1520 const observer = new MutationObserver((mutations) => { 1521 for (const mutation of mutations) { 1522 if (!mutation.addedNodes || !mutation.addedNodes.length) continue; 1523 1524 for (const node of mutation.addedNodes) { 1525 if (!(node instanceof Element)) continue; 1526 1527 if ( 1528 node.matches?.(CFG.setSel) || 1529 node.querySelector?.(CFG.setSel) 1530 ) { 1531 observeNewTabsets(); 1532 return; 1533 } 1534 } 1535 } 1536 }); 1537 1538 if (document.body) { 1539 observer.observe(document.body, { 1540 childList: true, 1541 subtree: true 1542 }); 1543 } else { 1544 window.addEventListener("DOMContentLoaded", function () { 1545 observer.observe(document.body, { 1546 childList: true, 1547 subtree: true 1548 }); 1549 }); 1550 } 1551})();
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.