pixelfed/public/js/groups-page-media.a57186ce3...

1 line
57 KiB
JavaScript
Raw Normal View History

2024-07-23 07:31:06 +00:00
"use strict";(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[6438],{67703:(t,e,a)=>{a.r(e),a.d(e,{default:()=>w});var s=a(79984),i=a(78277),n=a(17108),r=a(95002),o=a(87223),l=a(48204),c=a(9716),d=a(20524),u=a(13094),p=a(58753),f=a(54451),m=a(94559),v=a(19413),h=a(26679),g=a(49268),b=a(52505),_=a(33457),C=a(72890);const w={props:{groupId:{type:String},path:{type:String}},components:{"status-card":s.default,"group-about":o.default,"group-status":r.default,"group-members":i.default,"group-compose":n.default,"group-topics":d.default,"group-info-card":u.default,"group-media":l.default,"group-moderation":c.default,"leave-group":p.default,"group-insights":f.default,"search-modal":m.default,"invite-modal":v.default,sidebar:h.default,"group-banner":g.default,"group-header-details":b.default,"group-nav-tabs":_.default,"member-only-warning":C.default},data:function(){return{initialLoad:!1,profile:void 0,group:{},isMember:!1,isAdmin:!1,renderIdx:1,atabs:{moderation_count:0,request_count:0}}},created:function(){this.init()},methods:{init:function(){var t=this;this.initialLoad=!1,axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(e){t.profile=e.data,t.fetchGroup()})).catch((function(t){window.location.href="/login?_next="+encodeURIComponent(window.location.href)}))},handleRefresh:function(){this.initialLoad=!1,this.init(),this.renderIdx++},fetchGroup:function(){var t=this;axios.get("/api/v0/groups/"+this.groupId).then((function(e){t.group=e.data,t.isMember=e.data.self.is_member,t.isAdmin=["founder","admin"].includes(e.data.self.role),t.isAdmin&&t.fetchAdminTabs(),t.initialLoad=!0})).catch((function(t){alert("error")}))},fetchAdminTabs:function(){var t=this;axios.get("/api/v0/groups/"+this.groupId+"/atabs").then((function(e){t.atabs=e.data}))}}}},12189:(t,e,a)=>{a.r(e),a.d(e,{default:()=>s});const s={props:{group:{type:Object}},methods:{timestampFormat:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=new Date(t);return e?a.toDateString()+" · "+a.toLocaleTimeString():a.toDateString()}}}},52327:(t,e,a)=>{a.r(e),a.d(e,{default:()=>s});const s={props:{group:{type:Object}},data:function(){return{}},methods:{}}},14366:(t,e,a)=>{a.r(e),a.d(e,{default:()=>s});const s={props:{group:{type:Object}},data:function(){return{isLoaded:!1,feed:[],photos:[],videos:[],albums:[],tab:"photo",tabs:["photo","video","album"],page:{photo:1,video:1,album:1},hasNextPage:{photo:!1,video:!1,album:!1}}},mounted:function(){this.fetchMedia()},methods:{fetchMedia:function(){var t=this;axios.get("/api/v0/groups/media/list",{params:{gid:this.group.id,page:this.page[this.tab],type:this.tab}}).then((function(e){e.data.length>0&&(t.hasNextPage[t.tab]=!0),t.isLoaded=!0,e.data.forEach((function(e){"photo"==e.pf_type&&t.photos.push(e),"video"==e.pf_type&&t.videos.push(e),"photo:album"==e.pf_type&&t.albums.push(e)})),t.page[t.tab]=t.page[t.tab]+1})).catch((function(e){t.hasNextPage[t.tab]=!1,console.log(e.response)}))},loadNextPage:function(){var t=this;axios.get("/api/v0/groups/media/list",{params:{gid:this.group.id,page:this.page[this.tab],type:this.tab}}).then((function(e){0!=e.data.length?(e.data.forEach((function(e){"photo"==e.pf_type&&t.photos.push(e),"video"==e.pf_type&&t.videos.push(e),"photo:album"==e.pf_type&&t.albums.push(e)})),t.page[t.tab]=t.page[t.tab]+1):t.hasNextPage[t.tab]=!1})).catch((function(e){t.hasNextPage[t.tab]=!1}))},formatDate:function(t){return new Date(t).toDateString()},switchTab:function(t){this.tab=t,this.fetchMedia()},lightbox:function(t){this.lightboxStatus=t.media_attachments[0],this.$refs.lightboxModal.show()},hideLightbox:function(){this.lightboxStatus=null,this.$refs.lightboxModal.hide()},blurhashWidth:function(t){if(!t.media_attachments[0].meta)return 25;var e=t.media_attachments[0].meta.original.aspect;return 1==e?25:e>1?30:20},blurhashHeight:function(t){if(!t.media_attachments[0].meta)return 25;var e=t.media_attachments[0].meta.original.aspect;return 1==e?25:e>1?20:30},getMediaSource:function(t){var e=t.media_attachments[0];return e.preview_url&&e.preview_url.endsWith("s