1/* 2 * Default JavaScript Library v1.0 3 * 4 * @name $Id: common.js 5 * @domain: brunni.ch 6 * 7 * @author Martin Melheritz [email protected] 8 * 9 * @date created 15/05/2025 10 * @last modified 15/05/2025 11 * @copyright Copyright (C) 2017 artasio AG 12 * 13 * This is a commercial software product, please visit http://artasio.com for more information. 14 */ 15 16function openInfoWindow (url) { 17 var screen_width, screen_height; 18 var win_top, win_left; 19 var InfoWindow; 20 21 screen_height = 0; screen_width = 0; 22 win_top = 0; win_left = 0; 23 24 var help_win_width = 650; 25 var help_win_height = 650; 26 27 if (window.innerWidth) screen_width = window.innerWidth; 28 if (window.innerHeight) screen_height = window.innerHeight; 29 30 win_top = screen_height - help_win_height - 20; 31 win_left = screen_width - help_win_width - 20; 32 InfoWindow = window.open( 33 url, 34 'Drucken', 35 'width='+help_win_width+',height='+help_win_height+',top='+win_top+',left='+win_left+',scrollbars=yes,menubar=no' 36 ); 37 InfoWindow.focus(); 38} 39 40/* 41 * Image gallery click event. Add a trigger event to the actual click event in browsers that don't let you 42 * click() directly. 43 */ 44if(typeof HTMLElement!='undefined'&&!HTMLElement.prototype.click) { 45 HTMLElement.prototype.click=function() { 46 var evt = this.ownerDocument.createEvent('MouseEvents'); 47 evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null); 48 this.dispatchEvent(evt); 49 } 50} 51 52/* Encrypt mailto: links */ 53function UnCryptMailto(s){ 54 var n = 0; 55 var r = ""; 56 for( var i = 0; i < s.length; i++){ 57 n = s.charCodeAt( i ); 58 if( n >= 8364 ){ 59 n = 128; 60 } 61 r += String.fromCharCode( n - 1 ); 62 } 63 return r; 64} 65function linkTo_UnCryptMailto(s){ 66 location.href=UnCryptMailto(s); 67} 68 69var windowWidth; 70 71$(document).ready(function() { 72 73 windowWidth = $(window).width(); 74 75 $('#scroll-highlights, span#scroll-highlights-title').click(function(){ 76 77 //Desktop
78 var h = 110; //.bar-header height (180) - .bar-header small height (90) 79 80 81 if( $('#mobile-indicator').is(':visible') ){ 82 h = 110 + 35; 83 } 84 85 $('html, body').animate({ 86 scrollTop: $("#events").offset().top - $('.bar-header').height() + h - 35 /*$(window).height() - $('.bar-header').height() + h*/ 87 }, 1000); 88 89 }); 90 91 //Toggle navigation for mobile devices 92 $('.mobile-nav-btn').click(function() { 93 toggle_nav(); 94 }); 95 96 //Close navigation for mobile devices 97 $('#nav-hide').click(function() { 98 toggle_nav(); 99 }); 100 101 102 //Toggle subnavigation on mobile devices 103 $('.mobile-subnav-btn').click(function() { 104 toggle_subnavigation($(this)); 105 }); 106 $('.mobile-sub-subnav-btn').click(function() { 107 toggle_subnavigation($(this)); 108 }); 109 110 //On first menu level open at first subnavigation on mobile devices 111 $('.nav-left').click(function() { 112 113 var nav_lang = ($(this).parent().parent().parent().attr('class') == "wrap-language-nav") ? true : false; 114 115 if(nav_lang == true){ 116 toggle_subnavigation($(this).parent().find('.mobile-subnav-btn')); 117 return false; 118 }else{ 119 120 if($('.wrap-body').css('min-width') != '1240px' && $(this).parent().find('.mobile-subnav-btn').length > 0 ){ 121 122 var obj_btn = $(this).parent().find('.mobile-subnav-btn'); 123 124 //Get action 125 var action = (obj_btn.css('background-position') == '0px 0px') ? 'open' : 'close'; 126 if(action == "open"){ 127 toggle_subnavigation(obj_btn); 128 return false; 129 }else{ 130 return true; 131 } 132 }else{ 133 return true; 134 } 135 } 136 }); 137 138 //On submenu level open at first subnavigation on mobile devices 139 $('.nav-left-sublevel').click(function() { 140 if($('.wrap-body').css('min-width') != '1240px' && $(this).parent().find('.mobile-sub-subnav-btn').length > 0 ){ 141 142 var obj_btn = $(this).parent().find('.mobile-sub-subnav-btn'); 143 144 //Get action 145 var action = (obj_btn.css('background-position') == '0px 0px') ? 'open' : 'close'; 146 if(action == "open"){ 147 toggle_subnavigation(obj_btn); 148 return false; 149 }else{ 150 return true; 151 } 152 }else{ 153 return true; 154 } 155 }); 156 157 //Scroll to top 158 $('#scroll_top').click(function() { 159 $("html, body").animate({ scrollTop: 0 }, 300); 160 return false; 161 }); 162 163 164 //Prevent internal links in iOS standalone web apps from opening in Mobile Safari 165 if (window.navigator.standalone) { 166 var local = document.domain; 167 $('a').click(function() { 168 var a = $(this).attr('href'); 169 if ( a.match('http://' + local) || a.match('http://www.' + local) ){ 170 event.preventDefault(); 171 document.location.href = a; 172 } 173 }); 174 } 175 176 highlights_welcome_height(); //On welcome page ajust layer hight. 177 //showSize(); 178 get_el_with(); //Save initial elemnt with 179 setContentBox(); //Adjust content area 180 setFooterHight(); //set footer hight 181}); 182 183$(window).resize(function() { 184 185 if ($(window).width() != windowWidth) { 186 187 // Update the window width for next time 188 windowWidth = $(window).width(); 189 190 if(is_resized == true){ 191 if( !$('#mobile-indicator').is(':visible') ){ 192 scroll_top(); 193 } //Scroll to top and reset responsive design 194 }else{ 195 is_resized = true; 196 } 197 198 if( $("#xl-gallery").is(":visible") ){ 199 $("#xl-gallery").backstretch("resize"); 200 }else{ 201 highlights_welcome_height(); //Set highlight element height 202 setContentBox(function(){}); //Adjust content area 203 setFooterHight() 204 } 205 //showSize(); 206 } 207}); 208 209 210function showSize() { 211 $('#size').html('WIDTH : '+$('.wrap-body').width()); 212} 213 214//Save initial elemnt with 215function get_el_with(){ 216 217 var index = 0; 218 219 $('.wrap-content-cols-2').each(function(){ 220 for(var i = 1; i < 3; i++){ 221 $('.wrap-content-cols-2 .col-content-'+i).each(function(){ 222 content_cols_2_with[index] = $(this)[0].style.width; 223 index++; 224 }); 225 } 226 }); 227 228 index = 0; 229 $('.wrap-content-cols-3').each(function(){ 230 for(var i = 1; i < 4; i++){ 231 $('.wrap-content-cols-3 .col-content-'+i).each(function(){ 232 content_cols_3_with[index] = $(this)[0].style.width; 233 index++; 234 }); 235 } 236 }); 237 238 index = 0; 239 $('.wrap-content-cols-4').each(function(){ 240 for(var i = 1; i < 5; i++){ 241 $('.wrap-content-cols-4 .col-content-'+i).each(function(){ 242 content_cols_4_with[index] = $(this)[0].style.width; 243 index++; 244 }); 245 } 246 }); 247 248 index = 0; 249 $('.wrap-content-cols-5').each(function(){ 250 for(var i = 1; i < 6; i++){ 251 $('.wrap-content-cols-5 .col-content-'+i).each(function(){ 252 content_cols_5_with[index] = $(this)[0].style.width; 253 index++; 254 }); 255 } 256 }); 257} 258 259//Adjust content area 260var setContentBox = function(callback){ 261 262 var windowWidth = $('.wrap-body').width(); 263 var index = 0; 264 265 $('.wrap-content-cols-2').each(function(){ 266 for(var i = 1; i < 3; i++){ 267 $('.wrap-content-cols-2 .col-content-'+i).each(function(){ 268 if(windowWidth <= 740){ 269 $(this).css('width', '100%'); 270 }else{ 271 $(this).css('width', content_cols_2_with[index]); 272 } 273 index++; 274 }); 275 } 276 }); 277 278 index = 0; 279 $('.wrap-content-cols-3').each(function(){ 280 for(var i = 1; i < 4; i++){ 281 $('.wrap-content-cols-3 .col-content-'+i).each(function(){ 282 if(windowWidth <= 800){ 283 $(this).css('width', '100%'); 284 }else{ 285 $(this).css('width', content_cols_3_with[index]); 286 } 287 index++; 288 }); 289 } 290 }); 291 292 index = 0; 293 $('.wrap-content-cols-4').each(function(){ 294 for(var i = 1; i < 5; i++){ 295 $('.wrap-content-cols-4 .col-content-'+i).each(function(){ 296 if(windowWidth <= 740){ 297 $(this).css('width', '100%'); 298 }else if(windowWidth > 740 && windowWidth < 800){ 299 if(i == 1 || i == 3){ 300 sum = parseInt(content_cols_4_with[index]) + parseInt(content_cols_4_with[index+1]); 301 }else{ 302 sum = parseInt(content_cols_4_with[index]) + parseInt(content_cols_4_with[index-1]); 303 } 304 305 w = Math.floor(parseInt(content_cols_4_with[index])*100/sum*(100-sum)/100) + parseInt(content_cols_4_with[index]); 306 $(this).css('width', w + '%'); 307 308 }else{ 309 $(this).css('width', content_cols_4_with[index]); 310 } 311 index++; 312 }); 313 } 314 }); 315 316 index = 0; 317 $('.wrap-content-cols-5').each(function(){ 318 for(var i = 1; i < 6; i++){ 319 $('.wrap-content-cols-5 .col-content-'+i).each(function(){ 320 if(windowWidth <= 800){ 321 $(this).css('width', '100%'); 322 }else{ 323 $(this).css('width', content_cols_5_with[index]); 324 } 325 index++; 326 }); 327 } 328 }); 329 330 if(typeof callback == "function"){ 331 callback(); 332 } 333} 334 335//Toggle navigation 336function toggle_nav(){ 337 338 is_resized = false; 339 340 //if( $("#wrap-navigation").is(":visible") ){ 341 if( $("#wrap-navigation").css('opacity') != 0 ){ 342 343 hide_nav_test(500); 344 }else{ 345 346 show_nav_test(500); 347 } 348} 349 350//Hide navigation 351function hide_nav(speed){ 352 353/* $('.wrap-left-nav-level2').css({'overflow':'hidden', 'white-space': 'nowrap'}); 354 $('.left-nav-level2-bgcolor').css({'overflow':'hidden', 'white-space': 'nowrap'}); 355 $('.wrap-left-nav-level3').css({'overflow':'hidden', 'white-space': 'nowrap'}); 356 $('.left-nav-level3-bgcolor').css({'overflow':'hidden', 'white-space': 'nowrap'});*/ 357 358 //$('#wrap-navigation').animate({left: '-100%'}, speed, function(){ 359 $(".mobile-nav-btn").removeClass("nav-btn-rotate"); 360 $('#wrap-navigation').fadeTo(speed,0,"linear",function(){ 361 362 $("#wrap-navigation").animate({ scrollTop: 0 }, 0, function(){ 363 $(this).css({'right': '-100%'}) 364 //$(this).hide(); 365 unlockScroll(); 366 //$('.mobile-nav-btn').css({'background-position': 'left top'}); 367 }); 368 });
369 370} 371 372function show_nav_test(speed){ 373 374 $('.bar-header-navigation-all').hide(); 375 $('.bar-header-navigation-reduced').hide(); 376 377 if( $('body').hasClass('down') != true ){ 378 if( $(document).scrollTop() <= parseInt( $('.bar-header.animateIt').css('height'), 10) ){ 379 $(window).scrollTop(0); 380 } 381 } 382 383 var t = 90; 384 385 if( $('body').hasClass('down') != true ){ 386 387 t = 200; 388 389 if( $('#mobile-indicator').is(':visible') ){ 390 t = $('.bar-header-navigation-all').height(); 391 } 392 393 var el = ".bar-header-navigation-all"; 394 }else{ 395 var el = ".bar-header-navigation-reduced"; 396 } 397 398 $('.wrap-navigation').css({'top': t + 'px', 'right': 0}); 399 400 $(".mobile-nav-btn").addClass("nav-btn-rotate"); 401 402 $(el).fadeTo(speed,1,"linear",function(){}); 403 $('#wrap-navigation').fadeTo(speed,1,"linear",function(){ 404 lockScroll_test(); 405 }); 406} 407 408function lockScroll_test(){ 409 410 $html = $('html'); 411 $body = $('body'); 412 413 var scrollPosition = [ 414 self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, 415 self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop 416 ]; 417 418 $html.data('scroll-position', scrollPosition); 419 $html.data('previous-overflow', $html.css('overflow')); 420 $body.data('previous-overflow', $html.css('overflow')); 421 422 if( $('#mobile-indicator').is(':visible') ){ 423 424 $html.css('overflow', 'hidden'); 425 $body.css('overflow', 'hidden'); 426 427 428 $html.data('bar-header', $('.bar-header.animateIt').css('transition-duration')); 429 $html.data('bar-header-animateIt', $('body.down .bar-header.animateIt').css('transition-duration')); 430 431 $('.bar-header.animateIt').css('transition-duration','0s'); 432 $('body.down .bar-header.animateIt').css('transition-duration','0s'); 433 434 }else{ 435 $body.css('overflow', 'hidden'); 436 } 437 438} 439 440//Hide navigation 441function hide_nav_test(speed){ 442 443 $(".mobile-nav-btn").removeClass("nav-btn-rotate"); 444 445 unlockScroll_test(); 446 447 $('#wrap-navigation, .bar-header-navigation-all, .bar-header-navigation-reduced').fadeTo(speed,0,"linear",function(){ 448 449 $("#wrap-navigation").animate({ scrollTop: 0 }, 0, function(){ 450 $(this).css({'right': '-100%'}); 451 452 $('.bar-header-navigation-all').hide(); 453 $('.bar-header-navigation-reduced').hide(); 454 }); 455 }); 456 457} 458 459function unlockScroll_test() { 460 461 $html = $('html'); 462 $body = $('body'); 463 464 if ( $html.data('scroll-position') !== undefined ) { 465 466 if ($('#mobile-indicator').is(':visible')) { 467 468 $html.css('overflow', $html.data('previous-overflow')); 469 $body.css('overflow', $html.data('previous-overflow')); 470 471 } else { 472 $body.css('overflow', $html.data('previous-overflow')); 473 } 474 475 var scrollPosition = $html.data('scroll-position'); 476 477 window.scrollTo(scrollPosition[0], scrollPosition[1]); 478 479 $html.removeData('scroll-position'); 480 481 setTimeout(function(){ 482 $('.bar-header.animateIt').css('transition-duration',$html.data('bar-header')); 483 $('body.down .bar-header.animateIt').css('transition-duration',$html.data('bar-header-animateIt'));}, 500 484 ); 485 486 } 487} 488 489//Show navigation 490function show_nav(speed){ 491 492 var t = parseInt($('.bar-header').css('height'), 10); 493 494 if( $('body').hasClass('down') != true ){ 495/* if( $('#mobile-indicator').is(':visible') ){ 496 t = 140; 497 }*/ 498 if( $('#mobile-indicator').is(':visible') && $(document).scrollTop() <= parseInt( $('.bar-header.animateIt').css('height'), 10) ){ 499 $(window).scrollTop(0); 500 } 501 t = t - $(document).scrollTop() 502 }else{ 503 t = (parseInt( $('.bar-header.animateIt').css('height'), 10)) - (parseInt( $('.bar-header.animateIt').css('top'), 10) * -1 ); 504 } 505 506 $('.wrap-navigation').css({'top': t + 'px', 'right': 0}); 507 508 //var w = '320px'; 509 //if($('.mobile-nav-btn').css('left') == '5px'){ 510 //w = '100%'; 511 //} 512 513 //$('#wrap-navigation').css({'width':'0'}); 514 515 //$('#wrap-navigation').show().animate({left: '0px'}, speed, function(){ 516 $(".mobile-nav-btn").addClass("nav-btn-rotate"); 517 $('#wrap-navigation').fadeTo(speed,1,"linear",function(){ 518/* $('.wrap-left-nav-level2').css({'overflow':'', 'white-space': ''}); 519 $('.left-nav-level2-bgcolor').css({'overflow':'', 'white-space': ''}); 520 $('.wrap-left-nav-level3').css({'overflow':'', 'white-space': ''}); 521 $('.left-nav-level3-bgcolor').css({'overflow':'', 'white-space': ''});*/ 522 523 lockScroll(); 524 //$('.mobile-nav-btn').css({'background-position': 'left bottom'}); 525 }); 526 527} 528 529function highlights_welcome_height(){ 530 531 if($('#highlights-welcome-placeholder').length){ 532 var wh = $(window).height(); 533 var hh = wh - $('.bar-header').height(); 534 $('#highlights-welcome-placeholder').css({'height':hh+'px'}); 535 /*$("#highlights-welcome-inner").backstretch("resize");*/ 536 } 537} 538 539function animate_header(){ 540 541 var h = $('.bar-header').height();
542 $("body").toggleClass("down", ($(window).scrollTop() > h)); 543} 544 545function scroll_top() { 546 /*$(window).scrollTop(0);*/ 547 hide_nav(0); 548} 549 550//Toggle subnavigation on mobile devices 551function toggle_subnavigation(obj){ 552 553 var class_array = obj.parent().find('div:first').attr('class').split(/\s+/); 554 class_array = class_array[1].split('_'); 555 556 var menu_level = class_array[0]; 557 var array_index = menu_level; 558 var el_level = array_index; 559 el_level++; 560 561 //Get action 562 var action = (obj.css('background-position') == '0px 0px') ? 'open' : 'close'; 563 564 //Array to loop trough elements 565 var nav_level_array = new Array("", "-margin"); 566 567 //Close all previous opened menus 568 if(menu_level == 1){ 569 $('.left-nav-level1-bg').css({'background-color':' transparent'}); 570 $('.wrap-left-nav-level1-margin').css({'background-color':' transparent'}); 571 } 572 for (var n=4; n>=1; n--) { 573 if( n>= menu_level ){ 574 $('.left-nav-level'+n+'-bg .mobile-subnav-btn').css({'background-position':'0px 0px'}); 575 $('.left-nav-level'+n+'-bg .mobile-sub-subnav-btn').css({'background-position':'0px 0px'}); 576 } 577 } 578 579 for (var n=2; n<6; n++) { 580 for (var i=0; i<nav_level_array.length; i++) { 581 if(n>=el_level){ 582 $('.wrap-left-nav-level' + n + nav_level_array[i]).each(function(i, obj) { 583 584 $(this).slideUp('fast', function(){}); 585 }); 586 } 587 } 588 } 589 590 591 //Switch image 592 if(action == "open"){ 593 if(menu_level == 1){ 594 obj.parent().parent().css({'background-color':'transparent'}); 595 } 596 if(menu_level == 1){ 597 obj.css({'background-position':'0px 50px'}); 598 }else if(menu_level > 1){ 599 obj.css({'background-position':'0px 37px'}); 600 } 601 }else{ 602 if(menu_level == 1){ 603 obj.parent().css({'background-color':'transparent'}); 604 obj.parent().parent().css({'background-color':'transparent'}); 605 } 606 obj.css({'background-position':'0px 0px'}); 607 } 608 609 610 for (var i=0; i<nav_level_array.length; i++) { 611 612 $('.wrap-left-nav-level' + el_level + nav_level_array[i]).each(function(i, obj) { 613 614 var el_array = $(this).find('div:first').attr('class').split(/\s+/); 615 616 el_array = el_array[1].split('_'); 617 618 if(class_array[array_index] == el_array[array_index]){ 619 if(action == "open"){ 620 $(this).slideDown('fast', function(){}); 621 }else{ 622 $(this).slideUp('fast', function(){}); 623 } 624 } 625 }); 626 } 627 628 last_accessed_nav[0] = obj; 629 last_accessed_nav[1] = menu_level; 630} 631 632function lockScroll(){ 633 634 $html = $('html'); 635 $body = $('body'); 636 637 var scrollPosition = [ 638 self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, 639 self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop 640 ]; 641 642 $html.data('scroll-position', scrollPosition); 643 $html.data('previous-overflow', $html.css('overflow')); 644 $body.data('previous-overflow', $html.css('overflow')); 645 646 647 if( $('#mobile-indicator').is(':visible') ){ 648 649 if( $('body').hasClass('down') ){ 650 651 $html.data('bar-header', $('.bar-header.animateIt').css('transition-duration')); 652 $html.data('bar-header-animateIt', $('body.down .bar-header.animateIt').css('transition-duration')); 653 654 $('.bar-header.animateIt').css('transition-duration','0s'); 655 $('body.down .bar-header.animateIt').css('transition-duration','0s'); 656 657 $('#bar-header-overlay').show(); 658 $('.bar-header').hide(); 659 } 660 setTimeout(function(){ 661 $html.css('overflow', 'hidden'); 662 $body.css('overflow', 'hidden'); }, 500 663 ); 664 }else{ 665 $body.css('overflow', 'hidden'); 666 } 667 668 //window.scrollTo(scrollPosition[0], scrollPosition[1]); 669 670} 671 672function unlockScroll() { 673 674 $html = $('html'); 675 $body = $('body'); 676 677 if ( $html.data('scroll-position') !== undefined ) { 678 679 if ($('#mobile-indicator').is(':visible')) { 680 $html.css('overflow', $html.data('previous-overflow')); 681 $body.css('overflow', $html.data('previous-overflow')); 682 683 } else { 684 $body.css('overflow', $html.data('previous-overflow')); 685 } 686 687 var scrollPosition = $html.data('scroll-position'); 688 689 if ($('#highlights-welcome-placeholder').length) { 690 $("#highlights-welcome-inner").backstretch("resize"); 691 } 692 window.scrollTo(scrollPosition[0], scrollPosition[1]); 693 694 $html.removeData('scroll-position'); 695 696 if( $('#mobile-indicator').is(':visible') ){ 697 if( $('#bar-header-overlay').is(':visible') ){ 698 699 $('#bar-header-overlay').hide(); 700 $('.bar-header').show(); 701 702 setTimeout(function(){ 703 $('.bar-header.animateIt').css('transition-duration',$html.data('bar-header')); 704 $('body.down .bar-header.animateIt').css('transition-duration',$html.data('bar-header-animateIt'));}, 500 705 ); 706 707 708/* $('.bar-header.animateIt').css('transition-delay','.1s'); 709 $('body.down .bar-header.animateIt').css('transition-delay','.5s');*/ 710 } 711 } 712 } 713} 714 715function setFooterHight() { 716 717 var h = $('#wrap-footer').height(); 718 719 $('#wrap-footer').css({'margin-top':h + '-px'}); 720 $('.content-bottom-gap').css({'height':h + 'px!important'}); 721} 722 723function showMoreInfos(classId, id_link_more, id_link_less, id_img, anchor) { 724 725 $('.' + classId).slideToggle('fast', function () { 726 727 var h = 90 //header height +20 728 729 if ($('.' + classId).is(":visible")) { 730 731 $('#' + id_link_more).hide(); 732 $('#' + id_link_less).show(); 733 $('#' + id_img).attr('src', 'daten/elemente/less.png'); 734 if (anchor != "") { 735 $('html,body').animate({ 736 scrollTop: $('#' + anchor).offset().top - h 737 }, 10); 738 } 739 } else { 740 $('#' + id_link_more).show(); 741 $('#' + id_link_less).hide(); 742 $('html,body').animate({ 743 scrollTop: $('#' + id_link_more).offset().top - h 744 }, 10); 745 $('#' + id_img).attr('src', 'daten/elemente/more.png'); 746 } 747 });
vendor: 1 bytes, line 748
748}
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.