1 line
17 KiB
JavaScript
1 line
17 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{2:function(e,t,o){"use strict";var n=Object.assign||function(e){for(var t,o=1;o<arguments.length;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},i=function(e){return"IMG"===e.tagName},r=function(e){return e&&1===e.nodeType},s=function(e){return".svg"===(e.currentSrc||e.src).substr(-4).toLowerCase()},a=function(e){try{return Array.isArray(e)?e.filter(i):function(e){return NodeList.prototype.isPrototypeOf(e)}(e)?[].slice.call(e).filter(i):r(e)?[e].filter(i):"string"==typeof e?[].slice.call(document.querySelectorAll(e)).filter(i):[]}catch(e){throw new TypeError("The provided selector is invalid.\nExpects a CSS selector, a Node element, a NodeList or an array.\nSee: https://github.com/francoischalifour/medium-zoom")}},c=function(e,t){var o=n({bubbles:!1,cancelable:!1,detail:void 0},t);if("function"==typeof window.CustomEvent)return new CustomEvent(e,o);var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,o.bubbles,o.cancelable,o.detail),i},l=window.Promise||function(e){function t(){}e(t,t)};!function(e,t){void 0===t&&(t={});var o=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===o&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}(".medium-zoom-overlay{position:fixed;top:0;right:0;bottom:0;left:0;opacity:0;transition:opacity .3s;will-change:opacity}.medium-zoom--opened .medium-zoom-overlay{cursor:pointer;cursor:zoom-out;opacity:1}.medium-zoom-image{cursor:pointer;cursor:zoom-in;transition:transform .3s cubic-bezier(.2,0,.2,1)}.medium-zoom-image--hidden{visibility:hidden}.medium-zoom-image--opened{position:relative;cursor:pointer;cursor:zoom-out;will-change:transform}"),t.a=function e(t){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];var n=t.reduce(function(e,t){return[].concat(e,a(t))},[]);return n.filter(function(e){return-1===f.indexOf(e)}).forEach(function(e){f.push(e),e.classList.add("medium-zoom-image")}),p.forEach(function(e){var t=e.type,o=e.listener,i=e.options;n.forEach(function(e){e.addEventListener(t,o,i)})}),b},d=function(){var e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).target,t=function(){var e=Math.min,t={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},o=void 0,i=void 0;if(v.container)if(v.container instanceof Object)o=(t=n({},t,v.container)).width-t.left-t.right-2*v.margin,i=t.height-t.top-t.bottom-2*v.margin;else{var a=(r(v.container)?v.container:document.querySelector(v.container)).getBoundingClientRect(),c=a.width,l=a.height,d=a.left,u=a.top;t=n({},t,{width:c,height:l,left:d,top:u})}o=o||t.width-2*v.margin,i=i||t.height-2*v.margin;var m=y.zoomedHd||y.original,f=s(m)?o:m.naturalWidth||o,p=s(m)?i:m.naturalHeight||i,h=m.getBoundingClientRect(),g=h.top,w=h.left,b=h.width,z=h.height,k=e(f,o)/b,E=e(p,i)/z,C=e(k,E),S="scale("+C+") translate3d("+((o-b)/2-w+v.margin+t.left)/C+"px, "+((i-z)/2-g+v.margin+t.top)/C+"px, 0)";y.zoomed.style.transform=S,y.zoomedHd&&(y.zoomedHd.style.transform=S)};return new l(function(o){if(e&&-1===f.indexOf(e))o(b);else if(y.zoomed)o(b);else{if(e)y.original=e;else{if(!(0<f.length))return void o(b);var n=f;y.original=n[0]}if(y.original.dispatchEvent(c("medium-zoom:open",{detail:{zoom:b}})),g=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,h=!0,y.zoomed=function(e){var t=e.getBoundingClientRect(),o=t.top,n=t.left,i=t.width,r=t.height,s=e.cloneNode(),a=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,c=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;return s.removeAttribute("id"),s.style.position="absolute",s.style.top=o+a+"px",s.style.left=n+c+"px",s.style.width=i+"px",s.style.height=r+"px",s.style.transform="",s}(y.original),document.body.appendChild(w),v.template){var i=r(v.template)?v.template:document.querySelector(v.template);y.template=document.createElement("div"),y.template.appendChild(i.content.cloneNode(!0)),document.body.appendChild(y.template)}if(document.body.appendChild(y.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),y.original.classList.add("medium-zoom-image--hidden"),y.zoomed.classList.add("medium-zoom-image--opened"),y.zoomed.addEventListener("click",u),y.zoomed.addEventListener("transitionend",function e(){h=!1,y.zoomed.removeEventListener("transitionend",e),y.original.dispatchEvent(c("medium-zoom:opened",{detail:{zoom:b}})),o(b)}),y.original.getAttribute("data-zoom-src")){y.zoomedHd=y.zoomed.cloneNode(),y.zoomedHd.removeAttribute("srcset"),y.zoomedHd.removeAttribute("sizes"),y.zoomedHd.src=y.zoomed.getAttribute("data-zoom-src"),y.zoomedHd.onerror=function(){clearInterval(s),console.warn("Unable to reach the zoom image target "+y.zoomedHd.src),y.zoomedHd=null,t()};var s=setInterval(function(){y.zoomedHd.complete&&(clearInterval(s),y.zoomedHd.classList.add("medium-zoom-image--opened"),y.zoomedHd.addEventListener("click",u),document.body.appendChild(y.zoomedHd),t())},10)}else if(y.original.hasAttribute("srcset")){y.zoomedHd=y.zoomed.cloneNode(),y.zoomedHd.removeAttribute("sizes");var a=y.zoomedHd.addEventListener("load",function(){y.zoomedHd.removeEventListener("load",a),y.zoomedHd.classList.add("medium-zoom-image--opened"),y.zoomedHd.addEventListener("click",u),document.body.appendChild(y.zoomedHd),t()})}else t()}})},u=function(){return new l(function(e){!h&&y.original?(h=!0,document.body.classList.remove("medium-zoom--opened"),y.zoomed.style.transform="",y.zoomedHd&&(y.zoomedHd.style.transform=""),y.template&&(y.template.style.transition="opacity 150ms",y.template.style.opacity=0),y.original.dispatchEvent(c("medium-zoom:close",{detail:{zoom:b}})),y.zoomed.addEventListener("transitionend",function t(){y.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(y.zoomed),y.zoomedHd&&document.body.removeChild(y.zoomedHd),document.body.removeChild(w),y.zoomed.classList.remove("medium-zoom-image--opened"),y.template&&document.body.removeChild(y.template),h=!1,y.zoomed.removeEventListener("transitionend",t),y.original.dispatchEvent(c("medium-zoom:closed",{detail:{zoom:b}})),y.original=null,y.zoomed=null,y.zoomedHd=null,y.template=null,e(b)})):e(b)})},m=function(){var e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).target;return y.original?u():d({target:e})},f=[],p=[],h=!1,g=0,v=o,y={original:null,zoomed:null,zoomedHd:null,template:null};"[object Object]"===Object.prototype.toString.call(t)?v=t:(t||"string"==typeof t)&&i(t);var w=function(e){var t=document.createElement("div");return t.classList.add("medium-zoom-overlay"),t.style.background=e,t}((v=n({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},v)).background);document.addEventListener("click",function(e){var t=e.target;return t===w?void u():void(-1===f.indexOf(t)||m({target:t}))}),document.addEventListener("keyup",function(e){27===(e.keyCode||e.which)&&u()}),document.addEventListener("scroll",function(){if(!h&&y.original){var e=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(g-e)>v.scrollOffset&&setTimeout(u,150)}}),window.addEventListener("resize",u);var b={open:d,close:u,toggle:m,update:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e;if(e.background&&(w.style.background=e.background),e.container&&e.container instanceof Object&&(t.container=n({},v.container,e.container)),e.template){var o=r(e.template)?e.template:document.querySelector(e.template);t.template=o}return v=n({},v,t),f.forEach(function(e){e.dispatchEvent(c("medium-zoom:update",{detail:{zoom:b}}))}),b},clone:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return e(n({},v,t))},attach:i,detach:function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];y.zoomed&&u();var n=0<t.length?t.reduce(function(e,t){return[].concat(e,a(t))},[]):f;return n.forEach(function(e){e.classList.remove("medium-zoom-image"),e.dispatchEvent(c("medium-zoom:detach",{detail:{zoom:b}}))}),f=f.filter(function(e){return-1===n.indexOf(e)}),b},on:function(e,t){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return f.forEach(function(n){n.addEventListener("medium-zoom:"+e,t,o)}),p.push({type:"medium-zoom:"+e,listener:t,options:o}),b},off:function(e,t){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return f.forEach(function(n){n.removeEventListener("medium-zoom:"+e,t,o)}),p=p.filter(function(o){return o.type!=="medium-zoom:"+e||o.listener.toString()!==t.toString()}),b},getOptions:function(){return v},getImages:function(){return f},getZoomedImage:function(){return y.original}};return b}},3:function(e,t,o){"use strict";var n=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object"],i=".fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}";function r(e,t){return"string"==typeof e&&(t=e,e=document),Array.prototype.slice.call(e.querySelectorAll(t))}function s(e){return"string"==typeof e?e.split(",").map(c).filter(a):function(e){return"[object Array]"===Object.prototype.toString.call(e)}(e)?function(e){return[].concat.apply([],e)}(e.map(s).filter(a)):e||[]}function a(e){return e.length>0}function c(e){return e.replace(/^\s+|\s+$/g,"")}e.exports=function(e,t){var o;t=t||{},o=e=e||"body","[object Object]"===Object.prototype.toString.call(o)&&(t=e,e="body"),t.ignore=t.ignore||"",t.players=t.players||"";var c=r(e);if(a(c)){var l;if(!document.getElementById("fit-vids-style"))(document.head||document.getElementsByTagName("head")[0]).appendChild(((l=document.createElement("div")).innerHTML='<p>x</p><style id="fit-vids-style">'+i+"</style>",l.childNodes[1]));var d=s(t.players)||[],u=s(t.ignore)||[],m=n.filter(function(e){if(e.length<1)return function(){return!0};return function(t){return-1===e.indexOf(t)}}(u)).concat(d).join();a(m)&&c.forEach(function(e){r(e,m).forEach(function(e){!function(e){if(/fluid-width-video-wrapper/.test(e.parentNode.className))return;var t=parseInt(e.getAttribute("width"),10),o=parseInt(e.getAttribute("height"),10),n=isNaN(t)?e.clientWidth:t,i=(isNaN(o)?e.clientHeight:o)/n;e.removeAttribute("width"),e.removeAttribute("height");var r=document.createElement("div");e.parentNode.insertBefore(r,e),r.className="fluid-width-video-wrapper",r.style.paddingTop=100*i+"%",r.appendChild(e)}(e)})})}}},38:function(e,t,o){e.exports=o(42)},42:function(e,t,o){"use strict";o.r(t);var n=o(0),i=o.n(n),r=(o(4),function(){function e(e,t){var o=void 0!==t?t:{};this.version="3.6.1",this.userAgent=window.navigator.userAgent||"no `userAgent` provided by the browser",this.props={customStickyChangeNumber:o.customStickyChangeNumber||null,noStyles:o.noStyles||!1,stickyBitStickyOffset:o.stickyBitStickyOffset||0,parentClass:o.parentClass||"js-stickybit-parent",scrollEl:"string"==typeof o.scrollEl?document.querySelector(o.scrollEl):o.scrollEl||window,stickyClass:o.stickyClass||"js-is-sticky",stuckClass:o.stuckClass||"js-is-stuck",stickyChangeClass:o.stickyChangeClass||"js-is-sticky--change",useStickyClasses:o.useStickyClasses||!1,useFixed:o.useFixed||!1,useGetBoundingClientRect:o.useGetBoundingClientRect||!1,verticalPosition:o.verticalPosition||"top"},this.props.positionVal=this.definePosition()||"fixed",this.instances=[];var n=this.props,i=n.positionVal,r=n.verticalPosition,s=n.noStyles,a=n.stickyBitStickyOffset,c=n.useStickyClasses,l="top"!==r||s?"":a+"px",d="fixed"!==i?i:"";this.els="string"==typeof e?document.querySelectorAll(e):e,"length"in this.els||(this.els=[this.els]);for(var u=0;u<this.els.length;u++){var m=this.els[u];if(m.style[r]=l,m.style.position=d,"fixed"===i||c){var f=this.addInstance(m,this.props);this.instances.push(f)}}}var t=e.prototype;return t.definePosition=function(){var e;if(this.props.useFixed)e="fixed";else{for(var t=["","-o-","-webkit-","-moz-","-ms-"],o=document.head.style,n=0;n<t.length;n+=1)o.position=t[n]+"sticky";e=o.position?o.position:"fixed",o.position=""}return e},t.addInstance=function(e,t){var o=this,n={el:e,parent:e.parentNode,props:t};this.isWin=this.props.scrollEl===window;var i=this.isWin?window:this.getClosestParent(n.el,n.props.scrollEl);return this.computeScrollOffsets(n),n.parent.className+=" "+t.parentClass,n.state="default",n.stateContainer=function(){return o.manageState(n)},i.addEventListener("scroll",n.stateContainer),n},t.getClosestParent=function(e,t){var o=t,n=e;if(n.parentElement===o)return o;for(;n.parentElement!==o;)n=n.parentElement;return o},t.getTopPosition=function(e){if(this.props.useGetBoundingClientRect)return e.getBoundingClientRect().top+(this.props.scrollEl.pageYOffset||document.documentElement.scrollTop);var t=0;do{t=e.offsetTop+t}while(e=e.offsetParent);return t},t.computeScrollOffsets=function(e){var t=e,o=t.props,n=t.el,i=t.parent,r=!this.isWin&&"fixed"===o.positionVal,s="bottom"!==o.verticalPosition,a=r?this.getTopPosition(o.scrollEl):0,c=r?this.getTopPosition(i)-a:this.getTopPosition(i),l=null!==o.customStickyChangeNumber?o.customStickyChangeNumber:n.offsetHeight,d=c+i.offsetHeight;return t.offset=a+o.stickyBitStickyOffset,t.stickyStart=s?c-t.offset:0,t.stickyChange=t.stickyStart+l,t.stickyStop=s?d-(n.offsetHeight+t.offset):d-window.innerHeight,t},t.toggleClasses=function(e,t,o){var n=e,i=n.className.split(" ");o&&-1===i.indexOf(o)&&i.push(o);var r=i.indexOf(t);-1!==r&&i.splice(r,1),n.className=i.join(" ")},t.manageState=function(e){var t=e,o=t.el,n=t.props,i=t.state,r=t.stickyStart,s=t.stickyChange,a=t.stickyStop,c=o.style,l=n.noStyles,d=n.positionVal,u=n.scrollEl,m=n.stickyClass,f=n.stickyChangeClass,p=n.stuckClass,h=n.verticalPosition,g="bottom"!==h,v=function(e){e()},y=this.isWin&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame)||v,w=this.toggleClasses,b=this.isWin?window.scrollY||window.pageYOffset:u.scrollTop,z=g&&b<=r&&("sticky"===i||"stuck"===i),k=b>=a&&"sticky"===i;b>r&&b<a&&("default"===i||"stuck"===i)?(t.state="sticky",y(function(){w(o,p,m),c.position=d,l||(c.bottom="",c[h]=n.stickyBitStickyOffset+"px")})):z?(t.state="default",y(function(){w(o,m),w(o,p),"fixed"===d&&(c.position="")})):k&&(t.state="stuck",y(function(){w(o,m,p),"fixed"!==d||l||(c.top="",c.bottom="0",c.position="absolute")}));var E=b>=s&&b<=a;return b<s/2||b>a?y(function(){w(o,f)}):E&&y(function(){w(o,"stub",f)}),t},t.update=function(e){void 0===e&&(e=null);for(var t=0;t<this.instances.length;t+=1){var o=this.instances[t];if(this.computeScrollOffsets(o),e)for(var n in e)o.props[n]=e[n]}return this},t.removeInstance=function(e){var t=e.el,o=e.props,n=this.toggleClasses;t.style.position="",t.style[o.verticalPosition]="",n(t,o.stickyClass),n(t,o.stuckClass),n(t.parentNode,o.parentClass)},t.cleanup=function(){for(var e=0;e<this.instances.length;e+=1){var t=this.instances[e];t.props.scrollEl.removeEventListener("scroll",t.stateContainer),this.removeInstance(t)}this.manageState=!1,this.instances=[]},e}());var s=function(e,t){return new r(e,t)},a=o(2),c=o(3),l=o.n(c);i()(document).ready(function(){l()(".js-post-content");var e=i()(".js-aos-wrapper"),t=i()(".js-progress"),o=i()(".js-scrolltop"),n=i()(".js-load-comments"),r=i()(".js-comments-iframe"),c=i()(".js-recommended-articles"),d=window.pageYOffset,u=0,m=0,f=0,p=!1;function h(){return window.matchMedia("(max-width: 768px)").matches}function g(){p||requestAnimationFrame(v),p=!0}function v(){var e=m-u,o=Math.ceil(d/e*100);o<=100&&function(e){if(e<=100){var o=f-e/100*f;t[0].style.strokeDashoffset=o}}(1.5*o),p=!1}function y(){u=window.innerHeight,m=i()(document).height()}function w(){var e=t.parent().width()/2,o=h()?2:3;t.attr("stroke-width",o),t.attr("r",e-(o-1)),t.attr("cx",e),t.attr("cy",e),f=2*e*Math.PI,t[0].style.strokeDasharray="".concat(f," ").concat(f),t[0].style.strokeDashoffset=f}document.querySelectorAll(".kg-gallery-image img").forEach(function(e){var t=e.closest(".kg-gallery-image"),o=e.attributes.width.value/e.attributes.height.value;t.style.flex="".concat(o," 1 0%")}),c.length>0?(c.on("init",function(){y(),w(),v()}),c.slick({arrows:!0,infinite:!0,prevArrow:'<button class="m-icon-button filled in-recommended-articles slick-prev"><span class="icon-arrow-left"></span></button>',nextArrow:'<button class="m-icon-button filled in-recommended-articles slick-next"><span class="icon-arrow-right"></span></button>',mobileFirst:!0,responsive:[{breakpoint:720,settings:{slidesToShow:2}},{breakpoint:1023,settings:{arrows:!1,slidesToShow:3}}]})):(y(),w(),v()),o.click(function(){i()("html, body").animate({scrollTop:0},500)}),setTimeout(function(){e.removeAttr("data-aos")},700),h()?(i()("body").addClass("share-menu-displayed"),setTimeout(function(){i()(".js-wrapper-aos").removeAttr("data-aos")},1e3)):s(".js-sticky",{stickyBitStickyOffset:100}),n.click(function(){n.parent().hide(),r.fadeIn("slow")}),i()(".js-post-content").find("img").each(function(){i()(this).addClass("js-zoomable")}),Object(a.a)(".js-zoomable"),window.addEventListener("scroll",function(){d=window.pageYOffset,g()},{passive:!0}),window.addEventListener("resize",function(){y(),setTimeout(function(){w(),g()},200)},!1)})}},[[38,0,1]]]); |