2020-01-22 15:00:23 +00:00
|
|
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[48],{764:function(e,t,a){"use strict";a.r(t);var n=a(0),o=a(2),c=a(7),i=a(1),s=a(3),r=a.n(s),l=a(12),d=a(18),p=a.n(d),u=a(5),h=a.n(u),b=a(23),m=a(33),O=a(293),g=a(662),f=a(992),j=a(19),v=a(148),y=a(25),_=a(15),I=a(10),M=a.n(I),L=a(208),w=a(149),R=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),c=0;c<a;c++)n[c]=arguments[c];return t=e.call.apply(e,[this].concat(n))||this,Object(i.a)(Object(o.a)(t),"state",{visible:"hide_all"!==_.g&&!t.props.attachment.getIn(["status","sensitive"])||"show_all"===_.g,loaded:!1}),Object(i.a)(Object(o.a)(t),"setCanvasRef",function(e){t.canvas=e}),Object(i.a)(Object(o.a)(t),"handleImageLoad",function(){t.setState({loaded:!0})}),Object(i.a)(Object(o.a)(t),"handleMouseEnter",function(e){t.hoverToPlay()&&e.target.play()}),Object(i.a)(Object(o.a)(t),"handleMouseLeave",function(e){t.hoverToPlay()&&(e.target.pause(),e.target.currentTime=0)}),Object(i.a)(Object(o.a)(t),"handleClick",function(e){0!==e.button||e.ctrlKey||e.metaKey||(e.preventDefault(),t.state.visible?t.props.onOpenMedia(t.props.attachment):t.setState({visible:!0}))}),t}Object(c.a)(t,e);var a=t.prototype;return a.componentDidMount=function(){this.props.attachment.get("blurhash")&&this._decode()},a.componentDidUpdate=function(e){e.attachment.get("blurhash")!==this.props.attachment.get("blurhash")&&this.props.attachment.get("blurhash")&&this._decode()},a._decode=function(){var e=this.props.attachment.get("blurhash"),t=Object(L.decode)(e,32,32);if(t){var a=this.canvas.getContext("2d"),n=new ImageData(t,32,32);a.putImageData(n,0,0)}},a.hoverToPlay=function(){return!_.a&&-1!==["gifv","video"].indexOf(this.props.attachment.get("type"))},a.render=function(){var e=this.props,t=e.attachment,a=e.displayWidth,o=this.state,c=o.visible,i=o.loaded,s=Math.floor((a-4)/3)-4+"px",l=s,d=t.get("status"),p=d.get("spoiler_text")||t.get("description"),u="";if("unknown"===t.get("type"));else if("audio"===t.get("type"))u=Object(n.a)("span",{className:"account-gallery__item__icons"},void 0,Object(n.a)(y.a,{id:"music"}));else if("image"===t.get("type")){var h=100*((t.getIn(["meta","focus","x"])||0)/2+.5),b=100*((t.getIn(["meta","focus","y"])||0)/-2+.5);u=Object(n.a)("img",{src:t.get("preview_url"),alt:t.get("description"),title:t.get("description"),style:{objectPosition:h+"% "+b+"%"},onLoad:this.handleImageLoad})}else if(-1!==["gifv","video"].indexOf(t.get("type"))){var m=!Object(w.a)()&&_.a;u=Object(n.a)("div",{className:M()("media-gallery__gifv",{autoplay:m})},void 0,Object(n.a)("video",{className:"media-gallery__item-gifv-thumbnail","aria-label":t.get("description"),title:t.get("description"),role:"application",src:t.get("url"),onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,autoPlay:m,loop:!0,muted:!0}),Object(n.a)("span",{className:"media-gallery__gifv__label"},void 0,"GIF"))}var O=Object(n.a)("span",{className:"account-gallery__item__icons"},void 0,Object(n.a)(y.a,{id:"eye-slash"}));return Object(n.a)("div",{className:"account-gallery__item",style:{width:s,height:l}},void 0,Object(n.a)("a",{className:"media-gallery__item-thumbnail",href:d.get("url"),target:"_blank",onClick:this.handleClick,title:p},void 0,r.a.createElement("canvas",{width:32,height:32,ref:this.setCanvasRef,className:M()("media-gallery__preview",{"media-gallery__preview--hidden":c&&i})}),c?u:O))},t}(j.a);Object(i.a)(R,"propTypes",{attachment:p.a.map.isRequired,displayWidth:h.a.number.isRequired,onOpenMedia:h.a.func.isRequired});var x,C,k,S=a(997),T=a(460),N=a(991),D=a(969),E=a(42);a.d(t,"default",function(){return A});var q=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),c=0;c<a;c++)n[c]=arguments[c];return t=e.call.apply(e,[this].concat(n))||this,Object(i.a)(Object(o.a)(t),"handleLoadMore",function(){t.props.onLoadMore(t.props.maxId)}),t}return Object(c.a)(t,e),t.prototype.render=function(){return Object(n.a)(N.a,{disabled:this.props.disabled,onClick:this.handleLoadMore})},t}(j.a);Object(i.a)(q,"propTypes",{maxId:h.a.string,onLoadMore:h.a.func.isRequired});var A=Object(l.con
|