jahresbericht2017/assets/js/skrollr.js

1 line
12 KiB
JavaScript
Raw Normal View History

2024-01-12 13:52:51 +00:00
!function(e,t,r){"use strict";function n(r){if(o=t.documentElement,a=t.body,_(),$=this,r=r||{},R=r.constants||{},r.easing)for(var n in r.easing)F[n]=r.easing[n];Q=r.edgeStrategy||"set",K={beforerender:r.beforerender,render:r.render,keyframe:r.keyframe},Y=r.forceHeight!==!1,Y&&(ge=r.scale||1),U=r.mobileDeceleration||p,j=r.smoothScrolling!==!1,W=r.smoothScrollingDuration||g,Z={targetTop:$.getScrollTop()},xe=(r.mobileCheck||function(){return/Android|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent||navigator.vendor||e.opera)})(),xe?(G=t.getElementById(r.skrollrBody||v),G&&M(),C(),fe(o,[f,m],[u])):fe(o,[f,d],[u]),$.refresh(),re(e,"resize orientationchange",function(){var e=o.clientWidth,t=o.clientHeight;t===ke&&e===Te||(ke=t,Te=e,Se=!0)});var l=E();return function e(){I(),te=l(e)}(),$}var o,a,l={get:function(){return $},init:function(e){return $||new n(e)},VERSION:"0.6.30"},i=Object.prototype.hasOwnProperty,s=e.Math,c=e.getComputedStyle,f="skrollr",u="no-"+f,d=f+"-desktop",m=f+"-mobile",p=.004,v="skrollr-body",g=200,h=/^(?:input|textarea|button|select)$/i,y=/\s*(@?[\w\-\[\]]+)\s*:\s*(.+?)\s*(?:;|$)/gi,b=function(e,t){return t.toUpperCase()},T=/\{\?\}/g,k=/rgba?\(\s*-?\d+\s*,\s*-?\d+\s*,\s*-?\d+/g,S=/[a-z\-]+-gradient/g,w="",x="",_=function(){var e=/^(?:O|Moz|webkit|ms)|(?:-(?:o|moz|webkit|ms)-)/;if(c){var t=c(a,null);for(var r in t)if(w=r.match(e)||+r==r&&t[r].match(e))break;if(!w)return void(w=x="");w=w[0],"-"===w.slice(0,1)?(x=w,w={"-webkit-":"webkit","-moz-":"Moz","-ms-":"ms","-o-":"O"}[w]):x="-"+w.toLowerCase()+"-"}},E=function(){var t=e.requestAnimationFrame||e[w.toLowerCase()+"RequestAnimationFrame"],r=me();return!xe&&t||(t=function(t){var n=me()-r,o=s.max(0,1e3/60-n);return e.setTimeout(function(){r=me(),t()},o)}),t},A=function(){var t=e.cancelAnimationFrame||e[w.toLowerCase()+"CancelAnimationFrame"];return!xe&&t||(t=function(t){return e.clearTimeout(t)}),t},F={begin:function(){return 0},end:function(){return 1},linear:function(e){return e},quadratic:function(e){return e*e},cubic:function(e){return e*e*e},swing:function(e){return-s.cos(e*s.PI)/2+.5},sqrt:function(e){return s.sqrt(e)},outCubic:function(e){return s.pow(e-1,3)+1},bounce:function(e){var t;if(e<=.5083)t=3;else if(e<=.8489)t=9;else if(e<=.96208)t=27;else{if(!(e<=.99981))return 1;t=91}return 1-s.abs(3*s.cos(e*t*1.028)/t)}};n.prototype.refresh=function(e){var r,n,o=!1;for(void 0===e?(o=!0,B=[],we=0,e=t.getElementsByTagName("*")):void 0===e.length&&(e=[e]),r=0,n=e.length;r<n;r++){var a=e[r],l=a,i=[],s=j,c=Q,f=!1;if(o&&"___skrollable_id"in a&&delete a.___skrollable_id,a.attributes){for(var u=0,d=a.attributes.length;u<d;u++){var m=a.attributes[u];if("data-anchor-target"!==m.name)if("data-smooth-scrolling"!==m.name)if("data-edge-strategy"!==m.name)if("data-emit-events"!==m.name){var p=m.name.match(/^data(?:-(_\w+))?(?:-?(-?\d*\.?\d+p?))?(?:-?(start|end|top|center|bottom))?(?:-?(top|center|bottom))?$/);if(null!==p){var v={props:m.value,element:a,eventType:m.name.replace(/-([a-z0-9_])/g,b)};i.push(v);var g=p[1];g&&(v.constant=g.substr(1));var h=p[2];/p$/.test(h)?(v.isPercentage=!0,v.offset=(0|h.slice(0,-1))/100):v.offset=0|h;var y=p[3],T=p[4]||y;y&&"start"!==y&&"end"!==y?(v.mode="relative",v.anchors=[y,T]):(v.mode="absolute","end"===y?v.isEnd=!0:v.isPercentage||(v.offset=v.offset*ge))}}else f=!0;else c=m.value;else s="off"!==m.value;else if(null===(l=t.querySelector(m.value)))throw'Unable to find anchor target "'+m.value+'"'}if(i.length){var k,S,w;!o&&"___skrollable_id"in a?(w=a.___skrollable_id,k=B[w].styleAttr,S=B[w].classAttr):(w=a.___skrollable_id=we++,k=a.style.cssText,S=ce(a)),B[w]={element:a,styleAttr:k,classAttr:S,anchorTarget:l,keyFrames:i,smoothScrolling:s,edgeStrategy:c,emitEvents:f,lastFrameIndex:-1},fe(a,["skrollable"],[])}}}for(le(),r=0,n=e.length;r<n;r++){var x=B[e[r].___skrollable_id];void 0!==x&&(P(x),N(x))}return $},n.prototype.relativeToAbsolute=function(e,t,r){var n=o.clientHeight,a=e.getBoundingClientRect(),l=a.top,i=a.bottom-a.top;return"bottom"===t?l-=n:"center"===t&&(l-=n/2),"bottom"===r?l+=i:"center"===r&&(l+=i/2),(l+=$.getScrollTop(