Pleroma/priv/static/packs/features/account_gallery.js

2 lines
7.3 KiB
JavaScript
Raw Normal View History

2020-01-22 16:00:23 +01:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{768:function(e,t,a){"use strict";a.r(t);var n=a(0),o=a(2),i=a(7),c=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(26),m=a(35),O=a(294),g=a(663),f=a(666),j=a(19),v=a(204),y=a(27),_=a(20),I=a(10),M=a.n(I),L=a(208),w=a(114),x=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return t=e.call.apply(e,[this].concat(n))||this,Object(c.a)(Object(o.a)(t),"state",{visible:"hide_all"!==_.f&&!t.props.attachment.getIn(["status","sensitive"])||"show_all"===_.f,loaded:!1}),Object(c.a)(Object(o.a)(t),"setCanvasRef",function(e){t.canvas=e}),Object(c.a)(Object(o.a)(t),"handleImageLoad",function(){t.setState({loaded:!0})}),Object(c.a)(Object(o.a)(t),"handleMouseEnter",function(e){t.hoverToPlay()&&e.target.play()}),Object(c.a)(Object(o.a)(t),"handleMouseLeave",function(e){t.hoverToPlay()&&(e.target.pause(),e.target.currentTime=0)}),Object(c.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(i.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,t=this.props,a=t.attachment,o=t.displayWidth,i=this.state,c=i.visible,s=i.loaded,l=Math.floor((o-4)/3)-4+"px",d=l,p=a.get("status"),u=p.get("spoiler_text")||a.get("description"),h="";if("unknown"===a.get("type"));else if("audio"===a.get("type"))h=Object(n.a)("span",{className:"account-gallery__item__icons"},void 0,Object(n.a)(y.a,{id:"music"}));else if("image"===a.get("type")){var b=100*((a.getIn(["meta","focus","x"])||0)/2+.5),m=100*((a.getIn(["meta","focus","y"])||0)/-2+.5);h=Object(n.a)("img",{src:a.get("preview_url"),alt:a.get("description"),title:a.get("description"),style:{objectPosition:b+"% "+m+"%"},onLoad:this.handleImageLoad})}else if(-1!==["gifv","video"].indexOf(a.get("type"))){var O=!Object(w.a)()&&_.a;h=Object(n.a)("div",{className:M()("media-gallery__gifv",{autoplay:O})},void 0,Object(n.a)("video",{className:"media-gallery__item-gifv-thumbnail","aria-label":a.get("description"),title:a.get("description"),role:"application",src:a.get("url"),onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,autoPlay:O,loop:!0,muted:!0}),Object(n.a)("span",{className:"media-gallery__gifv__label"},void 0,"GIF"))}return c||(e=Object(n.a)("span",{className:"account-gallery__item__icons"},void 0,Object(n.a)(y.a,{id:"eye-slash"}))),Object(n.a)("div",{className:"account-gallery__item",style:{width:l,height:d}},void 0,Object(n.a)("a",{className:"media-gallery__item-thumbnail",href:p.get("url"),target:"_blank",onClick:this.handleClick,title:u},void 0,r.a.createElement("canvas",{width:32,height:32,ref:this.setCanvasRef,className:M()("media-gallery__preview",{"media-gallery__preview--hidden":c&&s})}),c&&h,!c&&e))},t}(j.a);Object(c.a)(x,"propTypes",{attachment:p.a.map.isRequired,displayWidth:h.a.number.isRequired,onOpenMedia:h.a.func.isRequired});var R,S,C,N=a(998),T=a(460),k=a(994),A=a(970),D=a(47);a.d(t,"default",function(){return E});var q=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return t=e.call.apply(e,[this].concat(n))||this,Object(c.a)(Object(o.a)(t),"handleLoadMore",function(){t.props.onLoadMore(t.props.maxId)}),t}return Object(i.a)(t,e),t.prototype.render=function(){return Object(n.a)(k.a,{disabled:this.props.disabled,onClick:this.handleLoadMore})},t}(j.a);Object(c.a)(q,"propTypes",{shouldUpdateScroll:h.a.func,maxId:h.a.string,onLoadMore:h.a.
//# sourceMappingURL=account_gallery.js.map