-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.js
1 lines (1 loc) · 2.88 KB
/
index.js
1
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t){var r,n,o=1e4,i=3e3,c=function(e){return document.querySelector(e)},s=function(e){return Array.from(document.querySelectorAll(e))};function a(e){var t,r,n=e.parentSelector,a=e.itemSelector,l=e.prevSelector,u=e.nextSelector,f=c(n),d=s("".concat(n," ").concat(a)),v=c(l),p=c(u),m=0,b=d.length-1,h=m;function L(e){var t=0;f.classList.add("hide-scrollbars"),clearTimeout(r),function n(){var o=f.scrollLeft-e,i=Math.abs(o);if(i<=1)f.classList.remove("hide-scrollbars");else{var c=.06*i;c<1&&(c=1);var s=o>0?c:-c,a=Math.floor(f.scrollLeft-s);t+=.3,f.scroll(a,0),r=setTimeout(n,t)}}()}function S(){clearTimeout(t)}function y(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).direction,t=void 0===e?"next":e;h<m&&"prev"===t&&(h=b),h<m&&(h=b),h>b&&(h=m);var r=d[h].offsetLeft-f.offsetLeft,n=d[b];if(n.offsetLeft+n.offsetWidth-f.offsetWidth-f.offsetLeft-f.scrollLeft<10&&"next"===t&&(r=0,h=0),"prev"===t&&f.scrollLeft>10&&r>f.scrollLeft)return h-=1,y({direction:"prev"});L(r)}function x(){S(),h+=1,y(),t=setTimeout(x,i)}function g(){S(),t=setTimeout(x,o)}f.addEventListener("mousemove",g),f.addEventListener("mousein",g),f.addEventListener("mouseout",g),f.addEventListener("scroll",g),d.forEach(function(e){e.addEventListener("mousemove",g)}),v.addEventListener("click",function(){g(),h-=1,y({direction:"prev"})}),p.addEventListener("click",function(){g(),h+=1,y({direction:"next"})}),t=setTimeout(x,o)}function l(){if(null!==n){var e=n.offsetWidth;r.setAttribute("width",e),r.setAttribute("height",e/560*315)}}window.addEventListener("load",function(){r=c("iframe#benefits-video-inner"),n=c("div#benefits-video-outer"),l(),a({parentSelector:"#partnerships-organizations-carousel",itemSelector:".carousel-item",prevSelector:"#partnerships-organizations-prev",nextSelector:"#partnerships-organizations-next"}),a({parentSelector:"#partnerships-media-carousel",itemSelector:".carousel-item",prevSelector:"#partnerships-media-prev",nextSelector:"#partnerships-media-next"})}),window.addEventListener("resize",l)}]);