mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-26 10:46:13 +00:00
2 lines
32 KiB
JavaScript
2 lines
32 KiB
JavaScript
|
webpackJsonp([30,26],{159:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"default",function(){return P});var r,o,a,i,l,u=n(2),s=n.n(u),c=n(1),d=n.n(c),f=n(3),p=n.n(f),h=n(4),m=n.n(h),v=n(0),g=n.n(v),y=n(5),b=n.n(y),_=n(8),w=(n.n(_),n(19)),O=n(6),x=n(33),k=n(10),j=n.n(k),C=n(18),N=Object(O.f)({toggle_visible:{id:"media_gallery.toggle_visible",defaultMessage:"Toggle visibility"}}),M=(o=r=function(e){function t(){var n,r,o;d()(this,t);for(var a=arguments.length,i=Array(a),l=0;l<a;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,o=t.onClick;r.context.router&&0===e.button&&(e.preventDefault(),o(n)),e.stopPropagation()},o=n,p()(r,o)}return m()(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,o=e.standalone,a=50,i=100,l="auto",u="auto",c="auto",d="auto";1===r&&(a=100),(4===r||3===r&&n>0)&&(i=50),2===r?0===n?d="2px":u="2px":3===r?(0===n?d="2px":n>0&&(u="2px"),1===n?c="2px":n>1&&(l="2px")):4===r&&(0!==n&&2!==n||(d="2px"),1!==n&&3!==n||(u="2px"),n<2?c="2px":l="2px");var f="";if("image"===t.get("type")){var p=t.get("preview_url"),h=t.getIn(["meta","small","width"]),m=t.get("url"),v=t.getIn(["meta","original","width"]),g="number"==typeof v&&"number"==typeof h,y=g?m+" "+v+"w, "+p+" "+h+"w":null,b=g?"(min-width: 1025px) "+a/100*320+"px, "+a+"vw":null;f=s()("a",{className:"media-gallery__item-thumbnail",href:t.get("remote_url")||m,onClick:this.handleClick,target:"_blank"},void 0,s()("img",{src:p,srcSet:y,sizes:b,alt:t.get("description"),title:t.get("description")}))}else if("gifv"===t.get("type")){var _=!Object(x.a)()&&C.a;f=s()("div",{className:j()("media-gallery__gifv",{autoplay:_})},void 0,s()("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:_,loop:!0,muted:!0}),s()("span",{className:"media-gallery__gifv__label"},void 0,"GIF"))}return s()("div",{className:j()("media-gallery__item",{standalone:o}),style:{left:u,top:l,right:d,bottom:c,width:a+"%",height:i+"%"}},t.get("id"),f)},t}(g.a.PureComponent),r.contextTypes={router:b.a.object},r.defaultProps={standalone:!1,index:0,size:1},o),P=Object(O.g)((l=i=function(e){function t(){var n,r,o;d()(this,t);for(var a=arguments.length,i=Array(a),l=0;l<a;l++)i[l]=arguments[l];return n=r=p()(this,e.call.apply(e,[this].concat(i))),r.state={visible:!r.props.sensitive},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.isStandaloneEligible()&&r.setState({width:e.offsetWidth})},o=n,p()(r,o)}return m()(t,e),t.prototype.componentWillReceiveProps=function(e){Object(_.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,o=t.sensitive,a=t.height,i=this.state,l=i.width,u=i.visible,c=void 0,d={};if(this.isStandaloneEligible()?d.height=!u&&l?l/this.props.media.getIn([0,"meta","small","aspect"]):"":d.height=a,u){var f=n.take(4).size;c=this.isStandaloneEligible()?s()(M,{standalone:!0,onClick:this.handleClick,attachment:n.get(0)}):n.take(4).map(function(t,n){return s()(M,{onClick:e.handleClick,attachment:t,index:n,size:f},t.get("id"))})}else{var p=void 0;p=o?s()(O.b,{id:"status.sensitive_warning",defaultMessage:"Sensitive content"}):s()(O.b,{id:"status.media_hidden",defaultMessage:"Media hidden"}),c=g.a.createElement("button",{className:"media-spoiler",onClick:this.handleOpen,style:d,ref:this.handleRef},s(
|
||
|
//# sourceMappingURL=public-88b87539fc95f07f2721.js.map
|