spc-pleroma/priv/static/packs/public.js

2 lines
33 KiB
JavaScript
Raw Normal View History

webpackJsonp([29,25],{154:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"default",function(){return N});var r,a,o,i,l,s=n(2),u=n.n(s),c=n(1),d=n.n(c),f=n(3),p=n.n(f),m=n(4),h=n.n(m),v=n(0),g=n.n(v),y=n(8),b=(n.n(y),n(23)),_=n(6),w=n(35),O=n(10),x=n.n(O),C=n(12),k=Object(_.f)({toggle_visible:{id:"media_gallery.toggle_visible",defaultMessage:"Toggle visibility"}}),j=(a=r=function(e){function t(){var n,r,a;d()(this,t);for(var o=arguments.length,i=Array(o),l=0;l<o;l++)i[l]=arguments[l];return n=r=p()(this,e.call.apply(e,[this].concat(i))),r.handleMouseEnter=function(e){r.hoverToPlay()&&e.target.play()},r.handleMouseLeave=function(e){r.hoverToPlay()&&(e.target.pause(),e.target.currentTime=0)},r.handleClick=function(e){var t=r.props,n=t.index,a=t.onClick;0===e.button&&(e.preventDefault(),a(n)),e.stopPropagation()},a=n,p()(r,a)}return h()(t,e),t.prototype.hoverToPlay=function(){var e=this.props.attachment;return!C.a&&"gifv"===e.get("type")},t.prototype.render=function(){var e=this.props,t=e.attachment,n=e.index,r=e.size,a=e.standalone,o=50,i=100,l="auto",s="auto",c="auto",d="auto";1===r&&(o=100),(4===r||3===r&&n>0)&&(i=50),2===r?0===n?d="2px":s="2px":3===r?(0===n?d="2px":n>0&&(s="2px"),1===n?c="2px":n>1&&(l="2px")):4===r&&(0!==n&&2!==n||(d="2px"),1!==n&&3!==n||(s="2px"),n<2?c="2px":l="2px");var f="";if("image"===t.get("type")){var p=t.get("preview_url"),m=t.getIn(["meta","small","width"]),h=t.get("url"),v=t.getIn(["meta","original","width"]),g="number"==typeof v&&"number"==typeof m,y=g?h+" "+v+"w, "+p+" "+m+"w":null,b=g?"(min-width: 1025px) "+o/100*320+"px, "+o+"vw":null,_=t.getIn(["meta","focus","x"])||0,O=t.getIn(["meta","focus","y"])||0,k=100*(_/2+.5),j=100*(O/-2+.5);f=u()("a",{className:"media-gallery__item-thumbnail",href:t.get("remote_url")||h,onClick:this.handleClick,target:"_blank"},void 0,u()("img",{src:p,srcSet:y,sizes:b,alt:t.get("description"),title:t.get("description"),style:{objectPosition:k+"% "+j+"%"}}))}else if("gifv"===t.get("type")){var N=!Object(w.a)()&&C.a;f=u()("div",{className:x()("media-gallery__gifv",{autoplay:N})},void 0,u()("video",{className:"media-gallery__item-gifv-thumbnail","aria-label":t.get("description"),role:"application",src:t.get("url"),onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,autoPlay:N,loop:!0,muted:!0}),u()("span",{className:"media-gallery__gifv__label"},void 0,"GIF"))}return u()("div",{className:x()("media-gallery__item",{standalone:a}),style:{left:s,top:l,right:d,bottom:c,width:o+"%",height:i+"%"}},t.get("id"),f)},t}(g.a.PureComponent),r.defaultProps={standalone:!1,index:0,size:1},a),N=Object(_.g)((l=i=function(e){function t(){var n,r,a;d()(this,t);for(var o=arguments.length,i=Array(o),l=0;l<o;l++)i[l]=arguments[l];return n=r=p()(this,e.call.apply(e,[this].concat(i))),r.state={visible:!r.props.sensitive||C.f},r.handleOpen=function(){r.setState({visible:!r.state.visible})},r.handleClick=function(e){r.props.onOpenMedia(r.props.media,e)},r.handleRef=function(e){e&&r.setState({width:e.offsetWidth})},a=n,p()(r,a)}return h()(t,e),t.prototype.componentWillReceiveProps=function(e){Object(y.is)(e.media,this.props.media)||this.setState({visible:!e.sensitive})},t.prototype.isStandaloneEligible=function(){var e=this.props,t=e.media;return e.standalone&&1===t.size&&t.getIn([0,"meta","small","aspect"])},t.prototype.render=function(){var e=this,t=this.props,n=t.media,r=t.intl,a=t.sensitive,o=t.height,i=this.state,l=i.width,s=i.visible,c=void 0,d={};if(this.isStandaloneEligible()?l&&(d.height=l/this.props.media.getIn([0,"meta","small","aspect"])):d.height=l?l/(16/9):o,s){var f=n.take(4).size;c=this.isStandaloneEligible()?u()(j,{standalone:!0,onClick:this.handleClick,attachment:n.get(0)}):n.take(4).map(function(t,n){return u()(j,{onClick:e.handleClick,attachment:t,index:n,size:f},t.get("id"))})}else{var p=void 0;p=a?u()(_.b,{id:"status.sensitive_warning",defaultMessage:"Sensitive content"}):u()(_.b,{id:"status.media_hidden",defaultMessage:"Media hidden"}),c=g.a.createElement("button",{type:"button",className:"m
//# sourceMappingURL=public.js.map