akkoma/priv/static/packs/common.js

3 lines
1.1 MiB
JavaScript
Raw Normal View History

2020-02-28 22:41:13 -07:00
/*! For license information please see common.js.LICENSE */
(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{1022:function(e,t,a){"use strict";var i,r=a(0),n=a(2),o=a(7),s=a(1),u=a(51),l=a.n(u),g=a(3),_=a.n(g),c=a(467),f=a(5),d=a.n(f),h=a(13),m=a(746);var p=function(e){if("boolean"!=typeof i){var t=e.target.getBoundingClientRect(),a=e.boundingClientRect;i=t.height!==a.height||t.top!==a.top||t.width!==a.width||t.bottom!==a.bottom||t.left!==a.left||t.right!==a.right}return i?e.target.getBoundingClientRect():e.boundingClientRect},F=["id","index","listLength","cachedHeight"],b=function(e){function t(){for(var t,a=arguments.length,i=new Array(a),r=0;r<a;r++)i[r]=arguments[r];return t=e.call.apply(e,[this].concat(i))||this,Object(s.a)(Object(n.a)(t),"state",{isHidden:!1}),Object(s.a)(Object(n.a)(t),"handleIntersection",(function(e){t.entry=e,Object(m.a)(t.calculateHeight),t.setState(t.updateStateAfterIntersection)})),Object(s.a)(Object(n.a)(t),"updateStateAfterIntersection",(function(e){return!1===e.isIntersecting||t.entry.isIntersecting||Object(m.a)(t.hideIfNotIntersecting),{isIntersecting:t.entry.isIntersecting,isHidden:!1}})),Object(s.a)(Object(n.a)(t),"calculateHeight",(function(){var e=t.props,a=e.onHeightChange,i=e.saveHeightKey,r=e.id;t.height=p(t.entry).height,a&&i&&a(i,r,t.height)})),Object(s.a)(Object(n.a)(t),"hideIfNotIntersecting",(function(){t.componentMounted&&t.setState((function(e){return{isHidden:!e.isIntersecting}}))})),Object(s.a)(Object(n.a)(t),"handleRef",(function(e){t.node=e})),t}Object(o.a)(t,e);var a=t.prototype;return a.shouldComponentUpdate=function(e,t){var a=this,i=!this.state.isIntersecting&&(this.state.isHidden||this.props.cachedHeight);return!!i!=!!(!t.isIntersecting&&(t.isHidden||e.cachedHeight))||(!i||!F.every((function(t){return e[t]===a.props[t]})))},a.componentDidMount=function(){var e=this.props,t=e.intersectionObserverWrapper,a=e.id;t.observe(a,this.node,this.handleIntersection),this.componentMounted=!0},a.componentWillUnmount=function(){var e=this.props,t=e.intersectionObserverWrapper,a=e.id;t.unobserve(a,this.node),this.componentMounted=!1},a.render=function(){var e=this.props,t=e.children,a=e.id,i=e.index,r=e.listLength,n=e.cachedHeight,o=this.state,s=o.isIntersecting,u=o.isHidden,l={};return s||!u&&!n||(l.height=(this.height||n||150)+"px",l.opacity=0,l.overflow="hidden"),_.a.createElement("article",{ref:this.handleRef,"aria-posinset":i+1,"aria-setsize":r,"data-id":a,tabIndex:"0",style:l},t&&_.a.cloneElement(t,{hidden:!s&&(u||!!n)}))},t}(_.a.Component),k=a(297),v=Object(h.connect)((function(e,t){return{cachedHeight:e.getIn(["height_cache",t.saveHeightKey,t.id])}}),(function(e){return{onHeightChange:function(t,a,i){e(Object(k.d)(t,a,i))}}}))(b),j=a(1051),y=a(6),w=function(e){function t(){return e.apply(this,arguments)||this}return Object(o.a)(t,e),t.prototype.render=function(){var e=this.props.count;return Object(r.a)("button",{className:"load-more load-gap",onClick:this.props.onClick},void 0,Object(r.a)(y.b,{id:"load_pending",defaultMessage:"{count, plural, one {# new item} other {# new items}}",values:{count:e}}))},t}(_.a.PureComponent),O=function(){function e(){Object(s.a)(this,"callbacks",{}),Object(s.a)(this,"observerBacklog",[]),Object(s.a)(this,"observer",null)}var t=e.prototype;return t.connect=function(e){var t=this;this.observer=new IntersectionObserver((function(e){e.forEach((function(e){var a=e.target.getAttribute("data-id");t.callbacks[a]&&t.callbacks[a](e)}))}),e),this.observerBacklog.forEach((function(e){var a=e[0],i=e[1],r=e[2];t.observe(a,i,r)})),this.observerBacklog=null},t.observe=function(e,t,a){this.observer?(this.callbacks[e]=a,this.observer.observe(t)):this.observerBacklog.push([e,t,a])},t.unobserve=function(e,t){this.observer&&(delete this.callbacks[e],this.observer.unobserve(t))},t.disconnect=function(){this.observer&&(this.callbacks={},this.observer.disconnect(),this.observer=null)},e}(),D=a(4),E=a(12),C=a.n(E),x=a(257),M=a(299);a.d(t,"a",(function(){return B}));var S=300,B=function(e){function t(){for(var t,a=arguments.length,i=new Array(a),r=0;r<a;r++)i[r]=arguments[r];return t=e.call.apply(e,[this].concat(i)
//# sourceMappingURL=common.js.map