pixelfed/public/js/spa.js

2 lines
467 KiB
JavaScript
Raw Normal View History

2024-07-23 07:31:06 +00:00
/*! For license information please see spa.js.LICENSE.txt */
2024-10-06 06:53:38 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[7228],{93729:(t,e,o)=>{"use strict";o.r(e),o.d(e,{default:()=>r});var a=o(26679),s=o(16080),i=o(99662);const r={components:{sidebar:a.default,loader:s.default,"group-card":i.default},data:function(){return{loaded:!1,loadTimeout:void 0,popularGroups:[],newGroups:[]}},methods:{fetchPopular:function(){var t=this;axios.get("/api/v0/groups/discover/popular").then((function(e){return t.popularGroups=e.data})).finally((function(){return t.fetchNewGroups()}))},fetchNewGroups:function(){var t=this;axios.get("/api/v0/groups/discover/new").then((function(e){return t.newGroups=e.data})).finally((function(){return t.loaded=!0}))}},created:function(){this.fetchPopular()},beforeUnmount:function(){clearTimeout(this.loadTimeout)}}},56244:(t,e,o)=>{"use strict";o.r(e),o.d(e,{default:()=>m});var a=o(95002),s=o(90637),i=o(54048),r=o(57397),n=o(65603),l=o(27403),c=o(5799),d=o(49139),u=o(26679),p=o(2e4);o(87980);const m={data:function(){return{initialLoad:!1,config:{},groups:[],profile:{},tab:null,searchQuery:void 0}},components:{"autocomplete-input":p.default,"group-status":a.default,"self-discover":i.default,"self-groups":r.default,"self-feed":s.default,"self-notifications":n.default,"self-invitations":l.default,"self-remote-search":c.default,"create-group":d.default,sidebar:u.default},mounted:function(){this.fetchConfig()},methods:{init:function(){document.querySelectorAll("footer").forEach((function(t){return t.parentNode.removeChild(t)})),document.querySelectorAll(".mobile-footer-spacer").forEach((function(t){return t.parentNode.removeChild(t)})),document.querySelectorAll(".mobile-footer").forEach((function(t){return t.parentNode.removeChild(t)})),this.initialLoad=!0},fetchConfig:function(){var t=this;axios.get("/api/v0/groups/config").then((function(e){t.config=e.data,t.fetchProfile()}))},fetchProfile:function(){var t=this;axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(e){t.profile=e.data,t.init(),window._sharedData.curUser=e.data,window.App.util.navatar()}))},fetchSelfGroups:function(){var t=this;axios.get("/api/v0/groups/self/list").then((function(e){t.groups=e.data}))},switchTab:function(t){event.currentTarget.blur(),window.scrollTo(0,0),this.tab=t,"feed"!=t?history.pushState(null,null,"/groups/home?ct="+t):history.pushState(null,null,"/groups/home")},autocompleteSearch:function(t){var e=this;return!t||t.length<2?((this.tab="searchresults")&&(this.tab="feed"),[]):(this.searchQuery=t,t.startsWith("http")?new URL(t).hostname==location.hostname?(location.href=t,[]):[]:t.startsWith("#")?(this.$bvToast.toast(t,{title:"Hashtag detected",variant:"info",autoHideDelay:5e3}),[]):axios.post("/api/v0/groups/search/global",{q:t,v:"0.2"}).then((function(t){return e.searchLoading=!1,t.data})).catch((function(t){return 422===t.response.status&&e.$bvToast.toast(t.response.data.error.message,{title:"Cannot display search results",variant:"danger",autoHideDelay:5e3}),[]})))},getSearchResultValue:function(t){return t.name},onSearchSubmit:function(t){if(t.length<1)return[];location.href=t.url},truncateName:function(t){return t.length<24?t:t.substr(0,23)+"..."}}}},45297:(t,e,o)=>{"use strict";o.r(e),o.d(e,{default:()=>r});var a=o(26679),s=o(16080),i=o(57397);const r={components:{sidebar:a.default,loader:s.default,"self-groups":i.default},data:function(){return{loaded:!1,loadTimeout:void 0,config:{},groups:[],profile:{}}},methods:{init:function(){document.querySelectorAll("footer").forEach((function(t){return t.parentNode.removeChild(t)})),document.querySelectorAll(".mobile-footer-spacer").forEach((function(t){return t.parentNode.removeChild(t)})),document.querySelectorAll(".mobile-footer").forEach((function(t){return t.parentNode.removeChild(t)})),this.loaded=!0},fetchConfig:function(){var t=this;axios.get("/api/v0/groups/config").then((function(e){t.config=e.data,t.fetchProfile()}))},fetchProfile:function(){var t=this;axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(e){t.profile=e.data,t.init(),window._sharedData.curUser=e.data,window.App.u