2 lines
4.9 KiB
JavaScript
2 lines
4.9 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[43],{718:function(a,e,t){"use strict";t.r(e);var l=t(0),n=t(2),o=t(6),s=t(1),c=t(3),i=t.n(c),r=t(21),d=t(26),p=t.n(d),u=t(5),b=t.n(u),h=t(23),m=t(34),O=t(271),j=t(625),f=t(913),g=t(25),v=t(191),I=t(317),y=t(29),_=function(c){function a(){for(var a,e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return a=c.call.apply(c,[this].concat(t))||this,Object(s.a)(Object(n.a)(a),"state",{visible:"hide_all"!==y.f&&!a.props.media.getIn(["status","sensitive"])||"show_all"===y.f}),Object(s.a)(Object(n.a)(a),"handleClick",function(){return!a.state.visible&&(a.setState({visible:!0}),!0)}),a}return Object(o.a)(a,c),a.prototype.render=function(){var a,e,t,o=this.props.media,c=this.state.visible,n=o.get("status"),s=100*(o.getIn(["meta","focus","x"])/2+.5),i=100*(o.getIn(["meta","focus","y"])/-2+.5),r={};return"gifv"===o.get("type")&&(a=Object(l.a)("span",{className:"media-gallery__gifv__label"},void 0,"GIF")),t=c?(r.backgroundImage="url("+o.get("preview_url")+")",r.backgroundPosition=s+"% "+i+"%",o.get("description")):(e=Object(l.a)("span",{className:"account-gallery__item__icons"},void 0,Object(l.a)("i",{className:"fa fa-eye-slash"})),n.get("spoiler_text")||o.get("description")),Object(l.a)("div",{className:"account-gallery__item"},void 0,Object(l.a)(I.a,{to:"/statuses/"+n.get("id"),href:n.get("url"),style:r,title:t,onInterceptClick:this.handleClick},void 0,e,a))},a}(g.a);Object(s.a)(_,"propTypes",{media:p.a.map.isRequired});var M,L,k,w=t(916),S=t(427),C=t(912),R=t(896);t.d(e,"default",function(){return x});var T=function(c){function a(){for(var a,e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return a=c.call.apply(c,[this].concat(t))||this,Object(s.a)(Object(n.a)(a),"handleLoadMore",function(){a.props.onLoadMore(a.props.maxId)}),a}return Object(o.a)(a,c),a.prototype.render=function(){return Object(l.a)(C.a,{disabled:this.props.disabled,onClick:this.handleLoadMore})},a}(g.a);Object(s.a)(T,"propTypes",{maxId:b.a.string,onLoadMore:b.a.func.isRequired});var x=Object(r.connect)(function(a,e){return{isAccount:!!a.getIn(["accounts",e.params.accountId]),medias:Object(v.a)(a,e.params.accountId),isLoading:a.getIn(["timelines","account:"+e.params.accountId+":media","isLoading"]),hasMore:a.getIn(["timelines","account:"+e.params.accountId+":media","hasMore"])}})((k=L=function(c){function a(){for(var o,a=arguments.length,e=new Array(a),t=0;t<a;t++)e[t]=arguments[t];return o=c.call.apply(c,[this].concat(e))||this,Object(s.a)(Object(n.a)(o),"handleHeaderClick",function(){o.column.scrollTop()}),Object(s.a)(Object(n.a)(o),"handleScrollToBottom",function(){o.props.hasMore&&o.handleLoadMore(0<o.props.medias.size?o.props.medias.last().getIn(["status","id"]):void 0)}),Object(s.a)(Object(n.a)(o),"handleScroll",function(a){var e=a.target,t=e.scrollTop;e.scrollHeight-t-e.clientHeight<150&&!o.props.isLoading&&o.handleScrollToBottom()}),Object(s.a)(Object(n.a)(o),"handleLoadMore",function(a){o.props.dispatch(Object(m.o)(o.props.params.accountId,{maxId:a}))}),Object(s.a)(Object(n.a)(o),"handleLoadOlder",function(a){a.preventDefault(),o.handleScrollToBottom()}),Object(s.a)(Object(n.a)(o),"shouldUpdateScroll",function(a,e){var t=e.location;return!(((a||{}).location||{}).state||{}).mastodonModalOpen&&!(t.state&&t.state.mastodonModalOpen)}),Object(s.a)(Object(n.a)(o),"setRef",function(a){o.column=a}),o}Object(o.a)(a,c);var e=a.prototype;return e.componentDidMount=function(){this.props.dispatch(Object(h.F)(this.props.params.accountId)),this.props.dispatch(Object(m.o)(this.props.params.accountId))},e.componentWillReceiveProps=function(a){a.params.accountId!==this.props.params.accountId&&a.params.accountId&&(this.props.dispatch(Object(h.F)(a.params.accountId)),this.props.dispatch(Object(m.o)(this.props.params.accountId)))},e.render=function(){var t=this,a=this.props,o=a.medias,e=a.isLoading,c=a.hasMore;if(!a.isAccount)return Object(l.a)(j.a,{},void 0,Object(l.a)(R.a,{}));var n=null;return!o&&e?Object(l.a)(j.a,{},void 0,Object(l.a)(O.a,{})):(!c||e&&0===o.size||(n=Object(l.a)(C.a,{visible:!e,onClick:this.handleLoadOlder})),i.a.createElement(j.a,{ref:this.setRef},Object(l.a)(f.a,{onClick:this.handleHeaderClick}),Object(l.a)(S.a,{scrollKey:"account_gallery",shouldUpdateScroll:this.shouldUpdateScroll},void 0,Object(l.a)("div",{className:"scrollable scrollable--flex",onScroll:this.handleScroll},void 0,Object(l.a)(w.a,{accountId:this.props.params.accountId}),Object(l.a)("div",{role:"feed",className:"account-gallery__container"},void 0,o.map(function(a,e){return null===a?Object(l.a)(T,{maxId:0<e?o.getIn(e-1,"id"):null,onLoadMore:t.handleLoadMore},"more:"+o.getIn(e+1,"id")):Object(l.a)(_,{media:a},a.get("id"))}),n),e&&0===o.size&&Object(l.a)("div",{className:"scrollable__append"},void 0,Object(l.a)(O.a,{}))))))},a}(g.a),Object(s.a)(L,"propTypes",{params:b.a.object.isRequired,dispatch:b.a.func.isRequired,medias:p.a.list.isRequired,isLoading:b.a.bool,hasMore:b.a.bool,isAccount:b.a.bool}),M=k))||M}}]);
|
|
//# sourceMappingURL=account_gallery.js.map
|