pixelfed/public/js/spa.js

2 lines
275 KiB
JavaScript
Raw Normal View History

2022-02-18 05:31:41 +00:00
/*! For license information please see spa.js.LICENSE.txt */
2022-05-18 09:11:39 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[269],{6340:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>o});const o={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:()=>i});var o=a(42755),s=a(88231);const i={components:{drawer:o.default,sidebar:s.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:()=>o});const o={components:{sidebar:a(88231).default},data:function(){return{isLoaded:!1,profile:void 0}},mounted:function(){this.profile=window._sharedData.user,this.isLoaded=!0}}},45595:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>c});var o=a(42755),s=a(78423),i=a(88231),n=a(78375);function r(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return l(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,o=new Array(e);a<e;a++)o[a]=t[a];return o}const c={props:{id:{type:String}},components:{drawer:o.default,intersect:s.default,sidebar:i.default,rightbar:n.default},data:function(){return{isLoaded:!1,profile:void 0,canLoadMore:!0,isIntersecting:!1,feedLoaded:!1,feed:[],page:1,follows:!1,isFollowing:!1}},mounted:function(){this.init()},watch:{$route:"init"},methods:{init:function(){this.profile=window._sharedData.user,this.isLoaded=!0,this.fetchFeed()},fetchFeed:function(){var t=this;axios.get("/api/v2/discover/tag",{params:{hashtag:this.id,limit:9,page:this.page}}).then((function(e){if(t.feedLoaded=!0,0==e.data.tags.length&&(t.canLoadMore=!1),t.isLoaded=!0,!e.data.tags||!e.data.tags.length)return t.canLoadMore=!1,void(t.isIntersecting=!1);var a;t.feed.tags&&t.feed.tags.length?(a=t.feed.tags).push.apply(a,r(e.data.tags)):t.feed=e.data;t.page++,t.isIntersecting=!1,t.follows=!!e.data.hasOwnProperty("follows")&&e.data.follows,0==e.data.tags.length&&(t.canLoadMore=!1)})).catch((function(e){t.canLoadMore=!1,t.isLoaded=!0,t.feedLoaded=!0}))},statusUrl:function(t){return"/i/web/post/"+t.id},formatCount:function(t){return App.util.format.count(t)},enterIntersect:function(){this.isIntersecting||(this.isIntersecting=!0,this.fetchFeed())},goToPost:function(t){this.$router.push({name:"post",path:"/i/web/post/".concat(t.id),params:{id:t.id,cachedStatus:t,cachedProfile:this.profile}})},followHashtag:function(){var t=this;this.isFollowing=!0,axios.post("/api/local/discover/tag/subscribe",{name:this.id}).then((function(e){t.follows=!0,t.isFollowing=!1}))},unfollowHashtag:function(){var t=this;this.isFollowing=!0,axios.post("/api/local/discover/tag/subscribe",{name:this.id}).then((function(e){t.follows=!1,t.isFollowing=!1}))}}}},70354:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>o});const o={data:function(){return{posts:[],profile:[]}},mounted:function(){this.init()},methods:{init:function(){var t=this;axios.get("/i/hc/category",{params:{id:1}}).then((function(e){t.profile=e.data})),axios.get("/i/hc/category",{params:{id:2}}).then