// Config requirejs.config({ baseUrl: '/_res', paths: { jquery: 'lib/jquery-3.2.1/jquery.min', //jquery_ui: 'lib/jquery-ui-1.12.1.custom/jquery-ui.min', foundation: 'lib/foundation-6.4.1/dist/js/foundation.custom.min-2', lazy: 'lib/jquery-lazy-1.7.5/jquery.lazy.min', swiper: 'lib/swiper-3.4.2/dist/js/swiper.jquery.min', photoswipe: 'lib/photoswipe-4.1.2/dist/photoswipe.custom', photoswipe_ui: 'lib/photoswipe-4.1.2/dist/photoswipe-ui-default.min', markerCluster: 'lib/st2_GMap-v3/lib/MarkerClusterer-v3/src/markerclusterer_compiled', gMap: 'lib/st2_GMap-v3/js/GMap', fileupload: 'lib/jquery-upload-file/js/jquery.fine-uploader.min', datepicker: 'lib/datepicker-jquery-ui-1.11.4/js/datepicker.min', datepickerDE: 'lib/datepicker-jquery-ui-1.11.4/js/datepicker-de', cookie: 'lib/js.cookie', sortable: 'lib/sortable-1.7.0/Sortable.min', uiDropdown: 'lib/semantic-ui-dropdown-2.3/dropdown.min', flot: 'lib/jquery.flot/jquery.flot.min', flotPie: 'lib/jquery.flot/jquery.flot.pie.min' } }); // jQuery, Foundation and Basic-Scripts requirejs(['jquery'], function($){ // Foundation Scripts requirejs(['foundation'], function(){ $(function(){ $(document).foundation(); $("header .main-navigation a").click(function(event){ event.preventDefault(); $("#mainnav .accordion-nav-menu").attr("data-activeid",$(this).data("id")); $('#mainnav .accordion-nav-menu').foundation('down', $('#mainnav [data-id="'+$(this).data("id")+'"] > .submenu')); if($('#mainnav').hasClass('is-closed')){ $('#mainnav').foundation('toggle'); } }); //whenever a user opens main menu $(".off-canvas").on("opened.zf.offcanvas", function(ev){ $('header').addClass('canvas-opened'); ga('send', 'event', 'Menü', 'öffnen'); }); $(".off-canvas").on("closed.zf.offcanvas", function(ev){ $('header').removeClass('canvas-opened'); }); //whenever a user clicks on a navigation link $('#mainnav .nochilds a').click(function(event){ ga('send', 'event', 'Menü', 'Link',$(this).attr('href')); }); //search-ion in header $('header .search-icon').click(function(event){ event.preventDefault(); if($('#mainnav').hasClass('is-closed')){ $('#mainnav').foundation('toggle'); } setTimeout(function(){ $('#mainnav form input[name="q"]').focus(); }, 500); }); }); }); // Bilder nachladen (lazy load) if( $("img.lazyload").length ) { requirejs(['lazy'], function(){ var delay_time = -1; if( $("body").hasClass("desktop") && window.location.pathname!="/" ) { delay_time = 200; } // Auf Desktop Geraeten laden wir schon mal alles $("img.lazyload").lazy({ bind: "event", threshold: 800, effect: "fadeIn", effectTime: 250, delay: delay_time }); }); } // Google Maps nachladen (lazy load) if( $("#karte[data-loader]").length ) { requirejs(['lazy','cookie'], function(){ require(['js/gmapFilter-init'],function(){ $(function(){ $("#karte").lazy({ bind: "event", threshold: 800, lazyGmapLoader: function(e){ require(['markerCluster','gMap'], function(){ var s = document.createElement("script"); s.type = "text/javascript"; s.defer = true; s.src = "https://maps.googleapis.com/maps/api/js?key=AIzaSyD0V84GvfdYGTFz0YJSM0dx0_zjjWHLnIE&callback=GMap.initMap"; $("body").append( s ); }); } }); }); }); }); } // Auf Mobilgeraeten die Hoehe fest setzen, um Verschiebungen // aufgrund verschwindender Adresszeile zu vermeiden. if( $("body").hasClass("mobile") ) { $("#heroshot").css( "height", $(window).height() ); } // Sticky Header (Morphing) function stickyHeader() { if($(window).scrollTop()>=75) { $("header").addClass("sticky-custom"); } else { $("header").removeClass("sticky-custom"); } // Offenen Tooltip (Wetter) ggf ausblenden $('body > div.tooltip[role="tooltip"][aria-hidden="false"]').hide().attr("aria-hidden","true"); } $(window).scroll(stickyHeader); // 'Mehr laden' Funktion //TODO: Ajax? // $("a[data-reveal-element]").click(function(){ // var a = $(this).attr("data-reveal-element"); // $(a).slideDown(500); // $(this).fadeOut(500); // return false; // }); // Swiper laden, sofern noetig if( $("#shortnews-swiper").length || $("#topnews-swiper").length || $("#blogger-swiper").length || $("#events-swiper").length ||$("#interestingfacts").length || $(".slideshow").length || $(".panorama-slider").length ) { require(['swiper', 'js/swiper-init']); } // Photoswipe (Lightbox) fuer Bilder laden, sofern noetig if( $(".lightbox").length ) { require(['js/photoswipe-init']); } // Photoswipe (Lightbox) fuer HTML Inhalt laden, sofern noetig if( $(".lightbox-html").length ) { require(['js/photoswipe-html-init']); } // Photoswipe (Lightbox) fuer HTML Inhalt laden, sofern noetig if( $(".lightbox-job").length ) { require(['js/photoswipe-jobportal']); } // Photoswipe (Lightbox) fuer Bilder laden, sofern noetig if( $(".lightbox-press").length) { require(['js/photoswipe-pressrelease']); } // Gastgeber-Formular if( $(".accommodation-wrapper").length ) { requirejs(['fileupload'], function(){ requirejs(['js/accommodation']); }); } //jobboerse if($(".worklocal-wrapper").length){ requirejs(['fileupload','markerCluster','gMap'], function(){ requirejs(['js/worklocal'], function(){ var s = document.createElement("script"); s.type = "text/javascript"; s.defer = true; s.src = "https://maps.googleapis.com/maps/api/js?key=AIzaSyD0V84GvfdYGTFz0YJSM0dx0_zjjWHLnIE&callback=GMap.initMapManually"; $("body").append( s ); }); }); } //widget - teaserblock Articles if($(".teaser-article-wrapper .teaser-wrapper.more-wrapper").length){ requirejs(['js/widget-teaserblock-article']); } //widget - audio / mediaelement.js if($(".mejs__player").length){ requirejs(['lib/mediaelementJS/build/mediaelement-and-player.min']); requirejs(['lib/mediaelementJS/custom']); } // Unterkunftsübersichtseite if( $("#maplist").length ) { require(['js/accommodations-overview']); } // Unterkunftsdetailseite if( $("#acc-detail").length ) { require(['datepicker'],function(){ require(['datepickerDE'],function(){ require(['js/accommodation-detail']); }); }); } // Ortsuebersicht if( $("#placeMapWrapper").length ) { require(['js/placemap']); } // diagramme (jquery.flot) if( $(".flotContainer").length ) { require(['flot'],function(){ require(['flotPie'],function(){ function labelFormatter(label, series) { return '