You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
21 KiB
JavaScript

function getCookie(t){"use strict";var e=null;if(document.cookie&&""!==document.cookie)for(var n=document.cookie.split(";"),i=0;i<n.length;i++){var o=jQuery.trim(n[i]);if(o.substring(0,t.length+1)===t+"="){e=decodeURIComponent(o.substring(t.length+1));break}}return e}function setCookie(t,e,n){"use strict";var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),document.cookie=t+"="+e+";path=/;expires="+i.toUTCString()}function deleteCookie(t){setCookie(t,0,-1)}function csrfSafeMethod(t){"use strict";return/^(GET|HEAD|OPTIONS|TRACE)$/.test(t)}parent.location!=self.location&&(parent.location=self.location);var csrftoken=getCookie("csrftoken");function init_map(){var o,a,r,s={lat:47.20388,lng:8.58176},t=840<$(window).width()?{lat:s.lat,lng:s.lng+.06}:{lat:s.lat-.06,lng:s.lng},e=new google.maps.Map(document.getElementById("map"),{zoom:12,center:t,disableDefaultUI:!0,scrollwheel:!1,zoomControl:!0,zoomControlOptions:{position:google.maps.ControlPosition.RIGHT_TOP},styles:[{featureType:"administrative.neighborhood",stylers:[{visibility:"off"}]},{featureType:"poi",elementType:"labels.text",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"labels.text",stylers:[{visibility:"off"}]}]}),n={url:"/static/img/marker.png",size:new google.maps.Size(50,60),origin:new google.maps.Point(0,0),anchor:new google.maps.Point(25,60),scaledSize:new google.maps.Size(50,60)},l=(new google.maps.Marker({position:s,map:e,icon:n}),document.getElementById("journey_calculator__input"));l&&(o=l.parentNode.querySelector(".journey_calculator__result"),(a=new google.maps.places.Autocomplete(l,{types:["geocode"],componentRestrictions:{country:"ch"}})).addListener("place_changed",function(){l.parentNode.classList.remove("error"),l.parentNode.classList.add("loaded"),o.classList.add("loading");var t=a.getPlace();t.geometry||(l.blur(),l.parentNode.classList.add("error"));var e="https://www.google.com/maps/dir/?api=1&origin="+l.value+"&origin_place_id="+t.id+"&destination="+encodeURI("Tagesschule Elementa, Sarbachstrasse 8, 6345 Neuheim");$(".journey_calculator__button").attr("href",e);var n=new google.maps.LatLng(t.geometry.location.lat(),t.geometry.location.lng()),i=new google.maps.LatLng(s);(new google.maps.DistanceMatrixService).getDistanceMatrix({origins:[n],destinations:[i],travelMode:"DRIVING"},function(n,t){window.clearTimeout(r),r=window.setTimeout(function(){var t=n.rows[0].elements[0].duration.value,e=Math.round(t/60);o.setAttribute("data-duration",e),o.classList.remove("loading")},300)})}))}$(function(){"use strict";$.ajaxSetup({crossDomain:!1,beforeSend:function(t,e){csrfSafeMethod(e.type)||t.setRequestHeader("X-CSRFToken",csrftoken)}})}),window.transitionend="webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",window.on_transitionend=function(t,e){Modernizr.csstransitions?t.on(window.transitionend,e):e(!1)},$(function(){var a=$("body");window.enable_touch_swipe=function(t,e,n){var i=0,o=0;a.on("touchstart",t,function(t){i=t.originalEvent.touches[0].pageX}),a.on("touchmove",t,function(t){o=t.originalEvent.touches[0].pageX-i}),a.on("touchend",t,function(t){50<o?e($(this)):o<-50&&n($(this)),o=0})},window.document_height=$(document).height(),window.window_height=$(window).height(),window.window_width=$(window).width(),window.scroll_top=$(window).scrollTop(),$(window).on("scroll",function(t){window.scroll_top=$(window).scrollTop()}),$(window).on("resize",function(t){window.document_height=$(document).height(),window.window_height=$(window).height(),window.window_width=$(window).width()})}),$(function(){function t(t){t.find(".reveal_container").each(function(){var t=this,e=scrollMonitor.create(t);e.enterViewport(function(){n(t)}),e.fullyEnterViewport(function(){n(t)})}),t.find(".reveal_self").each(function(){var t=this,e=scrollMonitor.create(t);e.enterViewport(function(){i(t)}),e.fullyEnterViewport(function(){i(t)})})}function e(t){t&&t.target!==this||($(this).removeClass("reveal_animation"),$(this).off(window.transitionend,e))}function n(t){$(t).find(".reveal").each(function(){i(this)})}function i(t){window.requestAnimationFrame(function(){window.on_transitionend($(t),e),$(t).removeClass("reveal")})}t($("html")),window.create_reveal_elements=t,i($(".header")),i($(".header__logo")),n($(".timetable__clock__frame")),i($(".timetable__next")),i($(".timetable__start__background"))}),$(function(){$("body").find(".animated_icon").each(function(){$(this).html("");var t=$(this).attr("data-icon");bodymovin.loadAnimation({container:this,path:"/static/animation/"+t+".json",renderer:"svg",loop:!0,autoplay:!0})})}),$(function(){var t,e=$("body"),o=$(".content__navigation"),n=$(".content"),a="content__navigation__anchor";if(0===o.length)return!1;n.find(".section").each(function(){var t=$(this),e=t.attr("id"),n=t.find("h2").text(),i='<a class="'+a+'" href="#'+e+'">'+n+"</a>";o.find("ul").append("<li>"+i+"</li>"),t.find(".section__title__content").html(n)}),window.location.hash&&(t=window.location.hash,window.requestAnimationFrame(function(){window.location.hash=t})),e.on("click","."+a,function(t){t.preventDefault();var e=$(this);o.find(".active").removeClass("active"),e.addClass("active"),TweenLite.to(window,.5,{scrollTo:e.attr("href")})}),n.find(".section").each(function(){var t=this;scrollMonitor.create(t).fullyEnterViewport(function(){o.find(".active").removeClass("active"),o.find('a[href="#'+$(t).attr("id")+'"]').addClass("active")})});var i=o.offset().top;$(window).on("resize",function(){i=o.offset().top});var r=$(".content__navigation__progress__fill");!function t(){var e;window.navigation_is_open||(e=Math.round(100/window.document_height*(window.scroll_top+window.window_height)),r.height(e+"%"),i&&window.scroll_top>=i?o.addClass("fixed"):o.removeClass("fixed")),window.requestAnimationFrame(t)}()}),$(function(){"use strict";var t=$("body");t.on("click",".control__item__open",function(t){t.preventDefault();var e=$(this),o=e.parents(".control__item");o.addClass("loading"),$.get(e.attr("data-href"),function(t){var e=o.find(".control__item__content"),n=e.find(".control__item__content__main"),i=t.replace(/autofocus/g,"");n.html(i),e.height(n.outerHeight(!0)),o.addClass("active"),window.on_transitionend(e,function(t){t&&t.target!==this||(e.off(window.transitionend),e.removeAttr("style"),o.removeClass("loading"))})})}),t.on("click",".control__item__close",function(t){t.preventDefault();var e=$(this).parents(".control__item"),n=e.find(".control__item__content"),i=n.find(".control__item__content__main");n.height(i.outerHeight(!0)),window.on_transitionend(n,function(t){t&&t.target!==this||(n.off(window.transitionend),i.html(""))}),window.requestAnimationFrame(function(){e.removeClass("active"),n.removeAttr("style")})}),t.on("submit",".control__item form",function(t){t.preventDefault();var e=$(this);e.addClass("loading"),$.ajax({type:e.attr("method"),url:e.attr("action"),data:e.serialize(),success:function(t){e.replaceWith(t)}})});var e=$(".task__form");e.hasClass("errors")&&(window.location="#form"),e.on("formAdded",function(t){var e=$(t.target).find("h3"),n=parseInt(e.attr("data-id").match(/\d+/)[0]);e.html(e.html().replace("%(id)",n+1))}),e.on("formDeleted",function(t){$(t.target).hide()}),$(".downloads__frame").each(function(){var l=$(this),c=[];l.find(".download__item__title").each(function(){var t=$(this).text().toLowerCase();t=(t=t+" "+$(this).next().text().toLowerCase())+" "+$(this).next().next().text().toLowerCase(),c.push({$element:$(this).parents("li"),text:t})}),l.on("input",".downloads_search",function(t){for(var e=$(this).val().toLowerCase(),n=$.trim(e).split(" "),i=[],o=0;o<c.length;o++)for(var a=c[o],r=0;r<n.length;r++){var s=n[r];0<=a.text.indexOf(s)&&i.push(a.$element)}for(l.find("li").each(function(){$(this).parents(".downloads__section").css("display","none"),$(this).css("display","none")}),o=0;o<i.length;o++)i[o].removeAttr("style"),i[o].parents(".downloads__section").removeAttr("style")}),l.find("#downloads_search").trigger("input")})});var initPhotoSwipeFromDOM=function(l){function t(t){(t=t||window.event).preventDefault?t.preventDefault():t.returnValue=!1;var e=function t(e,n){return e&&(n(e)?e:t(e.parentNode,n))}(t.target||t.srcElement,function(t){return t.tagName&&"FIGURE"===t.tagName.toUpperCase()});if(e){for(var n,i=$(e).parents(l)[0],o=i.querySelectorAll("figure"),a=o.length,r=0,s=0;s<a;s++)if(1===o[s].nodeType){if(o[s]===e){n=r;break}r++}return 0<=n&&c(n,i),!1}}for(var c=function(t,e,n,i){var o=document.querySelectorAll(".pswp")[0],a=function(t){for(var e,n,i,o,a=t.querySelectorAll("figure"),r=a.length,s=[],l=0;l<r;l++)1===(e=a[l]).nodeType&&(i=(n=e.children[0]).getAttribute("data-size").split("x"),o={src:n.getAttribute("href"),w:parseInt(i[0],10),h:parseInt(i[1],10)},1<e.children.length&&(o.title=e.children[1].innerHTML),0<n.children.length&&(o.msrc=n.children[0].getAttribute("src")),o.el=e,s.push(o));return s}(e),r={showHideOpacity:!0,shareButtons:[{id:"download",label:"Bild herunterladen",url:"{{raw_image_url}}",download:!0}],galleryUID:e.getAttribute("data-pswp-uid"),getThumbBoundsFn:function(t){var e=a[t].el.getElementsByTagName("img")[0],n=window.pageYOffset||document.documentElement.scrollTop,i=e.getBoundingClientRect();return{x:i.left,y:i.top+n,w:i.width}}};if(i)if(r.galleryPIDs){for(var s=0;s<a.length;s++)if(a[s].pid==t){r.index=s;break}}else r.index=parseInt(t,10)-1;else r.index=parseInt(t,10);isNaN(r.index)||(n&&(r.showAnimationDuration=0),new PhotoSwipe(o,PhotoSwipeUI_Default,a,r).init())},e=document.querySelectorAll(l),n=0,i=e.length;n<i;n++)e[n].setAttribute("data-pswp-uid",n+1),e[n].onclick=t;var o=function(){var t=window.location.hash.substring(1),e={};if(t.length<5)return e;for(var n,i=t.split("&"),o=0;o<i.length;o++){i[o]&&((n=i[o].split("=")).length<2||(e[n[0]]=n[1]))}return e.gid&&(e.gid=parseInt(e.gid,10)),e}();o.pid&&o.gid&&c(o.pid,e[o.gid-1],!0,!0)};initPhotoSwipeFromDOM(".gallery");var search=window.location.search;-1===search.indexOf("?page=1")&&(0<=search.indexOf("?page=")||0<=search.indexOf("&page="))&&(document.getElementsByTagName("body")[0].classList.add("hidden"),window.location=window.location.pathname),$(function(){"use strict";function a(){$(".load__replace--auto").each(function(){var t=this;scrollMonitor.create(t).enterViewport(function(){$(t).find("a").trigger("click")})})}$("body").on("click",".list__button",function(t){t.preventDefault();var e=$(this),o=e.parents(".load__frame");e.width(e.width()),window.requestAnimationFrame(function(){o.addClass("loading"),o.height(o.outerHeight());var n=o.attr("id"),i=e.parents(".load__replace");$.get(e.attr("href"),function(t){var e=$(t).find("#"+n+" .load__main").html();o.addClass("loaded"),window.setTimeout(function(){i.replaceWith(e),window.on_transitionend(o,function(t){t&&t.target!==this||(o.removeAttr("style"),o.removeClass("loading loaded"),o.off(window.transitionend))}),o.height(o.find(".load__main").height()),window.create_reveal_elements(o),a()},200)})})}),a()}),$(function(){var a=$("body"),e=$("#canvas"),n=$("#navigation");window.onpageshow=function(t){t.persisted&&window.location.reload()},a.on("click","a",function(t){var e=$(this).attr("href"),n=$(this).attr("target"),i=$(this).hasClass("event"),o=$(this).hasClass("button--load");0!==e.indexOf("/")||o||n||i||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey||$("html").hasClass("cms-ready")||(t.preventDefault(),a.addClass("unload loading"),window.setTimeout(function(){window.location=e},50))}),a.on("click",".navigation__item__title",function(t){t.preventDefault();var e=$(this),n=e.parents(".navigation__main");n.attr("data-active")?n.removeAttr("data-active"):(n.attr("data-active",""),window.setTimeout(function(){n.attr("data-active",e.attr("data-id"))},220))}),a.on("mouseenter",".navigation__item",function(t){var e=$(this);e.parents(".navigation__main").attr("data-focus",e.attr("data-id"))}),a.on("mouseleave",".navigation__item",function(t){$(this).parents(".navigation__main").removeAttr("data-focus")}),a.on("mouseenter",".navigation__item__list a",function(t){var e=$(this);e.parents(".navigation__main").attr("data-hover",e.parents(".navigation__item").attr("data-id"))}),a.on("mouseleave",".navigation__item__list a",function(t){$(this).parents(".navigation__main").removeAttr("data-hover")}),a.on("click",".header__button--navigation",function(t){a.hasClass("search_open")?a.hasClass("_search")||a.hasClass("search_results")?($(this).removeClass("event"),$(this).click()):(t.preventDefault(),window.close_search()):a.hasClass("navigation_open")?(t.preventDefault(),function(){a.removeClass("notification_open"),n.removeAttr("style");var t=n.find(".navigation__main");a.removeClass("navigation_open"),window.requestAnimationFrame(function(){t.removeAttr("data-focus"),t.removeAttr("data-hover"),t.removeAttr("data-active"),e.removeAttr("style"),$(window).scrollTop(i),window.navigation_is_open=!1,window.timetable_can_scroll=!0})}()):(t.preventDefault(),window.timetable_can_scroll=!1,window.navigation_is_open=!0,a.removeClass("notification_open"),window.on_transitionend(n,function(){window.requestAnimationFrame(function(){n.css("position","relative"),n.off(window.transitionend)})}),window.requestAnimationFrame(function(){i=$(window).scrollTop(),e.css({top:-1*i,position:"fixed"}),window.requestAnimationFrame(function(){a.addClass("navigation_open")})}))});var i=0}),$(function(){var e=$("body"),n="last_notification_update",t=getCookie(n),i=$(".header__button--notification"),o=i.attr("data-updated");t!==o&&i.addClass("new"),e.on("click",".header__button--notification",function(t){t.preventDefault(),setCookie(n,o,90),$(this).removeClass("new"),e.toggleClass("notification_open")}),e.on("click",".notification__close",function(t){t.preventDefault(),e.removeClass("notification_open")})}),$(function(){var e=$("body"),n=$("#privacy-message"),i="tracking-accepted";window.privacy_accepted=getCookie(i),null===window.privacy_accepted?(n.removeAttr("style"),e.on("click",".privacy_action--accept",function(t){t.preventDefault(),setCookie(i,"true",60),n.remove(),e.trigger("enable_tracking")}),e.on("click",".privacy_action--decline",function(t){t.preventDefault(),setCookie(i,"false",60),n.remove()}),e.on("click",".privacy_action--close",function(t){t.preventDefault(),n.remove()})):(window.privacy_accepted="true"===window.privacy_accepted,n.remove())}),$(function(){var l=[];function n(){l=[];for(var t=document.querySelectorAll(".scroll"),e=0;e<t.length;e++){var n=t[e],i=n.offsetHeight,o=$(n).offset().top+i/2,a=(a=parseFloat(n.getAttribute("data-ease-multiplier")))||1;l.push({offset:o,element:n,mod:n.getAttribute("data-scroll-mod"),ease_multiplier:a})}}window.prevent_scroll_calc=!1,0<$("#timetable").length&&(window.prevent_scroll_calc=!0),window.prevent_scroll_calc||n(),window.calc_scrolls=n;var c=0;function i(){var t=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)/2,e=document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop;c=e+t;for(var n=0;n<l.length;n++){var i=l[n],o=i.offset-c,a="translateY",r="px",s=(o*=.05)*i.ease_multiplier;"rotate"===i.mod&&(a="rotate",r="deg"),"horizontal"===i.mod&&(a="translateX"),i.element.style.transform=a+"("+s+r+")",i.element.style.webkitTransform=a+"("+s+r+")",i.element.style.MozTransform=a+"("+s+r+")",i.element.style.msTransform=a+"("+s+r+")",i.element.style.OTransform=a+"("+s+r+")"}}window.requestAnimationFrame(function t(){window.navigation_is_open||i(),window.requestAnimationFrame(t)});var o=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;window.addEventListener("resize",function(t){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;if(document.querySelector("html").classList.contains("touchevents")&&o===e)return!1;o=e,window.prevent_scroll_calc||n(),window.requestAnimationFrame(function(){i()})},!1)}),$(function(){var a=$("body"),e=$("#canvas");a.on("click",".header__button--search",function(t){t.preventDefault(),window.timetable_can_scroll=!1,window.navigation_is_open=!0,window.requestAnimationFrame(function(){i=$(window).scrollTop(),e.css({top:-1*i,position:"fixed"}),window.requestAnimationFrame(function(){a.addClass("search_open"),window.clearTimeout(n),n=window.setTimeout(function(){a.find("#search__query").focus()},800)})})});var n,i=0;window.close_search=function(){window.clearTimeout(n),a.find("#search__query").blur(),window.requestAnimationFrame(function(){a.removeClass("search_open"),e.removeAttr("style"),$(window).scrollTop(i),window.navigation_is_open=!1,window.timetable_can_scroll=!0})},a.on("submit",".search__form",function(t){t.preventDefault();var e=$(this);a.find("#search__query").blur();var n,i=e.attr("action"),o=e.serialize();history.pushState({},"search",i+"?"+o),"q="!==o?((n=a.find(".search__content__main")).addClass("loading"),$.ajax({type:e.attr("method"),url:i,data:o,success:function(t){a.find("#canvas").remove(),a.addClass("_search"),n.removeClass("loading"),a.find(".search__results").replaceWith($(t).find(".search__results")),window.requestAnimationFrame(function(){a.addClass("search_results")})}})):a.removeClass("search_results")})}),$(function(){$("body").on("click",".search__contest__item",function(t){t.preventDefault(),$(this).hide()})}),$(function(){$("body").on("submit",".form",function(t){t.preventDefault();var n=$(this),i=n.attr("id");n.addClass("loading"),$.ajax({type:n.attr("method"),url:n.attr("action"),data:n.serialize(),success:function(t){django_recaptcha_callbacks=[];var e=$(t).find("#"+i);e.find(".reveal").each(function(){$(this).removeClass("reveal reveal_animation")}),e.removeClass("reveal reveal_animation"),n.replaceWith(e),djangoRecaptchaOnLoadCallback()}})})}),$(function(){$("body").on("click",".reference_list__item",function(t){t.preventDefault();var e,n=$(this),i=n.parents(".reference_list"),o=i.attr("data-active"),a=n.parents(".reference_list__item__frame").attr("data-id");o&&(e=i.find(".reference_list__video__item.data_id_"+o).find("iframe").get(0),new Vimeo.Player(e).pause()),"x"===a?i.removeAttr("data-active"):(i.attr("data-active",a),e=i.find(".reference_list__video__item.data_id_"+a).find("iframe").get(0),new Vimeo.Player(e).play())})}),$(function(){var t=$("body");function i(t){var e=parseInt(t.attr("data-active"));0<e&&window.requestAnimationFrame(function(){t.attr("data-active",e-1)})}function o(t){var e=parseInt(t.attr("data-active")),n=parseInt(t.attr("data-last"));e<n&&window.requestAnimationFrame(function(){t.attr("data-active",e+1)})}t.on("click",".slider__navigation",function(t){t.preventDefault();var e=$(this),n=e.parents(".slider");0===n.length&&(n=e.parents(".text_slider")),(e.hasClass("slider__navigation--prev")?i:o)(n)}),t.on("click",".slider__next",function(t){t.preventDefault(),o($(this).parents(".slider"))}),window.enable_touch_swipe(".slider",i,o),window.enable_touch_swipe(".text_slider",i,o)}),$(function(){var e=$("body"),r=$("#timetable");if(0===r.length)return!1;$(window).scrollTop(0),window.timetable_can_scroll=!1,window.setTimeout(function(){window.timetable_can_scroll=!0},2500);var n=!1;function i(){r.attr("data-active",1),r.find(".timetable__item").each(function(){$(this).addClass("reveal_container")}),window.setTimeout(function(){r.addClass("active"),window.requestAnimationFrame(function(){r.find(".timetable__item").each(function(){var t=parseInt($(this).attr("data-id"));scrollMonitor.create(this).enterViewport(function(){o(t)})}),window.create_reveal_elements(r),window.prevent_scroll_calc=!1,window.calc_scrolls(),n=!0})},1500)}window.requestAnimationFrame(function t(){window.navigation_is_open||(n?$(window).scrollTop()<.05*$(window).height()&&window.timetable_can_scroll&&(e.removeClass("notification_open"),window.prevent_scroll_calc=!0,r.attr("data-active",0),r.removeClass("active"),n=!1):$(window).scrollTop()>.05*$(window).height()&&window.timetable_can_scroll&&(e.removeClass("notification_open"),i())),window.requestAnimationFrame(t)});var s=0,l=parseInt(r.attr("data-last")),c=document.getElementsByClassName("timetable__item"),d=$(".timetable__next"),u=$("#timetable__clock__digital__time"),f=$("#timetable__clock__progress"),w=parseFloat(f.attr("stroke-dasharray"));function o(t){var e,n,i,o,a;t<=l&&0<=t&&(s=t,r.attr("data-active",s),s===l?d.addClass("hidden"):d.removeClass("hidden"),e=$(c[s-1]),n=60*parseInt(e.attr("data-hour"))+parseInt(e.attr("data-minute")),i=1/720*(n-360),o=u.text().split(":"),a=60*parseInt(o[0])+parseInt(o[1]),new CountUp("timetable__clock__digital__time",a,n,0,1.5,{useEasing:!0,separator:""}).start(),n&&f.attr("stroke-dashoffset",w*Math.abs(i-1)))}e.on("click",".timetable__next",function(t){t.preventDefault(),n||($(window).scrollTop($(window).height()),i())})}),$(function(){$("body").find(".video").each(function(){var t=$(this),e=this.querySelector("iframe"),n=new Vimeo.Player(e),i=!1;t.on("click",".video__thumbnail",function(t){t.preventDefault(),i?n.pause():n.play()}),n.on("play",function(){i=!0,window.requestAnimationFrame(function(){t.addClass("playing")})}),n.on("pause",function(){i=!1,window.requestAnimationFrame(function(){t.removeClass("playing")})}),n.on("ended",function(){i=!1,window.requestAnimationFrame(function(){t.removeClass("playing")})})})});