distraction.party/priv/static/packs/features/list_timeline.js

2 lines
No EOL
18 KiB
JavaScript

webpackJsonp([11],{149:function(e,t,n){"use strict";n.d(t,"a",function(){return b});var o,i,r=n(2),s=n.n(r),a=n(1),c=n.n(a),l=n(3),d=n.n(l),u=n(4),h=n.n(u),p=n(0),f=n.n(p),g=n(6),b=(i=o=function(e){function t(){return c()(this,t),d()(this,e.apply(this,arguments))}return h()(t,e),t.prototype.render=function(){var e=this.props,t=e.disabled,n=e.visible;return s()("button",{className:"load-more",disabled:t||!n,style:{visibility:n?"visible":"hidden"},onClick:this.props.onClick},void 0,s()(g.b,{id:"status.load_more",defaultMessage:"Load more"}))},t}(f.a.PureComponent),o.defaultProps={visible:!0},i)},283:function(e,t,n){"use strict";function o(e){return function(t){t({type:r,account:e}),t(Object(i.d)("MUTE"))}}t.a=o;var i=(n(14),n(22),n(15),n(26)),r="MUTES_INIT_MODAL"},285:function(e,t,n){"use strict";function o(e,t){return function(n){n({type:r,account:e,status:t}),n(Object(i.d)("REPORT"))}}t.a=o;var i=(n(14),n(26)),r="REPORT_INIT"},286:function(e,t,n){"use strict";var o=n(2),i=n.n(o),r=n(0),s=(n.n(r),n(9)),a=n(152),c=n(67),l=n(18),d=n(68),u=n(22),h=n(92),p=n(283),f=n(285),g=n(26),b=n(6),v=n(12),m=(n(36),Object(b.f)({deleteConfirm:{id:"confirmations.delete.confirm",defaultMessage:"Delete"},deleteMessage:{id:"confirmations.delete.message",defaultMessage:"Are you sure you want to delete this status?"},blockConfirm:{id:"confirmations.block.confirm",defaultMessage:"Block"}})),y=function(){var e=Object(c.e)();return function(t,n){return{status:e(t,n.id)}}},M=function(e,t){var n=t.intl;return{onReply:function(t,n){e(Object(l.T)(t,n))},onModalReblog:function(t){e(Object(d.l)(t))},onReblog:function(t,n){t.get("reblogged")?e(Object(d.n)(t)):n.shiftKey||!v.b?this.onModalReblog(t):e(Object(g.d)("BOOST",{status:t,onReblog:this.onModalReblog}))},onFavourite:function(t){e(t.get("favourited")?Object(d.m)(t):Object(d.i)(t))},onDelete:function(t){e(v.e?Object(g.d)("CONFIRM",{message:n.formatMessage(m.deleteMessage),confirm:n.formatMessage(m.deleteConfirm),onConfirm:function(){return e(Object(h.f)(t.get("id")))}}):Object(h.f)(t.get("id")))},onDirect:function(t,n){e(Object(l.N)(t,n))},onMention:function(t,n){e(Object(l.R)(t,n))},onOpenMedia:function(t,n){e(Object(g.d)("MEDIA",{media:t,index:n}))},onOpenVideo:function(t,n){e(Object(g.d)("VIDEO",{media:t,time:n}))},onBlock:function(t){e(Object(g.d)("CONFIRM",{message:i()(b.b,{id:"confirmations.block.message",defaultMessage:"Are you sure you want to block {name}?",values:{name:i()("strong",{},void 0,"@",t.get("acct"))}}),confirm:n.formatMessage(m.blockConfirm),onConfirm:function(){return e(Object(u.q)(t.get("id")))}}))},onReport:function(t){e(Object(f.a)(t.get("account"),t))},onMute:function(t){e(Object(p.a)(t))},onMuteConversation:function(t){e(t.get("muted")?Object(h.k)(t.get("id")):Object(h.i)(t.get("id")))},onToggleHidden:function(t){e(t.get("hidden")?Object(h.j)(t.get("id")):Object(h.h)(t.get("id")))}}};t.a=Object(b.g)(Object(s.connect)(y,M)(a.a))},288:function(e,t,n){"use strict";n.d(t,"a",function(){return L});var o,i,r=n(2),s=n.n(r),a=n(1),c=n.n(a),l=n(3),d=n.n(l),u=n(4),h=n.n(u),p=n(94),f=n.n(p),g=n(0),b=n.n(g),v=n(151),m=n(5),y=n.n(m),M=n(289),O=n(149),I=n(294),j=n(8),C=(n.n(j),n(10)),k=n.n(C),_=n(153),L=(i=o=function(e){function t(){var n,o,i;c()(this,t);for(var r=arguments.length,s=Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=o=d()(this,e.call.apply(e,[this].concat(s))),o.state={lastMouseMove:null},o.intersectionObserverWrapper=new I.a,o.handleScroll=f()(function(){if(o.node){var e=o.node,t=e.scrollTop,n=e.scrollHeight,i=e.clientHeight,r=n-t-i;o._oldScrollPosition=n-t,400>r&&o.props.onLoadMore&&!o.props.isLoading&&o.props.onLoadMore(),t<100&&o.props.onScrollToTop?o.props.onScrollToTop():o.props.onScroll&&o.props.onScroll()}},150,{trailing:!0}),o.handleMouseMove=f()(function(){o._lastMouseMove=new Date},300),o.handleMouseLeave=function(){o._lastMouseMove=null},o.onFullScreenChange=function(){o.setState({fullscreen:Object(_.d)()})},o.setRef=function(e){o.node=e},o.handleLoadMore=function(e){e.preventDefault(),o.props.onLoadMore()},i=n,d()(o,i)}return h()(t,e),t.prototype.componentDidMount=function(){this.attachScrollListener(),this.attachIntersectionObserver(),Object(_.a)(this.onFullScreenChange),this.handleScroll()},t.prototype.componentDidUpdate=function(e){if(b.a.Children.count(e.children)>0&&b.a.Children.count(e.children)<b.a.Children.count(this.props.children)&&this.getFirstChildKey(e)!==this.getFirstChildKey(this.props)&&this._oldScrollPosition&&this.node.scrollTop>0){var t=this.node.scrollHeight-this._oldScrollPosition;this.node.scrollTop!==t&&(this.node.scrollTop=t)}else this._oldScrollPosition=this.node.scrollHeight-this.node.scrollTop},t.prototype.componentWillUnmount=function(){this.detachScrollListener(),this.detachIntersectionObserver(),Object(_.b)(this.onFullScreenChange)},t.prototype.attachIntersectionObserver=function(){this.intersectionObserverWrapper.connect({root:this.node,rootMargin:"300% 0px"})},t.prototype.detachIntersectionObserver=function(){this.intersectionObserverWrapper.disconnect()},t.prototype.attachScrollListener=function(){this.node.addEventListener("scroll",this.handleScroll)},t.prototype.detachScrollListener=function(){this.node.removeEventListener("scroll",this.handleScroll)},t.prototype.getFirstChildKey=function(e){var t=e.children,n=t;return t instanceof j.List?n=t.get(0):Array.isArray(t)&&(n=t[0]),n&&n.key},t.prototype._recentlyMoved=function(){return null!==this._lastMouseMove&&new Date-this._lastMouseMove<600},t.prototype.render=function(){var e=this,t=this.props,n=t.children,o=t.scrollKey,i=t.trackScroll,r=t.shouldUpdateScroll,a=t.isLoading,c=t.hasMore,l=t.prepend,d=t.emptyMessage,u=t.onLoadMore,h=this.state.fullscreen,p=b.a.Children.count(n),f=c&&p>0&&u?s()(O.a,{visible:!a,onClick:this.handleLoadMore}):null,g=null;return g=a||p>0||!d?b.a.createElement("div",{className:k()("scrollable",{fullscreen:h}),ref:this.setRef,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave},s()("div",{role:"feed",className:"item-list"},void 0,l,b.a.Children.map(this.props.children,function(t,n){return s()(M.a,{id:t.key,index:n,listLength:p,intersectionObserverWrapper:e.intersectionObserverWrapper,saveHeightKey:i?e.context.router.route.location.key+":"+o:null},t.key,t)}),f)):b.a.createElement("div",{className:"empty-column-indicator",ref:this.setRef},d),i?s()(v.a,{scrollKey:o,shouldUpdateScroll:r},void 0,g):g},t}(g.PureComponent),o.contextTypes={router:y.a.object},o.defaultProps={trackScroll:!0},i)},289:function(e,t,n){"use strict";var o=n(9),i=n(290),r=n(95),s=function(e,t){return{cachedHeight:e.getIn(["height_cache",t.saveHeightKey,t.id])}},a=function(e){return{onHeightChange:function(t,n,o){e(Object(r.d)(t,n,o))}}};t.a=Object(o.connect)(s,a)(i.a)},290:function(e,t,n){"use strict";n.d(t,"a",function(){return b});var o=n(1),i=n.n(o),r=n(3),s=n.n(r),a=n(4),c=n.n(a),l=n(0),d=n.n(l),u=n(291),h=n(293),p=n(8),f=(n.n(p),["id","index","listLength"]),g=["id","index","listLength","cachedHeight"],b=function(e){function t(){var n,o,r;i()(this,t);for(var a=arguments.length,c=Array(a),l=0;l<a;l++)c[l]=arguments[l];return n=o=s()(this,e.call.apply(e,[this].concat(c))),o.state={isHidden:!1},o.handleIntersection=function(e){o.entry=e,Object(u.a)(o.calculateHeight),o.setState(o.updateStateAfterIntersection)},o.updateStateAfterIntersection=function(e){return e.isIntersecting&&!o.entry.isIntersecting&&Object(u.a)(o.hideIfNotIntersecting),{isIntersecting:o.entry.isIntersecting,isHidden:!1}},o.calculateHeight=function(){var e=o.props,t=e.onHeightChange,n=e.saveHeightKey,i=e.id;o.height=Object(h.a)(o.entry).height,t&&n&&t(n,i,o.height)},o.hideIfNotIntersecting=function(){o.componentMounted&&o.setState(function(e){return{isHidden:!e.isIntersecting}})},o.handleRef=function(e){o.node=e},r=n,s()(o,r)}return c()(t,e),t.prototype.shouldComponentUpdate=function(e,t){var n=this,o=!this.state.isIntersecting&&(this.state.isHidden||this.props.cachedHeight);return!!o!=!(t.isIntersecting||!t.isHidden&&!e.cachedHeight)||!(o?g:f).every(function(t){return Object(p.is)(e[t],n.props[t])})},t.prototype.componentDidMount=function(){var e=this.props,t=e.intersectionObserverWrapper,n=e.id;t.observe(n,this.node,this.handleIntersection),this.componentMounted=!0},t.prototype.componentWillUnmount=function(){var e=this.props,t=e.intersectionObserverWrapper,n=e.id;t.unobserve(n,this.node),this.componentMounted=!1},t.prototype.render=function(){var e=this.props,t=e.children,n=e.id,o=e.index,i=e.listLength,r=e.cachedHeight,s=this.state,a=s.isIntersecting,c=s.isHidden;return a||!c&&!r?d.a.createElement("article",{ref:this.handleRef,"aria-posinset":o,"aria-setsize":i,"data-id":n,tabIndex:"0"},t&&d.a.cloneElement(t,{hidden:!1})):d.a.createElement("article",{ref:this.handleRef,"aria-posinset":o,"aria-setsize":i,style:{height:(this.height||r)+"px",opacity:0,overflow:"hidden"},"data-id":n,tabIndex:"0"},t&&d.a.cloneElement(t,{hidden:!0}))},t}(d.a.Component)},291:function(e,t,n){"use strict";function o(e){for(;a.length&&e.timeRemaining()>0;)a.shift()();a.length?requestIdleCallback(o):c=!1}function i(e){a.push(e),c||(c=!0,requestIdleCallback(o))}var r=n(292),s=n.n(r),a=new s.a,c=!1;t.a=i},292:function(e,t,n){"use strict";function o(){this.length=0}o.prototype.push=function(e){var t={item:e};this.last?this.last=this.last.next=t:this.last=this.first=t,this.length++},o.prototype.shift=function(){var e=this.first;if(e)return this.first=e.next,--this.length||(this.last=void 0),e.item},o.prototype.slice=function(e,t){e=void 0===e?0:e,t=void 0===t?1/0:t;for(var n=[],o=0,i=this.first;i&&!(--t<0);i=i.next)++o>e&&n.push(i.item);return n},e.exports=o},293:function(e,t,n){"use strict";function o(e){if("boolean"!=typeof i){var t=e.target.getBoundingClientRect(),n=e.boundingClientRect;i=t.height!==n.height||t.top!==n.top||t.width!==n.width||t.bottom!==n.bottom||t.left!==n.left||t.right!==n.right}return i?e.target.getBoundingClientRect():e.boundingClientRect}var i=void 0;t.a=o},294:function(e,t,n){"use strict";var o=n(1),i=n.n(o),r=function(){function e(){i()(this,e),this.callbacks={},this.observerBacklog=[],this.observer=null}return e.prototype.connect=function(e){var t=this,n=function(e){e.forEach(function(e){var n=e.target.getAttribute("data-id");t.callbacks[n]&&t.callbacks[n](e)})};this.observer=new IntersectionObserver(n,e),this.observerBacklog.forEach(function(e){var n=e[0],o=e[1],i=e[2];t.observe(n,o,i)}),this.observerBacklog=null},e.prototype.observe=function(e,t,n){this.observer?(this.callbacks[e]=n,this.observer.observe(t)):this.observerBacklog.push([e,t,n])},e.prototype.unobserve=function(e,t){this.observer&&(delete this.callbacks[e],this.observer.unobserve(t))},e.prototype.disconnect=function(){this.observer&&(this.callbacks={},this.observer.disconnect(),this.observer=null)},e}();t.a=r},295:function(e,t,n){"use strict";n.d(t,"a",function(){return E});var o,i,r,s,a=n(29),c=n.n(a),l=n(30),d=n.n(l),u=n(2),h=n.n(u),p=n(1),f=n.n(p),g=n(3),b=n.n(g),v=n(4),m=n.n(v),y=n(34),M=n.n(y),O=n(0),I=n.n(O),j=n(13),C=n.n(j),k=n(5),_=n.n(k),L=n(286),S=n(11),R=n.n(S),x=n(149),T=n(288),N=n(6),H=(i=o=function(e){function t(){var n,o,i;f()(this,t);for(var r=arguments.length,s=Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=o=b()(this,e.call.apply(e,[this].concat(s))),o.handleClick=function(){o.props.onClick(o.props.maxId)},i=n,b()(o,i)}return m()(t,e),t.prototype.render=function(){return h()(x.a,{onClick:this.handleClick,disabled:this.props.disabled})},t}(R.a),o.propTypes={disabled:_.a.bool,maxId:_.a.string,onClick:_.a.func.isRequired},i),E=(s=r=function(e){function t(){var n,o,i;f()(this,t);for(var r=arguments.length,s=Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=o=b()(this,e.call.apply(e,[this].concat(s))),o.handleMoveUp=function(e){var t=o.props.statusIds.indexOf(e)-1;o._selectChild(t)},o.handleMoveDown=function(e){var t=o.props.statusIds.indexOf(e)+1;o._selectChild(t)},o.handleLoadOlder=M()(function(){o.props.onLoadMore(o.props.statusIds.last())},300,{leading:!0}),o.setRef=function(e){o.node=e},i=n,b()(o,i)}return m()(t,e),t.prototype._selectChild=function(e){var t=this.node.node.querySelector("article:nth-of-type("+(e+1)+") .focusable");t&&t.focus()},t.prototype.render=function(){var e=this,t=this.props,n=t.statusIds,o=t.onLoadMore,i=d()(t,["statusIds","onLoadMore"]),r=i.isLoading;if(i.isPartial)return h()("div",{className:"regeneration-indicator"},void 0,h()("div",{},void 0,h()("div",{className:"regeneration-indicator__label"},void 0,h()(N.b,{id:"regeneration_indicator.label",tagName:"strong",defaultMessage:"Loading…"}),h()(N.b,{id:"regeneration_indicator.sublabel",defaultMessage:"Your home feed is being prepared!"}))));var s=r||n.size>0?n.map(function(t,i){return null===t?h()(H,{disabled:r,maxId:i>0?n.get(i-1):null,onClick:o},"gap:"+n.get(i+1)):h()(L.a,{id:t,onMoveUp:e.handleMoveUp,onMoveDown:e.handleMoveDown},t)}):null;return I.a.createElement(T.a,c()({},i,{onLoadMore:o&&this.handleLoadOlder,ref:this.setRef}),s)},t}(R.a),r.propTypes={scrollKey:_.a.string.isRequired,statusIds:C.a.list.isRequired,onLoadMore:_.a.func,onScrollToTop:_.a.func,onScroll:_.a.func,trackScroll:_.a.bool,shouldUpdateScroll:_.a.func,isLoading:_.a.bool,isPartial:_.a.bool,hasMore:_.a.bool,prepend:_.a.node,emptyMessage:_.a.node},r.defaultProps={trackScroll:!0},s)},809:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"default",function(){return H});var o,i,r,s,a=n(2),c=n.n(a),l=n(1),d=n.n(l),u=n(3),h=n.n(u),p=n(4),f=n.n(p),g=n(0),b=n.n(g),v=n(9),m=n(5),y=n.n(m),M=n(93),O=n(70),I=n(69),j=n(298),C=n(6),k=n(71),_=n(19),L=n(301),S=n(26),R=n(843),x=n(297),T=Object(C.f)({deleteMessage:{id:"confirmations.delete_list.message",defaultMessage:"Are you sure you want to permanently delete this list?"},deleteConfirm:{id:"confirmations.delete_list.confirm",defaultMessage:"Delete"}}),N=function(e,t){return{list:e.getIn(["lists",t.params.id]),hasUnread:e.getIn(["timelines","list:"+t.params.id,"unread"])>0}},H=(o=Object(v.connect)(N))(i=Object(C.g)((s=r=function(e){function t(){var n,o,i;d()(this,t);for(var r=arguments.length,s=Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=o=h()(this,e.call.apply(e,[this].concat(s))),o.handlePin=function(){var e=o.props,t=e.columnId,n=e.dispatch;t?n(Object(j.f)(t)):(n(Object(j.d)("LIST",{id:o.props.params.id})),o.context.router.history.push("/"))},o.handleMove=function(e){var t=o.props,n=t.columnId;(0,t.dispatch)(Object(j.e)(n,e))},o.handleHeaderClick=function(){o.column.scrollTop()},o.setRef=function(e){o.column=e},o.handleLoadMore=function(e){var t=o.props.params.id;o.props.dispatch(Object(_.p)(t,{maxId:e}))},o.handleEditClick=function(){o.props.dispatch(Object(S.d)("LIST_EDITOR",{listId:o.props.params.id}))},o.handleDeleteClick=function(){var e=o.props,t=e.dispatch,n=e.columnId,i=e.intl,r=o.props.params.id;t(Object(S.d)("CONFIRM",{message:i.formatMessage(T.deleteMessage),confirm:i.formatMessage(T.deleteConfirm),onConfirm:function(){t(Object(L.u)(r)),n?t(Object(j.f)(n)):o.context.router.history.push("/lists")}}))},i=n,h()(o,i)}return f()(t,e),t.prototype.componentDidMount=function(){var e=this.props.dispatch,t=this.props.params.id;e(Object(L.v)(t)),e(Object(_.p)(t)),this.disconnect=e(Object(k.c)(t))},t.prototype.componentWillUnmount=function(){this.disconnect&&(this.disconnect(),this.disconnect=null)},t.prototype.render=function(){var e=this.props,t=e.hasUnread,n=e.columnId,o=e.multiColumn,i=e.list,r=this.props.params.id,s=!!n,a=i?i.get("title"):r;return void 0===i?c()(O.a,{},void 0,c()("div",{className:"scrollable"},void 0,c()(x.a,{}))):!1===i?c()(O.a,{},void 0,c()("div",{className:"scrollable"},void 0,c()(R.a,{}))):b.a.createElement(O.a,{ref:this.setRef},c()(I.a,{icon:"bars",active:t,title:a,onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:s,multiColumn:o},void 0,c()("div",{className:"column-header__links"},void 0,c()("button",{className:"text-btn column-header__setting-btn",tabIndex:"0",onClick:this.handleEditClick},void 0,c()("i",{className:"fa fa-pencil"})," ",c()(C.b,{id:"lists.edit",defaultMessage:"Edit list"})),c()("button",{className:"text-btn column-header__setting-btn",tabIndex:"0",onClick:this.handleDeleteClick},void 0,c()("i",{className:"fa fa-trash"})," ",c()(C.b,{id:"lists.delete",defaultMessage:"Delete list"}))),c()("hr",{})),c()(M.a,{trackScroll:!s,scrollKey:"list_timeline-"+n,timelineId:"list:"+r,onLoadMore:this.handleLoadMore,emptyMessage:c()(C.b,{id:"empty_column.list",defaultMessage:"There is nothing in this list yet. When members of this list post new statuses, they will appear here."})}))},t}(b.a.PureComponent),r.contextTypes={router:y.a.object},i=s))||i)||i},843:function(e,t,n){"use strict";var o=n(2),i=n.n(o),r=n(0),s=(n.n(r),n(6)),a=function(){return i()("div",{className:"regeneration-indicator missing-indicator"},void 0,i()("div",{},void 0,i()("div",{className:"regeneration-indicator__label"},void 0,i()(s.b,{id:"missing_indicator.label",tagName:"strong",defaultMessage:"Not found"}),i()(s.b,{id:"missing_indicator.sublabel",defaultMessage:"This resource could not be found"}))))};t.a=a},93:function(e,t,n){"use strict";var o=n(34),i=n.n(o),r=n(9),s=n(295),a=n(19),c=n(8),l=(n.n(c),n(96)),d=(n.n(l),n(12)),u=function(){return Object(l.createSelector)([function(e,t){var n=t.type;return e.getIn(["settings",n],Object(c.Map)())},function(e,t){var n=t.type;return e.getIn(["timelines",n,"items"],Object(c.List)())},function(e){return e.get("statuses")}],function(e,t,n){var o=e.getIn(["regex","body"],"").trim(),i=null;try{i=o&&new RegExp(o,"i")}catch(e){}return t.filter(function(t){var o=n.get(t),r=!0;if(!1===e.getIn(["shows","reblog"])&&(r=r&&null===o.get("reblog")),!1===e.getIn(["shows","reply"])&&(r=r&&(null===o.get("in_reply_to_id")||o.get("in_reply_to_account_id")===d.g)),r&&i&&o.get("account")!==d.g){var s=o.get("reblog")?n.getIn([o.get("reblog"),"search_index"]):o.get("search_index");r=!i.test(s)}return r})})},h=function(){var e=u();return function(t,n){var o=n.timelineId;return{statusIds:e(t,{type:o}),isLoading:t.getIn(["timelines",o,"isLoading"],!0),isPartial:t.getIn(["timelines",o,"isPartial"],!1),hasMore:t.getIn(["timelines",o,"hasMore"])}}},p=function(e,t){var n=t.timelineId;return{onScrollToTop:i()(function(){e(Object(a.r)(n,!0))},100),onScroll:i()(function(){e(Object(a.r)(n,!1))},100)}};t.a=Object(r.connect)(h,p)(s.a)}});
//# sourceMappingURL=list_timeline.js.map