qb_akkoma/priv/static/packs/features/account_gallery.js
Haelwenn (lanodan) Monnier 83e3afac2c Update mastodon frontend
2018-09-20 16:13:13 +00:00

2 lines
No EOL
3.9 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{704:function(a,t,o){"use strict";o.r(t);var e,n,s,r,i,c,d,l=o(0),p=o.n(l),u=o(6),h=o.n(u),m=o(3),f=o.n(m),g=o(7),v=o.n(g),I=(o(1),o(12)),y=o(17),b=o.n(y),L=o(2),_=o.n(L),M=o(13),k=o(19),S=o(194),w=o(193),O=o(196),j=o(18),T=o(32),N=o(71),R=o(10),q=(n=e=function(a){function t(){var o,e,n;h()(this,t);for(var s=arguments.length,r=Array(s),i=0;i<s;i++)r[i]=arguments[i];return o=e=f()(this,a.call.apply(a,[this].concat(r))),e.state={visible:!e.props.media.getIn(["status","sensitive"])||R.f},e.handleClick=function(){return!e.state.visible&&(e.setState({visible:!0}),!0)},n=o,f()(e,n)}return v()(t,a),t.prototype.render=function(){var a=this.props.media,t=this.state.visible,o=a.get("status"),e=100*(a.getIn(["meta","focus","x"])/2+.5),n=100*(a.getIn(["meta","focus","y"])/-2+.5),s={},r=void 0,i=void 0;return"gifv"===a.get("type")&&(r=p()("span",{className:"media-gallery__gifv__label"},void 0,"GIF")),t?(s.backgroundImage="url("+a.get("preview_url")+")",s.backgroundPosition=e+"% "+n+"%"):i=p()("span",{className:"account-gallery__item__icons"},void 0,p()("i",{className:"fa fa-eye-slash"})),p()("div",{className:"account-gallery__item"},void 0,p()(N.a,{to:"/statuses/"+o.get("id"),href:o.get("url"),style:s,onInterceptClick:this.handleClick},void 0,i,r))},t}(j.a),e.propTypes={media:b.a.map.isRequired},n),x=o(694),C=o(123),A=o(211);o.d(t,"default",function(){return U});var B=(r=s=function(a){function t(){var o,e,n;h()(this,t);for(var s=arguments.length,r=Array(s),i=0;i<s;i++)r[i]=arguments[i];return o=e=f()(this,a.call.apply(a,[this].concat(r))),e.handleLoadMore=function(){e.props.onLoadMore(e.props.maxId)},n=o,f()(e,n)}return v()(t,a),t.prototype.render=function(){return p()(A.a,{disabled:this.props.disabled,onLoadMore:this.handleLoadMore})},t}(j.a),s.propTypes={shouldUpdateScroll:_.a.func,maxId:_.a.string,onLoadMore:_.a.func.isRequired},r),U=Object(I.connect)(function(a,t){return{medias:Object(T.a)(a,t.params.accountId),isLoading:a.getIn(["timelines","account:"+t.params.accountId+":media","isLoading"]),hasMore:a.getIn(["timelines","account:"+t.params.accountId+":media","hasMore"])}})((d=c=function(a){function t(){var o,e,n;h()(this,t);for(var s=arguments.length,r=Array(s),i=0;i<s;i++)r[i]=arguments[i];return o=e=f()(this,a.call.apply(a,[this].concat(r))),e.handleScrollToBottom=function(){e.props.hasMore&&e.handleLoadMore(e.props.medias.last().getIn(["status","id"]))},e.handleScroll=function(a){var t=a.target,o=t.scrollTop;150>t.scrollHeight-o-t.clientHeight&&!e.props.isLoading&&e.handleScrollToBottom()},e.handleLoadMore=function(a){e.props.dispatch(Object(k.k)(e.props.params.accountId,{maxId:a}))},e.handleLoadOlder=function(a){a.preventDefault(),e.handleScrollToBottom()},n=o,f()(e,n)}return v()(t,a),t.prototype.componentDidMount=function(){this.props.dispatch(Object(M.w)(this.props.params.accountId)),this.props.dispatch(Object(k.k)(this.props.params.accountId))},t.prototype.componentWillReceiveProps=function(a){a.params.accountId!==this.props.params.accountId&&a.params.accountId&&(this.props.dispatch(Object(M.w)(a.params.accountId)),this.props.dispatch(Object(k.k)(this.props.params.accountId)))},t.prototype.render=function(){var a=this.props,t=a.medias,o=a.shouldUpdateScroll,e=a.isLoading,n=a.hasMore,s=null;return!t&&e?p()(w.a,{},void 0,p()(S.a,{})):(!e&&t.size>0&&n&&(s=p()(A.a,{onClick:this.handleLoadOlder})),p()(w.a,{},void 0,p()(O.a,{}),p()(C.a,{scrollKey:"account_gallery",shouldUpdateScroll:o},void 0,p()("div",{className:"scrollable",onScroll:this.handleScroll},void 0,p()(x.a,{accountId:this.props.params.accountId}),p()("div",{className:"account-gallery__container"},void 0,t.map(function(a,o){return null===a?p()(B,{maxId:o>0?t.getIn(o-1,"id"):null},"more:"+t.getIn(o+1,"id")):p()(q,{media:a},a.get("id"))}),s)))))},t}(j.a),c.propTypes={params:_.a.object.isRequired,dispatch:_.a.func.isRequired,medias:b.a.list.isRequired,isLoading:_.a.bool,hasMore:_.a.bool},i=d))||i}}]);
//# sourceMappingURL=account_gallery.js.map