Files
Zos-Website/vendor.js

2 lines
117 KiB
JavaScript
Raw Normal View History

window.Element&&!Element.prototype.closest&&(Element.prototype.closest=function(e){var t,i=(this.document||this.ownerDocument).querySelectorAll(e),s=this;do{for(t=i.length;--t>=0&&i.item(t)!==s;);}while(t<0&&(s=s.parentElement));return s}),function(){for(var e=0,t=["ms","moz","webkit","o"],i=0;i<t.length&&!window.requestAnimationFrame;++i)window.requestAnimationFrame=window[t[i]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[i]+"CancelAnimationFrame"]||window[t[i]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,i){var s=(new Date).getTime(),a=Math.max(0,16-(s-e)),n=window.setTimeout(function(){t(s+a)},a);return e=s+a,n}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}(),function(e,t){"function"==typeof define&&define.amd?define([],function(){return t(e)}):"object"==typeof exports?module.exports=t(e):e.SmoothScroll=t(e)}("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,function(e){"use strict";var t="querySelector"in document&&"addEventListener"in e&&"requestAnimationFrame"in e&&"closest"in e.Element.prototype,i={ignore:"[data-scroll-ignore]",header:null,speed:500,offset:0,easing:"easeInOutCubic",customEasing:null,before:function(){},after:function(){}},s=function(){for(var e={},t=0,i=arguments.length,s=function(t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};t<i;t++){s(arguments[t])}return e},a=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,i=String(e),s=i.length,a=-1,n="",r=i.charCodeAt(0);++a<s;){if(0===(t=i.charCodeAt(a)))throw new InvalidCharacterError("Invalid character: the input contains U+0000.");t>=1&&t<=31||127==t||0===a&&t>=48&&t<=57||1===a&&t>=48&&t<=57&&45===r?n+="\\"+t.toString(16)+" ":n+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?i.charAt(a):"\\"+i.charAt(a)}return"#"+n},n=function(t){return t?(i=t,parseInt(e.getComputedStyle(i).height,10)+t.offsetTop):0;var i};return function(r,o){var l,d,h,c,u,p,f,v={};v.cancelScroll=function(){cancelAnimationFrame(f)},v.animateScroll=function(t,a,r){var o=s(l||i,r||{}),d="[object Number]"===Object.prototype.toString.call(t),h=d||!t.tagName?null:t;if(d||h){var p=e.pageYOffset;o.header&&!c&&(c=document.querySelector(o.header)),u||(u=n(c));var f,m,g,b=d?t:function(e,t,i){var s=0;if(e.offsetParent)do{s+=e.offsetTop,e=e.offsetParent}while(e);return s=Math.max(s-t-i,0)}(h,u,parseInt("function"==typeof o.offset?o.offset():o.offset,10)),w=b-p,y=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),x=0,E=function(i,s){var n=e.pageYOffset;if(i==s||n==s||(p<s&&e.innerHeight+n)>=y)return v.cancelScroll(),r=t,l=s,d||(r.focus(),document.activeElement.id!==r.id&&(r.setAttribute("tabindex","-1"),r.focus(),r.style.outline="none"),e.scrollTo(0,l)),o.after(t,a),f=null,!0;var r,l},T=function(t){f||(f=t),m=(x+=t-f)/parseInt(o.speed,10),g=p+w*function(e,t){var i;return"easeInQuad"===e.easing&&(i=t*t),"easeOutQuad"===e.easing&&(i=t*(2-t)),"easeInOutQuad"===e.easing&&(i=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e.easing&&(i=t*t*t),"easeOutCubic"===e.easing&&(i=--t*t*t+1),"easeInOutCubic"===e.easing&&(i=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e.easing&&(i=t*t*t*t),"easeOutQuart"===e.easing&&(i=1- --t*t*t*t),"easeInOutQuart"===e.easing&&(i=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e.easing&&(i=t*t*t*t*t),"easeOutQuint"===e.easing&&(i=1+--t*t*t*t*t),"easeInOutQuint"===e.easing&&(i=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),e.customEasing&&(i=e.customEasing(t)),i||t}(o,m=m>1?1:m),e.scrollTo(0,Math.floor(g)),E(g,b)||(e.requestAnimationFrame(T),f=t)};0===e.pageYOffset&&e.scrollTo(0,0),o.before(t,a),v.cancelScroll(),e.requestAnimationFrame(T)}};var m=function(e){d&&(d.id=d.getAttribute("data-scroll-id"),v.animateScroll(d,h),d=null,h=null)},g=function(t){if(!("matchMedia"in e&&e.matchMedia("(prefers-reduced-motion)").matches)&&0===t.button&&!t.metaKey&&!t.ctrlKey&&(h=t.target