1/* 2 Author: Rene Schaub 3 Email: [email protected] 4 Description: KJF MainJS 5 */ 6 7/* ============================= 8 Page Navigation Definitions 9 ============================= */ 10var $page = $("#page"), 11 $pageHeader = $page.find("#header"), 12 pageHeaderHeight = $pageHeader.height(), 13 $pageHeaderWrapper = $("#header .header-wrapper"), 14 pageHeaderWrapperHeight = $pageHeaderWrapper.height(), 15 BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=='; 16 17/* ============================= 18 General Page Events/Bindings 19 ============================= */ 20var Page = { 21 init: function () { 22 Page.bindPageEvents(); 23 Page.bindOGEvents(); 24 Page.bindOnResizeEvents(); 25 26 if ($(window).width() > 750) { 27 var href = location.hash; 28 29 if(href != "#/"){ 30 href = href.replace("%C3%A4", "ä"); 31 href = href.replace("%C3%B6", "ö"); 32 href = href.replace("%C3%BC", "ü"); 33 href = href.replace("%20", " "); 34 href = href.replace("%20", " "); 35 href = href.replace("/", "-"); 36 if ((href) && (typeof $(href).offset() !== 'undefined')) { 37 $('html, body').scrollTop($(href).offset().top - pageHeaderWrapperHeight); 38 this.showFixedNavigation(); 39 } 40 } 41 } 42 43 if ($(document).width() < 960) { 44 Page.checkCarousel(); 45 } 46 47 if($('#jugendmedizinboxes').length){ $('#jugendmedizinboxes .custom-class-1').not($('#jugendmedizinboxes .custom-class-1').first()).shuffle(); } 48 49 50 }, bindPageEvents: function () { 51 /* =============================
52 Effects 53 ============================= */ 54 55 // add parallax effekt 56 if ($(document).width() > 1024 && $('.parallax').length) { 57 $('.parallax').parallax({ 58 speed: 0.15 59 }); 60 } 61 62 /* ============================= 63 Navigation Events/Controls 64 ============================= */ 65 66 // fix site managemant startseite shortcut 67 $('.navbar.main-left li a, .mobile-main-navigation li a').each(function(e){ 68 if(this.pathname === "/startseite/"){ 69 this.href = "/"; 70 }; 71 }); 72 73 // center main-left subnavigation 74 $(".main-navigation .centered ul.dropdown-menu").each(function () { 75 var parentWidth = $(this).parent().innerWidth(); 76 var menuWidth = $(this).innerWidth(); 77 if ($(this).parent().hasClass('dropdown') && !$(this).parent().position().left > 0) { 78 $(this).parent().addClass('first'); 79 margin = "-35px"; 80 } else { 81 var margin = (parentWidth / 2 ) - (menuWidth / 2); 82 margin = margin + "px"; 83 } 84 $(this).css("margin-left", margin); 85 }); 86 87 // center main-left subnavigation kjf-augsburg.de 88 $(".main-navigation .center ul.dropdown-menu").each(function () { 89 var parentWidth = $(this).parent().innerWidth(); 90 var menuWidth = $(this).innerWidth(); 91 if ($(this).parent().hasClass('dropdown') && !$(this).parent().position().left > 0) { 92 $(this).parent().addClass('first'); 93 margin = "-35px"; 94 } else { 95 var margin = (parentWidth / 2 ) - (menuWidth / 2); 96 margin = margin + "px"; 97 } 98 $(this).css("margin-left", margin); 99 }); 100 101 // open submenu to the left 102 //$(".main-navigation .center .dropdown").last().each(function () { 103 // $(this).children("ul").css({display: "block", visibility: "hidden"}); 104 // $(this).children("ul").find(".dropdown-submenu").each(function () { 105 // var childWidth = $(this).children("ul").width(); 106 // childWidth = "-" + childWidth + "px"; 107 // $(this).children("ul").css("left", childWidth); 108 // }); 109 // $(this).children("ul").css({display: "", visibility: ""}); 110 //}); 111 $("li.dropdown-submenu").on('mouseenter mouseleave', function (e) { 112 if ($('ul', this).length) { 113 var elm = $('ul:first', this); 114 var off = elm.offset(); 115 var l = off.left; 116 var w = elm.width(); 117 var docW = $(".container").width(); 118 119 var isEntirelyVisible = (l + w <= docW); 120 121 if (!isEntirelyVisible) { 122 $('ul', this).css('left','-'+$('ul', this).width()+'px'); 123 } 124 } 125 }); 126 127 // to top button 128 //$(document).on("click", ".to-top", function (e) { 129 // e.preventDefault(); 130 // $('html,body').stop().animate({scrollTop: 0}, 1200, 'swing'); 131 //}); 132 133 // bind scroll to content button 134 $(document).on("click", ".scrollto", function (e) { 135 var anchorSource = $(this).attr('href'); 136 var anchorName = anchorSource.substring(anchorSource.indexOf("#") + 1); 137 138 if ($("#" + anchorName).offset()) { 139 e.preventDefault(); 140 var scrollfix = $('.header-wrapper').outerHeight() - $('#header .main-navigation').outerHeight(); 141 if ($('#mobile-navbar.collapse.in').outerHeight()) { 142 scrollfix = $('#mobile-navbar.collapse.in').outerHeight(); 143 $('#mobile-navbar').collapse('hide'); 144 } 145 $('html,body').stop().animate({scrollTop: $("#" + anchorName).offset().top + 1 - scrollfix}, 1200, 'swing'); 146 } 147 148 }); 149 150 // IE Fallback 151 var ua = window.navigator.userAgent; 152 var msie = ua.indexOf("MSIE "); 153 154 if (msie > 0){ 155 $('input, textarea').placeholder(); 156 } 157 158 // darken content area on mouse over header 159 $(document).on({ 160 mouseenter: function () { 161 $('.dark-overlay').stop().fadeIn(200); 162 }, 163 mouseleave: function () { 164 $('.dark-overlay').stop().fadeOut(200); 165 } 166 }, "#header .main-navigation .dropdown"); 167 168 // darken content area on dropdown mobile menu 169 $(".mobile-menu .collapse").on("show.bs.collapse", function () { 170 $('.dark-overlay').fadeIn(); 171 $('[data-target=#' + $(this).attr('id') + ']').addClass('active'); 172 }); 173 $(".mobile-menu .collapse").on("hide.bs.collapse", function () { 174 $('.dark-overlay').fadeOut(); 175 $('[data-target=#' + $(this).attr('id') + ']').removeClass('active'); 176 }); 177 178 // toggle caret on mobile menu 179 $('.mobile-menu .mobile-main-navigation').on('activate.smapi', function (e, item) { 180 $(item).find('span.caret').removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up"); 181 }); 182 $('.mobile-menu .mobile-main-navigation').on('hide.smapi', function (e, item) { 183 $(item).parent().find('span.caret').addClass("glyphicon-chevron-down").removeClass("glyphicon-chevron-up"); 184 }); 185 186 // fix to remove dark overlay on backbutton mobile landscape
187 if($(".dark-overlay").length){ 188 $(".dark-overlay").click(function(){ 189 $(this).css({display: "none", opacity: "1"}); 190 }); 191 } 192 193 /* ============================= 194 Stage Headline Margin-Top 195 ============================= */ 196 197 $(window).on('load',function(){ 198 if($(document).width() >= 960) { 199 Page.setStageHeadlineMargin(); 200 } 201 }); 202 203 /* ============================= 204 Breadcrumb Margin-Top 205 ============================= */ 206 207 if (document.getElementById("stage") == null) { 208 $(".breadcrumb").css({"margin-top": "140px"}) 209 } 210 211 /* ============================= 212 Hide News Button 213 ============================= */ 214 215 if($('.news').length){ 216 if($('.news-list-view').children().length == 1){ 217 if($('.news-list-view').children().children().length == 1){ 218 $('.text-right').css("visibility","hidden"); 219 } 220 } 221 } 222 223 /* ============================= 224 Video Lightbox stop on click 225 ============================= */ 226 227 $(".videoModal").on('hidden.bs.modal', function () { 228 $(this).find("iframe").attr("src", $(this).find("iframe").attr("src")); 229 }); 230 231 /* ============================= 232 Akkordions - add padding to img if text gets long 233 ============================= */ 234 $(window).on("resize", function () { 235 $(".institution-configurator-category").each(function () { 236 if ($(this).height() > 27) { 237 $(this).parent().siblings().children("img").css("padding-top", "25px"); 238 } else { 239 $(this).parent().siblings().children("img").css("padding-top", "15px"); 240 } 241 }); 242 243 $(".school-configurator-category").each(function () { 244 if ($(this).height() > 27) { 245 $(this).parent().siblings().children("img").css("padding-top", "25px"); 246 } else { 247 $(this).parent().siblings().children("img").css("padding-top", "15px"); 248 } 249 }); 250 }).resize(); 251 252 /* ============================= 253 text / image element resize function 254 ============================= */ 255 256 function resizeFunction() { 257 258 // big text / image element 259 var bigElement = $(".container-fluid .col-md-push-12 .frame-default .image-embed-item"); 260 if (bigElement.length) { 261 if ($(document).width() > 1920) { 262 bigElement.parent().parent().css({ 263 "max-height": "500px" 264 }); 265 } else if ($(document).width() < 1920 && $(document).width() > 960) { 266 bigElement.parent().parent().css({ 267 "max-height": bigElement.closest(".col-xs-24").siblings().height() 268 }); 269 } else { 270 bigElement.parent().parent().css({ 271 "max-height": "500px" 272 }); 273 } 274 } 275 276 // big text / image element id fluidimage 277 var bigElementFluid = $("#fluidimage .container-fluid .frame-default .image-embed-item"); 278 if (bigElementFluid.length) { 279 if ($(document).width() > 1920) { 280 bigElementFluid.parent().parent().css({ 281 "max-height": "500px" 282 }); 283 } else if ($(document).width() < 1920 && $(document).width() > 960) { 284 bigElementFluid.parent().parent().css({ 285 "max-height": bigElementFluid.closest(".col-xs-24").siblings().height() 286 }); 287 } else { 288 bigElementFluid.parent().parent().css({ 289 "max-height": "500px" 290 }); 291 } 292 } 293 294 if ($(".box-white .img-contain figure.image").length) { 295 // small text / image element 296 $(".box-white .img-contain .ce-column").each(function () { 297 298 if ($(document).width() > 960) { 299 300 if ($(this).height() > $(this).closest(".col-md-12").siblings().height()) { 301 $(this).closest(".col-md-12").siblings().css({ 302 "margin-top": ($(this).height() - $(this).closest(".col-md-12").siblings().height()) / 2 - 13 303 }); 304 305 $(this).css({ 306 "margin-top": 0 307 }); 308 309 } else { 310 $(this).closest(".col-md-12").siblings().css({ 311 "margin-top": 0 312 }); 313 314 $(this).css({ 315 "margin-top": ($(this).closest(".col-md-12").siblings().height() - $(this).height()) / 2 316 }); 317 } 318 } else { 319 $(this).closest(".col-md-12").siblings().css({ 320 "margin-top": 0 321 }); 322 323 $(this).css({ 324 "margin-top": 0 325 }); 326 } 327 }); 328 } 329 } 330 331 $(window).on("load", function () { 332 333 resizeFunction(); 334 335 // equalheight for single elements like 3 spaltig / 4 spaltig 336 var itemHeight = 0; 337 338 $(".equal-height").each(function () { 339 340 var boxheight = 0; 341 $(this).find('.custom-class-1').each(function(){ 342 if(boxheight < $(this).outerHeight()){ 343 boxheight = $(this).outerHeight(); 344 } 345 }); 346 if(boxheight != 0){ 347 $(this).find('.custom-class-1').each(function(){ 348 if(boxheight > $(this).outerHeight()){ 349 var str = window.location.host; 350 if(str.split('josefinum').length == 2 || str.split('sankt-elisabeth-klinik').length == 2){ 351 $(this).find('.ce-bodytext').children().last(
351).css('padding-top',boxheight-$(this).outerHeight()+'px'); 352 } else { 353 $(this).children().last().css('padding-bottom',boxheight-$(this).outerHeight()+'px'); 354 } 355 } 356 }) 357 } 358 359 itemHeight = 0; 360 $(this).children().each(function () { 361 362 if (itemHeight == 0) { 363 itemHeight = $(this).height(); 364 } else { 365 if (itemHeight < $(this).height()) { 366 itemHeight = $(this).height(); 367 } 368 } 369 }); 370 371 // all children 372 $(this).children().each(function () { 373 374 var elem = $(this).children(); 375 var lastElem = ""; 376 377 if (itemHeight != $(this).height() && elem.length != 0) { 378 379 if (elem.last()[0].localName != "div") { 380 elem.last().css({ 381 "margin-top": itemHeight - $(this).height() + 13 382 }); 383 } else { 384 lastElem = elem.children(); 385 if (lastElem.last()[0].localName != "div" && !$(".equal-height").find("a").length) { 386 lastElem.last().css({ 387 "margin-bottom": itemHeight - $(this).height() + 13 388 }); 389 } else { 390 391 if ($(".news-event-item").length) { 392 if ($(this).find("a").last().css("margin-top")) { 393 var topMargin = $(this).find("a").last().css("margin-top").split("px"); 394 395 $(this).find("a").last().css({ 396 "margin-top": itemHeight - $(this).height() + parseInt(topMargin[0]) + 13 397 }); 398 } 399 } else { 400 if ($(this).find("a").last().css("margin-top")) { 401 var topMargin = $(this).find("a").last().css("margin-top").split("px"); 402 403 $(this).find("a").last().css({ 404 "margin-top": itemHeight - $(this).height() + parseInt(topMargin[0]) 405 }); 406 } 407 } 408 } 409 } 410 } 411 }); 412 413 // dropdown children 414 itemHeight = 0; 415 $(this).find(".shortdescription").each(function () { 416 //console.log("short"); 417 if (itemHeight == 0) { 418 itemHeight = $(this).height(); 419 } else { 420 if (itemHeight < $(this).height()) { 421 itemHeight = $(this).height(); 422 } 423 } 424 $(this).css({ 425 "margin-bottom": itemHeight - $(this).height() 426 }); 427 }); 428 }); 429 430 // video: set default img if there is no high res img 431 $("img[data-toggle='modal']").each(function () { 432 if ($(this).width() == 120 && $(this).height() == 90) { 433 var splitImg = $(this).attr("src").split("/"); 434 var sSrc = ""; 435 436 for (var i = 0; i < splitImg.length - 1; i++) { 437 sSrc = sSrc + splitImg[i] + "/"; 438 } 439 440 $(this).attr("src", sSrc + "hqdefault.jpg") 441 } 442 }); 443 }); 444 445 $(window).on("resize", function () { 446 resizeFunction(); 447 }); 448 449 450 // $('form.powermail_form [required=required]').focusout(function(){ 451 // let checkErrors = setInterval(function() { 452 // if ($('[data-powermail-error]').length) { 453 // clearInterval(checkErrors); 454 // $('[data-powermail-error]').each(function(){ 455 // if($(this).find('li').html().split(":").length < 2){ 456 // let label = capitalizeFirstLetter($(this).attr("data-powermail-error").split('tx_powermail_pi1field').pop()); 457 // $(this).find('li').html(label + ": " + $(this).find('li').html()); 458 // } 459 // }); 460 // } 461 // }, 100); 462 // }); 463 464 465 // function capitalizeFirstLetter(string){ 466 // return string.charAt(0).toUpperCase() + string.slice(1); 467 // } 468 469 // powermail error check for scoll to error 470 $('button[type="submit"]').on('click',function(){ 471 472 function scrollToForm(element){ 473 if($(window).width() < 960) { 474 $('html,body').animate({ 475 scrollTop: element.closest('form').offset().top 476 }, 500); 477 }else{ 478 $('html,body').animate({ 479 scrollTop: element.closest('form').offset().top-300 480 }, 500); 481 } 482 } 483 setTimeout(scrollToForm($(this)), 300); 484 }); 485 486 /* ============================= 487 Collapse Scroll mobile 488 ============================= */ 489 490 if($(window).width() < 960){ 491 $('.panel-collapse').on('shown.bs.collapse', function (e) { 492 var $panel = $(this).closest('.panel'); 493 $('html,body').animate({ 494 scrollTop: $panel.offset().top 495 }, 500); 496 }); 497 } 498 499 /* ============================= 500 Bind Scroll Events 501 ============================= */ 502 503 this.bindScrollEvents(); 504 505 /* ============================= 506 Bind Collapsible/Expendable Events 507 ============================= */ 508 509 this.bindCollapseEvents(); 510 511 /* ============================= 512 Bind Carousel options 513 ============================= */ 514 /* IE Fallback */
515 if ($("#stage") && msieversion() && (window.location.host == "dev.kjf-augsburg.de" || window.location.host == "kjf-augsburg.de" || window.location.host == "kjf-augsburg.dev")) { 516 var element = $("#stage img.bootstrap"); 517 element.each(function () { 518 $(this).css("opacity", 0); 519 $(this).parent().css({ 520 "background-image": "url('" + $(this).attr('src') + "')", 521 "background-size": "cover", 522 "background-position": "center center" 523 }) 524 }) 525 } 526 527 if($(".carousel").length){ 528 $(".carousel").swiperight(function() { 529 $(this).carousel('prev'); 530 }); 531 $(".carousel").swipeleft(function() { 532 $(this).carousel('next'); 533 }); 534 } 535 536 /* disabled 537 $('.carousel').on('slide.bs.carousel', function(e) { 538 $(e.relatedTarget).css('visibility','hidden').css('display','block').height(); 539 var nextH = $(e.relatedTarget).height(); 540 $(e.relatedTarget).css('visibility','visible').css('display','none').height(); 541 $(this).find('.active.item').parent().animate({ 542 height: nextH 543 }, 500); 544 }); 545 */ 546 547 /* ============================= 548 Bind Picture Gallery 549 ============================= */ 550 551 this.bindPictureGallery(); 552 553 /* ============================= 554 Bind Single Page Search 555 ============================= */ 556 this.singlePageSearch(); 557 558 /* ============================= 559 Bind Powermail Form Validation 560 ============================= */ 561 this.bindPowermailForm(); 562 563 /* ============================= 564 Bind Image Gallery on News 565 ============================= */ 566 $(document).ready(function(){ 567 if($("div[id^='imgModal']").length){ 568 $("div[id^='imgModal']").each(function(){ 569 570 var currentModal = $(this); 571 572 //click next 573 currentModal.find('.glyphicon-chevron-right').click(function(){ 574 currentModal.one('hidden.bs.modal', function() { 575 if(currentModal.closest("div[id^='imgModal']").nextAll("div[id^='imgModal']").length){ 576 currentModal.closest("div[id^='imgModal']").nextAll("div[id^='imgModal']").first().modal('show'); 577 }else{ 578 currentModal.closest("div[id^='imgModal']").prevAll("div[id^='imgModal']").last().modal('show'); 579 } 580 }).modal('hide'); 581 }); 582 583 //click prev 584 currentModal.find('.glyphicon-chevron-left').click(function(){ 585 currentModal.one('hidden.bs.modal', function() { 586 if(currentModal.closest("div[id^='imgModal']").prevAll("div[id^='imgModal']").length){ 587 currentModal.closest("div[id^='imgModal']").prevAll("div[id^='imgModal']").first().modal('show'); 588 }else{ 589 currentModal.closest("div[id^='imgModal']").nextAll("div[id^='imgModal']").last().modal('show'); 590 } 591 }).modal('hide'); 592 }); 593 594 }); 595 } 596 /*$(window).on("load", function(){ 597 var oldSSB = $.fn.modal.Constructor.prototype.setScrollbar; 598 $.fn.modal.Constructor.prototype.setScrollbar = function () 599 { 600 oldSSB.apply(this); 601 if(this.bodyIsOverflowing && this.scrollbarWidth) 602 { 603 $('.navbar-fixed-top').css('padding-right', this.scrollbarWidth); 604 } 605 } 606 607 var oldRSB = $.fn.modal.Constructor.prototype.resetScrollbar; 608 $.fn.modal.Constructor.prototype.resetScrollbar = function () 609 { 610 oldRSB.apply(this); 611 $('.navbar-fixed-top').css('padding-right', ''); 612 } 613 });*/ 614 }); 615 616 617 /* ============================= 618 Remove empty p tag on job detail page 619 ============================= */ 620 621 if($('.job-detail-page').length >= 1){ 622 $('p').each(function(){ 623 if($(this).html() == " "){$(this).css('display','none')} 624 }) 625 } 626 627 }, bindScrollEvents: function () { 628 /* ============================= 629 Scroll Events 630 ============================= */ 631 $(window).scroll(function () { 632 633 if ($(window).width() > 750) { 634 /* ============================= 635 Navigation 636 ============================= */ 637 Page.showFixedNavigation(); 638 } 639 640 }); 641 }, bindOnResizeEvents: function () { 642 $(window).resize(function () { 643 // update page header height 644 pageHeaderHeight = $pageHeader.height(); 645 pageHeaderWrapperHeight = $pageHeaderWrapper.height(); 646 647 if ($(document).width() < 750) { 648 $pageHeaderWrapper.height('auto'); 649 } else { 650 Page.showFixedNavigation(); 651 } 652 653 // set headline margin-top in stage 654 if($(document).width() > 960) { 655 Page.setStageHeadlineMargin(); 656 } 657 658 if($('.dark-overlay:visible').length){ 659 $('.dark-overlay').fadeOut(); 660 } 661 662 //if($(document).width() < 960) { 663 // $('.carousel').on('slide.bs.carousel', function(e) { 664 // Page.checkCarousel(); 665 // });
666 // 667 //} 668 669 }); 670 }, bindCollapseEvents: function() { 671 672 var $collapsePanel = $('.collapse-panel-group'); 673 674 if ($collapsePanel.length) { 675 $collapsePanel.find('.panel-collapse:not(.in)').addClass('collapse'); 676 $collapsePanel.on('hidden.bs.collapse', toggleButton); 677 $collapsePanel.on('show.bs.collapse', toggleButton); 678 } 679 680 var $expandableInfobox = $('.expandable-infobox'); 681 682 if ($expandableInfobox.length) { 683 $expandableInfobox.find('.text-more.hidden, .btn-more.hidden').removeClass('hidden'); 684 $expandableInfobox.find('.btn-less').addClass('hidden'); 685 $expandableInfobox.find('.panel-expandable').addClass('collapse'); 686 this.bindExpandableInfobox(); 687 } 688 689 }, bindPictureGallery: function () { 690 /* ============================= 691 Picture Gallery 692 ============================= */ 693 694 var $pictureGallery = $('.picture-gallery-container'); 695 if ($pictureGallery.length) { 696 $.each($pictureGallery, function () { 697 var pg = $(this).attr('id').split("-"), 698 pgID = pg[pg.length - 1], 699 pgCategories, pgCategoryItems = ''; 700 701 pgCategories = $(this).find('h2'); 702 pgCategoryItems = '<li class="active"><a href="#" data-pgallery="' + pgID + '" data-category="all">Alle</a></li>'; 703 $.each(pgCategories, function () { 704 pgCategoryItems += '<li><a title="' + $(this).html() + '" data-pgallery="' + $(this).parent().parent().attr('id').substr(1) + '" data-category="' + $(this).parent().parent().attr('id') + '" href="#' + $(this).parent().attr('id') + '">' + $(this).html() + '</a></li>'; 705 }); 706 707 $(this).prepend('<div class="collapse navbar-collapse navbar-center hidden-xs"><ul class="nav navbar-nav picture-gallery-categories">' + pgCategoryItems + '</ul></div>'); 708 // generate an "all" category 709 $(this).find('figure a').attr('rel', 'lightbox[lb' + pgID + ']'); 710 }); 711 } 712 713 /* LIGHTBOX fix */ 714 $('#lbImage').on('stylechanged',function a(){ 715 var url = $('#lbImage').attr('style').split('"')[1]; 716 var path = url.split(window.location.origin).pop(); 717 var fileName = url.split("/").pop(); 718 var element = $('a[href="'+path+'"] img'); 719 var caption = element.attr('title'); 720 721 if(caption == undefined){ 722 caption = ""; 723 } 724 725 setTimeout(function(){ 726 $('#lbCaption').html(caption); 727 },600); 728 }); 729 730 /* lightbox stylechanged */ 731(function () { 732 733 734 735 orig = $.fn.css; 736 $.fn.css = function() { 737 var result = orig.apply(this, arguments); 738 $(this).trigger('stylechanged'); 739 return result; 740 } 741 })(); 742 743 744 745 /* Init Click events */ 746 $(document).on('click', '.picture-gallery-categories a', function (e) { 747 e.preventDefault(); 748 749 var $selectedPictureGallery = $(this).parents().eq(3); 750 var selectedId = $(this).data('category'); 751 var parentGalleryId = $(this).data('pgallery'); 752 753 // remove all active classes of the menu 754 $(this).parent().parent().find('li').removeClass('active'); 755 756 // add active to the current selected item 757 $(this).parent().addClass('active'); 758 759 $.each($selectedPictureGallery, function () { 760 761 if (selectedId == 'all') { 762 // show all pictures for all categories in gallery 763 $(this).find('.csc-default').fadeIn(200); 764 765 // set an global lightbox id for this gallery 766 $(this).find('figure a').attr('rel', 'lightbox[lb' + parentGalleryId + ']'); 767 768 } else { 769 770 // hide all picture for all categories 771 $(this).find('.csc-default').hide(); 772 773 // only show the currently selected category 774 if ($(this).find('#' + selectedId).length) { 775 $(this).find('#' + selectedId).fadeIn(200); 776 777 // reinit lightbox id 778 $(this).find('#' + selectedId).find('figure a').attr('rel', 'lightbox[lb' + selectedId + ']'); 779 } 780 } 781 }); 782 }); 783 784 }, bindOGEvents: function () { 785 /* ============================= 786 Picture Grid with Preview Mode 787 ============================= */ 788 789 // bind grid if needed 790 if ($('#team-grid').length) { 791 792 // on click listener 793 $('#team-grid a.team-filter').on({ 794 'click': function (e) { 795 796 e.preventDefault(); 797 var x = $('ul.nav').children(); // Selects the li's in the Navigation 798 799 // Removes the Active class of the Li's 800 if (x.hasClass("active")) { 801 x.removeClass("active"); 802 } 803
804 // Adds active-class to clicked Li 805 $(this).parent().addClass("active"); 806 807 $('li.all').removeClass("first-up"); 808 809 // Reset last filtering and hids all gird-items 810 $("li.all").hide().removeClass("filtered"); 811 812 // Selects the data-filter attributes value <- It's the category 813 var p = $(this).data("filter"); 814 815 // If data-filter is true -> Select the Li's with the data filter and gives them a filtered class to identifiy by searching 816 if ($("p")) { 817 $("li" + p + "").fadeIn(200).addClass("filtered"); 818 } 819 } 820 }); 821 822 $('#team-grid .team-search-input').on('input', function () { 823 824 // Value of the input field in lowercase 825 var y = $(this).val().toLowerCase(); 826 827 // Function for each Li-Element 828 $('li.all').each(function () { 829 830 // There is the name of the Team-Member which is compared with the search input 831 var x = $(this).find('.mask > .name').text().toLowerCase(); 832 833 // Hide the elements which are not equal with the search 834 if (x.indexOf(y) == -1) { 835 $(this).hide(); 836 } else if (($(this).hasClass("filtered") || $(this).hasClass("first-up"))) { 837 $(this).show(); 838 } 839 840 // If search-input will be cleared show all li's of the category which is filtered 841 if (y.length == 0 && ($(this).hasClass("filtered") || $(this).hasClass("first-up"))) { 842 $(this).show(); 843 } 844 845 }); 846 }); 847 } 848 }, bindExpandableInfobox: function () { 849 $('.expandable-infobox .btn-more').click(function () { 850 if ($(this).find('span').hasClass('active')) { 851 $(this).find('span').removeClass('active'); 852 $(this).parents('.content').find('.text-more').show('fast'); 853 if($(this).html().indexOf('Weniger') >= 0) { 854 $(this).html($(this).html().replace('Weniger', 'Mehr')); 855 } 856 } else { 857 $(this).find('span').addClass('active'); 858 $(this).parents('.content').find('.text-more').hide('fast'); 859 if($(this).html().indexOf('Mehr') >= 0) { 860 $(this).html($(this).html().replace('Mehr', 'Weniger')); 861 } 862 } 863 }); 864 }, bindPowermailForm: function() { 865 /* ============================= 866 Powermail Error Div(s) 867 ============================= */ 868 869 // var countFieldsets = 0; 870 // $(".tx-powermail fieldset").each(function(){ 871 // $(this).prepend($("<div class='errors-"+countFieldsets+"'></div>")); 872 // $(this).find("input").attr("data-parsley-errors-container","div.errors-"+countFieldsets+""); 873 // $(this).find("select").attr("data-parsley-errors-container","div.errors-"+countFieldsets+""); 874 // $(this).find("textarea").attr("data-parsley-errors-container","div.errors-"+countFieldsets+""); 875 // countFieldsets++; 876 // }); 877 878 // $(".tx-powermail fieldset input[type=email]").attr("data-parsley-error-message","Bitte tragen Sie eine gültige E-Mail-Adresse ein"); 879 880 // if($(".tx-powermail").length){ 881 // $(document).ajaxStart(function () 882 // { 883 // $('body').addClass('ajax-loading'); 884 885 // }).ajaxComplete(function () { 886 887 // $('body').removeClass('ajax-loading'); 888 889 // }); 890 // } 891 892 // Custom Validation validationerror_validation 893 // if($(".tx-powermail").length) { 894 // // ZipCode 895 // const field100 = document.querySelector('[data-powermail-custom100]'); 896 // if(field100){ 897 // const form100 = field100.closest('form'); 898 // const formValidation100 = form100.powermailFormValidation; 899 900 // formValidation100.addValidator('custom100', function(field100) { 901 // if (field100.hasAttribute('data-powermail-custom100') && field100.value.match(/^\d{4,5}$/g)) { 902 // return field100.value.indexOf(field100.getAttribute('data-powermail-custom100')) === false; 903 // } 904 // // return error; 905 // return field100.getAttribute('data-powermail-error-message'); 906 // }); 907 // } 908 909 // // Streetnumber 910 // const field105 = document.querySelector('[data-powermail-custom105]'); 911 // if(field105){ 912 // const form105 = field105.closest('form'); 913 // const formValidation105 = form105.powermailFormValidation; 914 915 // formValidation105.addValidator('custom105', function(field105) { 916 // if (field105.hasAttribute('data-powermail-custom105') && field105.value.match(/^[0-9][^#+*~!?=§$%<>öäüÃ&]*$/i) && field105.value.toString().length < 7) { 917 // return field105.value.indexOf(field105.getAttribute('data-powermail-custom105')) === false; 918 // } 919 // return field105.getAttribute('data-powermail-error-message'); 920 // }); 921 // } 922 923 // // Amount 924 // const field110 = document.querySelector('[data-powermail-custom110]'); 925 // if(field110){ 926 // const form110 = field110.closest('form'); 927 // const formValidation110 = form110.powermailFormValidation; 928 929 // formValidation110.addValidator('custom110', function(field110) { 930 // if (field110.hasAttribute('data-powermail-custom110') && field110.value.match(/^(?:\d+|\d{1,6}(?:,\d{1,2})*)(?:\.\d{2})?$/)) { 931 // return field110.value.indexOf(field110.getAttribute('data-powermail-custom110')) === false; 932 // } 933 // return field110.getAttribute('data-powermail-error-message'); 934 // }); 935 // } 936 937 // // IBAN 938 // const field115 = document.querySelector('[data-powermail-custom115]'); 939 // if(field115){ 940 // const form115 = field115.closest('form'); 941 // const formValidation115 = form115.powermailFormValidation; 942 943 // formValidation115.addValidator('custom115', function(field115) { 944 // if (field115.hasAttribute('data-powermail-custom115') && field115.value.match(/^[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16}/) && field115.value.toString().length < 32) { 945 // return field115.value.indexOf(field115.getAttribute('data-powermail-custom115')) === false; 946 // } 947 // return field115.getAttribute('data-powermail-error-message'); 948 // }); 949 // } 950 951 // // BIC 952 // const field120 = document.querySelector('[data-powermail-custom120]'); 953 // if(field120){ 954 // const form120 = field120.closest('form'); 955 // const formValidation120 = form120.powermailFormValidation; 956 957 // formValidation120.addValidator('custom120', function(field120) { 958 // if (field120.hasAttribute('data-powermail-custom120') && field120.value.match(/^([a-zA-Z]{4}[a-zA-Z]{2}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?)/) && field120.value.toString().length < 12) { 959 // return field120.value.indexOf(field120.getAttribute('data-powermail-custom120')) === false; 960 // } 961 // return field120.getAttribute('data-powermail-error-message'); 962 // }); 963 // } 964 965 // // Name 966 // const field125 = document.querySelector('[data-powermail-custom125]'); 967 // if(field125){
968 // const form125 = field125.closest('form'); 969 // const formValidation125 = form125.powermailFormValidation; 970 971 // formValidation125.addValidator('custom125', function(field125) { 972 // if (field125.hasAttribute('data-powermail-custom125') && field125.value.match(/^[^0-9!?=§$%<>]+$/) != null) { 973 // return field125.value.indexOf(field125.getAttribute('data-powermail-custom125')) === false; 974 // } 975 // return field125.getAttribute('data-powermail-error-message'); 976 // }); 977 // } 978 979 // // Bank 980 // const field130 = document.querySelector('[data-powermail-custom130]'); 981 // if(field130){ 982 // const form130 = field130.closest('form'); 983 // const formValidation130 = form130.powermailFormValidation; 984 985 // formValidation130.addValidator('custom130', function(field130) { 986 // if (field130.hasAttribute('data-powermail-custom130') && field125.value.match(/^[^0-9!?=§$%<>]+$/)) { 987 // return field130.value.indexOf(field130.getAttribute('data-powermail-custom130')) === false; 988 // } 989 // return field130.getAttribute('data-powermail-error-message'); 990 // }); 991 // } 992 993 // } 994 }, showFixedNavigation: function() { 995 var scroll = $(window).scrollTop(); 996 if(scroll >= $pageHeaderWrapper.height()) { 997 if(!$('.navbar-fixed-top').length) { 998 $('.main-navigation').clone().prependTo('#header').addClass('navbar-fixed-top'); 999 } 1000 } else { 1001 $('.navbar-fixed-top').remove(); 1002 } 1003 }, singlePageSearch: function() { 1004 // console.log('singlePageSearch loaded '+new Date()); 1005 1006 $(document).on('click', '.search-link', function(event) { 1007 event.preventDefault(); 1008 1009 if(!$('#searchlayer').length) { 1010 $('body').prepend('<div id="searchlayer" style="display:none;" />'); 1011 1012 /* 1013 $.ajax({
1014 url: $(this).attr('href'), 1015// data: $searchForm.serialize(), 1016 data: { type: '198' }, 1017 type: 'GET', 1018 dataType: "html", 1019 success: function(data) { 1020 console.log('success'); 1021 console.log(data); 1022 1023 var $searchLayer = $('#searchlayer'); 1024 var $searchContainer = $data.find('#plaincontent'); 1025 $searchLayer.html($searchContainer); 1026 1027 var $searchForm = $('#tx_indexedsearch'); 1028 1029 $searchForm.submit(function(event){ 1030 this.searchSubmit(event, $searchForm); 1031 }); 1032 1033 $searchForm.on('click', '.tx-indexedsearch-browsebox ul li a', function(event) { 1034 this.searchSubmit(event, $searchForm); 1035 }); 1036 1037 } 1038 }); 1039 */ 1040 1041 $.get($(this).attr('href')+'?type=198', function(data) { 1042 /* 1043 var rawData2HTML = document.createElement('div'); 1044 rawData2HTML.innerHTML = data; 1045 var searchContainer = rawData2HTML.querySelector('#plaincontent').innerHTML; 1046 $('#searchlayer').html(searchContainer); 1047 */ 1048 1049 $('#searchlayer').html(data); 1050 $('#searchlayer').html($('#searchlayer').find('#plaincontent').html()); 1051 1052 var $searchForm = $('#tx_indexedsearch'); 1053 1054 $searchForm.submit(function(event){ 1055 this.searchSubmit(event, $searchForm); 1056 }); 1057 1058 $searchForm.on('click', '.tx-indexedsearch-browsebox ul li a', function(event) { 1059 this.searchSubmit(event, $searchForm); 1060 }); 1061 1062 }); 1063 } 1064 }); 1065 }, searchSubmit: function(event, $form) { 1066 event.preventDefault(); 1067 1068 $.ajax({
1069 url: $form.attr('action'), 1070 data: $form.serialize(), 1071 type: 'POST', 1072 dataType: "html", 1073 success: function(data) { 1074 1075 if(!$form.find('.tx-indexedsearch-res').length) { 1076 $form.append("<div class=\"tx-indexedsearch-res\" />"); 1077 } 1078 1079 data = data.replace(new RegExp(this.escapeRegExp(';document.getElementById(\'tx_indexedsearch\').submit()'), 'g'), ''); 1080 var $searchResult = $(data).find('.tx-indexedsearch'); 1081 $searchResult.find('.tx-indexedsearch-searchbox').remove(); 1082 $form.find('.tx-indexedsearch-res').html($searchResult); 1083 1084 if(window.sessionStorage != 'undefined') { 1085 window.sessionStorage.setItem('searchinput',$('#searchbox').val()); 1086 } 1087 } 1088 }); 1089 }, setStageHeadlineMargin: function() { 1090 if($("#stage .section .section").length || $("#stage .carousel-inner .header-2").length){ 1091 if($("#stage .carousel-caption").length){ 1092 $("#stage .carousel-caption").each(function(){ 1093 $(this).attr('style','margin-top: '+($("#stage").height()/2-$(this).children().first().actual( 'height' )/2)+'px !important'); 1094 }); 1095 }else{ 1096 $("#stage .text-overlay div.section").parent().attr('style','margin-top: '+($("#stage").height()/2-$("#stage .section .section").height()/2)+'px !important'); 1097 } 1098 } 1099 // else if($("#stage h3").length){ 1100 // $("#stage .text-overlay div.section").parent().attr('style','margin-top: '+($("#stage").height()/2-$("#stage h3").height()/2)+'px !important'); 1101 // }else if($("#stage .header-2").length){ 1102 // $("#stage .text-overlay div.section").parent().attr('style','margin-top: '+($("#stage").height()/2-$("#stage .header-2").height()/2)+'px !important'); 1103 // } 1104 1105 1106 }, escapeRegExp: function(str) { 1107 return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"); 1108 }, checkCarousel: function() { 1109 1110 currentItem = $('.carousel').find('.active.item'); 1111 1112 if ($(currentItem).find('.carousel-caption').length == 0) { 1113 $(currentItem).parent().parent().addClass('image-only') 1114 } 1115 } 1116}; 1117 1118 1119 1120/* ============================= 1121 OG GRID System (Team Pictures) 1122 ============================= */ 1123var Grid = (function() { 1124 1125 var $grid = $( '#og-grid' ), 1126 $items = $grid.children('li'), 1127 current = -1, 1128 previewPos = -1, 1129 scrollExtra = 0, 1130 marginExpanded = 0, 1131 $window = $( window ), winsize, 1132 $body = $( 'html, body' ), 1133 transEndEventNames = { 1134 'WebkitTransition' : 'webkitTransitionEnd', 1135 'MozTransition' : 'transitionend', 1136 'OTransition' : 'oTransitionEnd', 1137 'msTransition' : 'MSTransitionEnd', 1138 'transition' : 'transitionend' 1139 }, 1140 transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ], 1141 support = Modernizr.csstransitions, 1142 settings = { 1143 minHeight : 0, 1144 speed : 500, 1145 easing : 'ease' 1146 }; 1147 1148 function init( config ) { 1149 1150 // the settings.. 1151 settings = $.extend( true, {}, settings, config ); 1152 1153 // preload all images 1154 $grid.imagesLoaded( function() { 1155 1156 // save item´s size and offset 1157 saveItemInfo( true ); 1158 // get window´s size 1159 getWinSize(); 1160 // initialize some events 1161 initEvents(); 1162 1163 } ); 1164 1165 } 1166 1167 // saves the item´s offset top and height (if saveheight is true) 1168 function saveItemInfo( saveheight ) { 1169 $items.each( function() { 1170 var $item = $( this ); 1171 $item.data( 'offsetTop', $item.offset().top ); 1172 if( saveheight ) { 1173 $item.data( 'height', $item.height() ); 1174 } 1175 } ); 1176 } 1177 1178 function initEvents() { 1179 1180 // when clicking an item, show the preview with the item´s info and large image. 1181 // close the item if already expanded. 1182 // also close if clicking on the item´s cross 1183 initItemsEvents( $items ); 1184 1185 // on window resize get the window´s size again 1186 // reset some values.. 1187 1188 $window.on( 'debouncedresize', function() { 1189 1190 scrollExtra = 0; 1191 previewPos = -1; 1192 // save item´s offset 1193 saveItemInfo(); 1194 getWinSize(); 1195 var preview = $.data( this, 'preview' ); 1196 /* 1197 if( typeof preview != 'undefined' ) { 1198 hidePreview(); 1199 } 1200 */ 1201 1202 } ); 1203 1204 } 1205 1206 function initItemsEvents( $items ) { 1207 $items.on( 'click', 'span.og-close', function() { 1208 hidePreview(); 1209 return false; 1210 } ).children( 'div' ).on( 'click', function() { 1211 1212 var $item = $( this ).parent(); 1213 // check if item already opened 1214 current === $item.index() ? hidePreview() : showPreview( $item ); 1215 return false; 1216 1217 } ); 1218 } 1219 1220 function getWinSize() { 1221 winsize = { width : $window.width(), height : $window.height() }; 1222 } 1223 1224 function showPreview( $item ) { 1225 1226 var preview = $.data( this, 'preview' ), 1227 // item´s offset top 1228 position = $item.data( 'offsetTop' ); 1229 1230 scrollExtra = 0; 1231 1232 // if a preview exists and previewPos is different (different row) from item´s top then close it 1233 if( typeof preview != 'undefined' ) { 1234 1235 // not in the same row 1236 if( previewPos !== position ) { 1237 // if position > previewPos then we need to take te current preview´s height in consideration when scrolling the window 1238 if( position > previewPos ) { 1239 scrollExtra = preview.height; 1240 } 1241 hidePreview(); 1242 } 1243 // same row 1244 else { 1245 preview.update( $item ); 1246 return false; 1247 } 1248 1249 } 1250 1251 // update previewPos 1252 previewPos = position; 1253 // initialize new preview for the clicked item 1254 preview = $.data( this, 'preview', new Preview( $item ) ); 1255 // expand preview overlay 1256 preview.open(); 1257 1258 } 1259 1260 function hidePreview() { 1261 current = -1; 1262 var preview = $.data( this, 'preview' ); 1263 preview.close(); 1264 $.removeData( this, 'preview' ); 1265 } 1266 1267 // the preview obj / overlay 1268 function Preview( $item ) { 1269 this.$item = $item; 1270 this.expandedIdx = this.$item.index(); 1271 this.create(); 1272 this.update(); 1273 } 1274 1275 Preview.prototype = { 1276 create : function() { 1277 this.$content = $( '<div class="content-container"></div>'); 1278 this.$details = $( '<div class="og-details"></div>' ).append( this.$content ); 1279 this.$closePreview = $( '<span class="icon-global-close-secondary color-secondary og-close"></span>' ); 1280 this.$previewInner = $( '<div class="og-expander-inner"></div>' ).append( this.$closePreview, this.$details ); 1281 this.$previewEl = $( '<div class="og-expander"></div>' ).append( this.$previewInner ); 1282 1283 this.$item.append( this.getEl() ); 1284 1285 if( support ) { 1286 this.setTransition(); 1287 } 1288 }, 1289 update : function( $item ) { 1290 1291 if( $item ) { 1292 this.$item = $item; 1293 } 1294 1295 // if already expanded remove class "og-expanded" from current item and add it to new item 1296 if( current !== -1 ) { 1297 var $currentItem = $items.eq( current ); 1298 $currentItem.removeClass( 'og-expanded' ); 1299 this.$item.addClass( 'og-expanded' ); 1300 // position the preview correctly 1301 this.positionPreview(); 1302 } 1303 1304 // update current value 1305 current = this.$item.index(); 1306 1307 // update preview´s content 1308 var $itemEl = this.$item.children( 'div'), 1309 eldata = { content : $itemEl.children( 'div.content-container' ).html() }; 1310 1311 this.$content.html( eldata.content ); 1312 }, 1313 open : function() { 1314 1315 setTimeout( $.proxy( function() { 1316 // set the height for the preview and the item 1317 this.setHeights();
1318 // scroll to position the preview in the right place 1319 this.positionPreview(); 1320 }, this ), 25 ); 1321 1322 }, 1323 close : function() { 1324 1325 var self = this, 1326 onEndFn = function() { 1327 if( support ) { 1328 $( this ).off( transEndEventName ); 1329 } 1330 self.$item.removeClass( 'og-expanded' ); 1331 self.$previewEl.remove(); 1332 }; 1333 1334 setTimeout( $.proxy( function() { 1335 1336 if( typeof this.$largeImg !== 'undefined' ) { 1337 this.$largeImg.fadeOut( 'fast' ); 1338 } 1339 this.$previewEl.css( 'height', 0 ); 1340 // the current expanded item (might be different from this.$item) 1341 var $expandedItem = $items.eq( this.expandedIdx ); 1342 $expandedItem.css( 'height', $expandedItem.data( 'height' ) ).on( transEndEventName, onEndFn ); 1343 1344 if( !support ) { 1345 onEndFn.call(); 1346 } 1347 1348 }, this ), 25 ); 1349 1350 return false; 1351 1352 }, 1353 calcHeight : function() { 1354 1355 /* 1356 var heightPreview = winsize.height - this.$item.data( 'height' ) - marginExpanded, 1357 itemHeight = winsize.height; 1358 1359 if( heightPreview < settings.minHeight ) { 1360 heightPreview = settings.minHeight; 1361 itemHeight = settings.minHeight + this.$item.data( 'height' ) + marginExpanded; 1362 } 1363 1364 this.height = heightPreview; 1365 this.itemHeight = itemHeight; 1366 */ 1367 1368 var heightPreview = $('.og-details div').height() + this.$item.data( 'height' ) + marginExpanded, 1369 itemHeight = heightPreview; 1370 1371 if( heightPreview < settings.minHeight ) { 1372 heightPreview = settings.minHeight; 1373 itemHeight = settings.minHeight + this.$item.data( 'height' ) + marginExpanded; 1374 1375 } 1376 1377 this.height = heightPreview; 1378 this.itemHeight = itemHeight + this.$item.data( 'height' ) + marginExpanded ; 1379 1380 }, 1381 setHeights : function() { 1382 1383 var self = this, 1384 onEndFn = function() { 1385 if( support ) { 1386 self.$item.off( transEndEventName ); 1387 } 1388 self.$item.addClass( 'og-expanded' ); 1389 }; 1390 1391 this.calcHeight(); 1392 this.$previewEl.css( 'height', this.height ); 1393 this.$item.css( 'height', this.itemHeight ).on( transEndEventName, onEndFn ); 1394 1395 if( !support ) { 1396 onEndFn.call(); 1397 } 1398 1399 }, 1400 positionPreview : function() { 1401 1402 var position = this.$item.data( 'offsetTop' ), 1403 previewOffsetT = this.$previewEl.offset().top - scrollExtra, 1404 scrollVal = this.height + this.$item.data( 'height' ) + marginExpanded <= winsize.height ? position : this.height < winsize.height ? previewOffsetT - ( winsize.height - this.height ) : previewOffsetT; 1405 1406 $body.animate( { scrollTop : scrollVal-140 }, settings.speed ); 1407 1408 }, 1409 setTransition : function() { 1410 this.$previewEl.css( 'transition', 'opacity ' + settings.speed + 'ms ' + settings.easing ); 1411 this.$item.css( 'transition', 'opacity ' + settings.speed + 'ms ' + settings.easing ); 1412 }, 1413 getEl : function() { 1414 return this.$previewEl; 1415 } 1416 }; 1417 1418 return { 1419 init : init 1420 }; 1421 1422})(); 1423 1424/* ============================= 1425 ImagesLoaded 1426 ============================= */ 1427$.fn.imagesLoaded = function( callback ) { 1428 var $this = this, 1429 deferred = $.isFunction($.Deferred) ? $.Deferred() : 0, 1430 hasNotify = $.isFunction(deferred.notify), 1431 $images = $this.find('img').add( $this.filter('img') ), 1432 loaded = [], 1433 proper = [], 1434 broken = []; 1435 1436 // Register deferred callbacks 1437 if ($.isPlainObject(callback)) { 1438 $.each(callback, function (key, value) { 1439 if (key === 'callback') { 1440 callback = value; 1441 } else if (deferred) { 1442 deferred[key](value); 1443 } 1444 }); 1445 } 1446 1447 function doneLoading() { 1448 var $proper = $(proper), 1449 $broken = $(broken); 1450 1451 if ( deferred ) { 1452 if ( broken.length ) { 1453 deferred.reject( $images, $proper, $broken ); 1454 } else { 1455 deferred.resolve( $images ); 1456 } 1457 } 1458 1459 if ( $.isFunction( callback ) ) { 1460 callback.call( $this, $images, $proper, $broken ); 1461 } 1462 } 1463 1464 function imgLoaded( img, isBroken ) { 1465 // don't proceed if BLANK image, or image is already loaded 1466 if ( img.src === BLANK || $.inArray( img, loaded ) !== -1 ) { 1467 return; 1468 } 1469 1470 // store element in loaded images array 1471 loaded.push( img ); 1472 1473 // keep track of broken and properly loaded images 1474 if ( isBroken ) { 1475 broken.push( img ); 1476 } else { 1477 proper.push( img ); 1478 } 1479 1480 // cache image and its state for future calls 1481 $.data( img, 'imagesLoaded', { isBroken: isBroken, src: img.src } ); 1482 1483 // trigger deferred progress method if present 1484 if ( hasNotify ) { 1485 deferred.notifyWith( $(img), [ isBroken, $images, $(proper), $(broken) ] ); 1486 } 1487 1488 // call doneLoading and clean listeners if all images are loaded 1489 if ( $images.length === loaded.length ){ 1490 setTimeout( doneLoading ); 1491 $images.unbind( '.imagesLoaded' ); 1492 } 1493 } 1494 1495 // if no images, trigger immediately 1496 if ( !$images.length ) { 1497 doneLoading(); 1498 } else { 1499 $images.bind( 'load.imagesLoaded error.imagesLoaded', function( event ){ 1500 // trigger imgLoaded 1501 imgLoaded( event.target, event.type === 'error' ); 1502 }).each( function( i, el ) { 1503 var src = el.src; 1504 1505 // find out if this image has been already checked for status 1506 // if it was, and src has not changed, call imgLoaded on it 1507 var cached = $.data( el, 'imagesLoaded' ); 1508 if ( cached && cached.src === src ) { 1509 imgLoaded( el, cached.isBroken ); 1510 return; 1511 } 1512 1513 // if complete is true and browser supports natural sizes, try 1514 // to check for image status manually
1515 if ( el.complete && el.naturalWidth !== undefined ) { 1516 imgLoaded( el, el.naturalWidth === 0 || el.naturalHeight === 0 ); 1517 return; 1518 } 1519 1520 // cached images don't fire load sometimes, so we reset src, but only when 1521 // dealing with IE, or image is complete (loaded) and failed manual check 1522 // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f 1523 if ( el.readyState || el.complete ) { 1524 el.src = BLANK; 1525 el.src = src; 1526 } 1527 }); 1528 } 1529 1530 return deferred ? deferred.promise( $this ) : $this; 1531}; 1532 1533/* 1534* Collapse 1535 */ 1536function toggleButton(e) { 1537 $(e.target) 1538 .prev('.panel-heading') 1539 .toggleClass('open') 1540 .find("a.acc-btn") 1541 .toggleClass('close-btn open-btn'); 1542} 1543 1544 1545/* 1546* Image Gallery 1547 */ 1548 1549$(function () { 1550 "use strict"; 1551 /* ============================= 1552 Init Functions/Bindings 1553 ============================= */ 1554 // init page 1555 Page.init(); 1556 Grid.init(); 1557}); 1558 1559 1560 1561/* 1562* Logo change for mobile and retina 1563 */ 1564 1565function isHighDensity(){ 1566 return ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)').matches)) || (window.devicePixelRatio && window.devicePixelRatio > 1.3)); 1567} 1568 1569function isRetina(){ 1570 return ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)').matches)) || (window.devicePixelRatio && window.devicePixelRatio >= 2)) && /(iPad|iPhone|iPod)/g.test(navigator.userAgent); 1571} 1572 1573$(function () { 1574 1575 var logoSrc = document.getElementById('header').getElementsByTagName('img')[0].src; 1576 var fileNameIndex = logoSrc.lastIndexOf("/") + 1; 1577 var filename = logoSrc.substr(fileNameIndex); 1578 var path = logoSrc.substring(0,logoSrc.lastIndexOf('/')); 1579 var res = filename.split("\."); 1580 var newFilename = res[0] + '@2.' + res[1]; 1581 1582 $.ajax({
1583 url: path + '/' + newFilename, 1584 type: 'HEAD', 1585 success: function(){ 1586 //file exists 1587 if (isHighDensity() || isRetina()){ 1588 document.getElementById('header').getElementsByTagName('img')[0].src=path + '/' + newFilename; 1589 } 1590 } 1591 }); 1592}); 1593 1594/* wohnformen filter teaserbox verlinkung */ 1595function showLivingforms(city,institution) { 1596 1597 var element = $(".institution-city-radio input[alt='"+city+"']"); 1598 1599 $('html, body').animate({ 1600 scrollTop: $("#institutionConfigurator").offset().top + (-100) 1601 }, 1000); 1602 1603 element.trigger("click"); 1604 1605 setTimeout(function(){ 1606 element.parent().parent().siblings().find("input").each(function(){ 1607 if($(this).attr("alt") != institution){ 1608 $(this).click(); 1609 } 1610 }); 1611 }, 300); 1612} 1613 1614/* internet explorer check */ 1615function msieversion() { 1616 1617 var ua = window.navigator.userAgent; 1618 var msie = ua.indexOf("MSIE "); 1619 1620 if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { 1621 return true; 1622 } 1623 return false; 1624} 1625 1626/* totop button */ 1627$(function () { 1628 $(document).ready(function(){ 1629 $(window).scroll(function () { 1630 if (jQuery(this).scrollTop() != 0) { 1631 jQuery('#to-top').addClass('visible-btn'); 1632 } else { 1633 jQuery('#to-top').removeClass('visible-btn'); 1634 } 1635 }); 1636 // scroll body to 0px on click 1637 $('#to-top').click(function () { 1638 //$('#to-top').tooltip('hide'); 1639 $('body,html').animate({ 1640 scrollTop: 0 1641 }, 800); 1642 return false; 1643 }); 1644 1645 //$('#to-top').tooltip('show'); 1646 }); 1647}); 1648 1649/* shuffle function .shuffle() */ 1650(function(d){d.fn.shuffle=function(c){c=[];return this.each(function(){c.push(d(this).clone(true))}).each(function(a,b){d(b).replaceWith(c[a=Math.floor(Math.random()*c.length)]);c.splice(a,1)})};d.shuffle=function(a){return d(a).shuffle()}})(jQuery); 1651 1652$(window).on('load',function(){ 1653 $('.relevance a').each(function(){ 1654 var tmp = $.trim($(this).text()); 1655 tmp = tmp.split("?"); 1656 $(this).text(window.location.origin+tmp[0]); 1657 // $(this).html('<a href="'+oldText+'" onclick="solrResultIndexforWt();">'+window.location.origin+tmp[0]+'</a>'); 1658 }); 1659 1660 if($('#filter-list').length){ 1661 $('.facets').first().attr('id','filter-list-mobile'); 1662 $('div[data-target="#filter-list"]').first().attr('data-target','#filter-list-mobile'); 1663 $('.tx-solr-facets-in-available .header-3.open-btn').on('click',function(){ 1664 $(this).toggleClass('close-btn open-btn'); 1665 }); 1666 1667 if(window.innerWidth > 751) { 1668 $('.tx-solr-facets-in-available .header-3.open-btn').click(); 1669 } 1670 } 1671 1672 if($('#tx-solr-search-functions').length == 1){ 1673 if($('#tx-solr-search-functions').html().length == 1){ 1674 $('#tx-solr-search-functions').css('display','none'); 1675 $('#tx-solr-search').parent().attr('style','width: 100%; margin: 0 auto; float: unset; max-width: 800px;'); 1676 } 1677 } 1678 1679 $('form[name="tx-solr-search-form"]').last().find('input.tx-solr-q').on('keyup', function(){ 1680 if(window.innerWidth < 960){ 1681 $('form[name="tx-solr-search-form"]').first().find('input.tx-solr-q').val($(this).val()); 1682 } 1683 }); 1684 1685 $('form[name="tx-solr-search-form"]').first().find('input.tx-solr-q').on('keyup', function(){ 1686 if(window.innerWidth > 959){ 1687 $('form[name="tx-solr-search-form"]').last().find('input.tx-solr-q').val($(this).val()); 1688 } 1689 }); 1690 1691}); 1692 1693// Delete Button for Solr 1694 1695// Result 1696$(document).ready(function() { 1697 if ($('#tx-solr-search input.tx-solr-q').val()) { 1698 $('#tx-solr-search .delete-btn').addClass('show'); 1699 } 1700}) 1701$('#tx-solr-search input.tx-solr-q').on('input', function() { 1702 if (!$('#tx-solr-search .delete-btn').hasClass('show')) { 1703 $('#tx-solr-search .delete-btn').addClass('show'); 1704 } 1705 if (!$(this).val()) { 1706 $('#tx-solr-search .delete-btn').removeClass('show'); 1707 } 1708}) 1709$('#tx-solr-search .delete-btn').on('click', function() { 1710 $('#tx-solr-search input.tx-solr-q').val(''); 1711 $(this).removeClass('show'); 1712}) 1713 1714// Navbar 1715$('.navbar-search .tx-solr-search-input-wrap .delete-btn').on('click', function() { 1716 $('.navbar-search .tx-solr-search-input-wrap input.tx-solr-q').val(''); 1717 $(this).removeClass('show'); 1718}) 1719$('.navbar-search .tx-solr-search-input-wrap input.tx-solr-q').on('input', function() { 1720 $('.navbar-search .tx-solr-search-input-wrap .delete-btn').addClass('show'); 1721 if (!$(this).val()) { 1722 $('.navbar-search .tx-solr-search-input-wrap .delete-btn').removeClass('show'); 1723 } 1724})
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.