pleroma/priv/static/packs/flavours/glitch/async/account_gallery.js

2 lines
8.3 KiB
JavaScript
Raw Normal View History

2020-05-20 01:55:14 -04:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[50],{859:function(t,e,a){"use strict";a.r(e),a.d(e,"default",(function(){return H}));var n=a(0),o=a(2),c=a(9),i=a(6),s=a(8),r=a(1),l=a(3),d=a.n(l),p=a(15),u=a(16),h=a.n(u),b=a(5),m=a.n(b),f=a(24),O=a(34),g=a(305),j=a(756),v=a(1079),y=a(21),_=a(108),I=a(215),M=a(14),L=a.n(M),w=a(25),R=a(18),C=a(154);var x=function(t){Object(s.a)(a,t);var e;e=a;function a(){for(var e,a=arguments.length,n=new Array(a),c=0;c<a;c++)n[c]=arguments[c];return e=t.call.apply(t,[this].concat(n))||this,Object(r.a)(Object(o.a)(e),"state",{visible:"hide_all"!==R.g&&!e.props.attachment.getIn(["status","sensitive"])||"show_all"===R.g,loaded:!1}),Object(r.a)(Object(o.a)(e),"setCanvasRef",(function(t){e.canvas=t})),Object(r.a)(Object(o.a)(e),"handleImageLoad",(function(){e.setState({loaded:!0})})),Object(r.a)(Object(o.a)(e),"handleMouseEnter",(function(t){e.hoverToPlay()&&t.target.play()})),Object(r.a)(Object(o.a)(e),"handleMouseLeave",(function(t){e.hoverToPlay()&&(t.target.pause(),t.target.currentTime=0)})),Object(r.a)(Object(o.a)(e),"handleClick",(function(t){0!==t.button||t.ctrlKey||t.metaKey||(t.preventDefault(),e.state.visible?e.props.onOpenMedia(e.props.attachment):e.setState({visible:!0}))})),e}var c=a.prototype;return c.componentDidMount=function(){this.props.attachment.get("blurhash")&&this._decode()},c.componentDidUpdate=function(t){t.attachment.get("blurhash")!==this.props.attachment.get("blurhash")&&this.props.attachment.get("blurhash")&&this._decode()},c._decode=function(){var t=this.props.attachment.get("blurhash"),e=Object(I.decode)(t,32,32);if(e){var a=this.canvas.getContext("2d"),n=new ImageData(e,32,32);a.putImageData(n,0,0)}},c.hoverToPlay=function(){return!R.a&&-1!==["gifv","video"].indexOf(this.props.attachment.get("type"))},c.render=function(){var t=this.props,e=t.attachment,a=t.displayWidth,o=this.state,c=o.visible,i=o.loaded,s=Math.floor((a-4)/3)-4+"px",r=s,l=e.get("status"),p=l.get("spoiler_text")||e.get("description"),u="";if("unknown"===e.get("type"));else if("audio"===e.get("type"))u=Object(n.a)("span",{className:"account-gallery__item__icons"},void 0,Object(n.a)(w.a,{id:"music"}));else if("image"===e.get("type")){var h=100*((e.getIn(["meta","focus","x"])||0)/2+.5),b=100*((e.getIn(["meta","focus","y"])||0)/-2+.5);u=Object(n.a)("img",{src:e.get("preview_url"),alt:e.get("description"),title:e.get("description"),style:{objectPosition:h+"% "+b+"%"},onLoad:this.handleImageLoad})}else if(-1!==["gifv","video"].indexOf(e.get("type"))){var m=!Object(C.a)()&&R.a,f="video"===e.get("type")?Object(n.a)(w.a,{id:"play"}):"GIF";u=Object(n.a)("div",{className:L()("media-gallery__gifv",{autoplay:m})},void 0,Object(n.a)("video",{className:"media-gallery__item-gifv-thumbnail","aria-label":e.get("description"),title:e.get("description"),role:"application",src:e.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,f))}var O=Object(n.a)("span",{className:"account-gallery__item__icons"},void 0,Object(n.a)(w.a,{id:"eye-slash"}));return(Object(n.a)("div",{className:"account-gallery__item",style:{width:s,height:r}},void 0,Object(n.a)("a",{className:"media-gallery__item-thumbnail",href:l.get("url"),onClick:this.handleClick,title:p,target:"_blank",rel:"noopener noreferrer"},void 0,d.a.createElement("canvas",{width:32,height:32,ref:this.setCanvasRef,className:L()("media-gallery__preview",{"media-gallery__preview--hidden":c&&i})}),c?u:O)))},a}(y.a);Object(r.a)(x,"propTypes",{attachment:h.a.map.isRequired,displayWidth:m.a.number.isRequired,onOpenMedia:m.a.func.isRequired});var S,k,D,T=a(1083),N=a(472),A=a(1078),E=a(1056),q=a(45);function P(t){return function(){var e,a=Object(i.a)(t);if(U()){var n=Object(i.a)(this).constructor;e=Reflect.construct(a,arguments,n)}else e=a.apply(this,arguments);return Object(c.a)(this,e)}}function U(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.proto
2018-09-16 17:17:34 -04:00
//# sourceMappingURL=account_gallery.js.map