pixelfed/public/js/spa.js

2 wiersze
346 KiB
JavaScript
Czysty Zwykły widok Historia

2022-02-18 05:31:41 +00:00
/*! For license information please see spa.js.LICENSE.txt */
2022-04-18 03:49:43 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[269],{6340:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>s});const s={components:{sidebar:a(88231).default},data:function(){return{isLoaded:!1,profile:void 0,instance:void 0,nodeinfo:void 0,config:window.App.config}},mounted:function(){this.fetchUserData()},methods:{fetchUserData:function(){this.profile=window._sharedData.user,this.fetchInstance()},fetchInstance:function(){var t=this;axios.get("/api/v1/instance").then((function(e){t.instance=e.data,t.fetchNodeinfo()}))},fetchNodeinfo:function(){var t=this;axios.get("/api/nodeinfo/2.0.json").then((function(e){t.nodeinfo=e.data,t.isLoaded=!0}))}}}},51209:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>o});var s=a(42755),i=a(88231);const o={components:{drawer:s.default,sidebar:i.default},data:function(){return{isLoaded:!1,profile:void 0,instance:void 0,nodeinfo:void 0,config:window.App.config}},mounted:function(){this.profile=window._sharedData.user}}},7212:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>s});const s={components:{sidebar:a(88231).default},data:function(){return{isLoaded:!1,profile:void 0}},mounted:function(){this.profile=window._sharedData.user,this.isLoaded=!0}}},3247:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>r});var s=a(42755),i=a(88231),o=a(33795),n=a(78423);const r={components:{drawer:s.default,sidebar:i.default,intersect:n.default,"dm-placeholder":o.default},data:function(){return{isLoaded:!1,profile:void 0,canLoadMore:!0,threadsLoaded:!1,threads:[],tabIndex:0,tabs:["inbox","sent","requests"],page:1,ids:[],isIntersecting:!1}},mounted:function(){this.profile=window._sharedData.user,this.isLoaded=!0,this.fetchThreads()},methods:{fetchThreads:function(){var t=this;axios.get("/api/v1/conversations",{params:{scope:this.tabs[this.tabIndex]}}).then((function(e){var a=e.data.map((function(t){return t.accounts[0].id}));t.ids=a,t.threads=e.data,t.threadsLoaded=!0,t.page++}))},timeago:function(t){return App.util.format.timeAgo(t)},enterIntersect:function(){var t=this;this.isIntersecting||(this.isIntersecting=!0,axios.get("/api/v1/conversations",{params:{scope:this.tabs[this.tabIndex],page:this.page}}).then((function(e){if(e.data.forEach((function(e){-1==t.ids.indexOf(e.accounts[0].id)&&(t.ids.push(e.accounts[0].id),t.threads.push(e))})),!e.data.length||e.data.length<5)return t.canLoadMore=!1,void(t.isIntersecting=!1);t.page++,t.isIntersecting=!1})))},toggleTab:function(t){event.currentTarget.blur(),this.threadsLoaded=!1,this.page=1,this.tabIndex=t,this.fetchThreads()}}}},1411:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>u});var s=a(42755),i=a(88231),o=a(78375),n=a(56899),r=a(92614),l=a(51436),c=a(53343),d=a(89601);const u={components:{drawer:s.default,sidebar:i.default,rightbar:o.default,discover:n.default,"news-slider":r.default,"discover-spotlight":l.default,"daily-trending":c.default,"grid-card":d.default},data:function(){return{isLoaded:!1,profile:void 0,config:{},tab:"index",popularAccounts:[],followingIndex:void 0}},updated:function(){},mounted:function(){this.profile=window._sharedData.user,this.fetchConfig()},methods:{fetchConfig:function(){var t=this;axios.get("/api/pixelfed/v2/discover/meta").then((function(e){t.config=e.data,t.isLoaded=!0,window._sharedData.discoverMeta=e.data}))},fetchPopularAccounts:function(){},followProfile:function(t){var e=this;event.currentTarget.blur(),this.followingIndex=t;var a=this.popularAccounts[t].id;axios.post("/api/v1/accounts/"+a+"/follow").then((function(a){e.followingIndex=void 0,e.popularAccounts.splice(t,1)})).catch((function(t){e.followingIndex=void 0,swal("Oops!","An error occured when attempting to follow this account.","error")}))},goToProfile:function(t){this.$router.push({path:"/i/web/profile/".concat(t.id),params:{id:t.id,cachedProfile:t,cachedUser:this.profile}})},toggleTab:function(t){this.tab=t,setTimeout((function(){window.scrollTo({top:0,behavior:"smooth"})}),300)},openManageModal:function(){event.currentTarget.blur(),swal("Settings","Discover settings here","info")}}}},78472:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=