pixelfed/public/js/discover~hashtag.bundle.db1d86f9e9dcb79a.js

1 line
50 KiB
JavaScript
Raw Permalink Normal View History

2024-10-14 05:22:27 +00:00
"use strict";(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[2966],{86377:(t,a,e)=>{e.r(a),e.d(a,{default:()=>c});var s=e(5787),i=e(25100),n=e(28772),r=e(59993);function o(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,a){if(t){if("string"==typeof t)return l(t,a);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?l(t,a):void 0}}(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,a){(null==a||a>t.length)&&(a=t.length);for(var e=0,s=Array(a);e<a;e++)s[e]=t[e];return s}const c={props:{id:{type:String}},components:{drawer:s.default,intersect:i.default,sidebar:n.default,rightbar:r.default},data:function(){return{isLoaded:!1,profile:void 0,canLoadMore:!1,isIntersecting:!1,feedLoaded:!1,feed:[],page:1,hashtag:{name:this.id,count:0},followingLoading:!1,maxId:void 0}},mounted:function(){this.init()},watch:{$route:"init"},methods:{init:function(){var t=this;this.profile=window._sharedData.user,axios.get("/api/v1/tags/"+this.id,{params:{_pe:1}}).then((function(a){t.hashtag=a.data})).catch((function(a){swal("Error","Something went wrong, please try again later!","error"),t.isLoaded=!0,t.feedLoaded=!0})).finally((function(){t.fetchFeed()}))},fetchFeed:function(){var t=this;axios.get("/api/v1/timelines/tag/"+this.id,{params:{limit:80}}).then((function(a){a.data&&a.data.length?(t.feed=a.data,t.maxId=a.data[a.data.length-1].id,t.canLoadMore=!0):(t.feedLoaded=!0,t.isLoaded=!0)})).finally((function(){t.feedLoaded=!0,t.isLoaded=!0}))},statusUrl:function(t){return"/i/web/post/"+t.id},formatCount:function(t){return App.util.format.count(t)},enterIntersect:function(){var t=this;this.isIntersecting||(this.isIntersecting=!0,axios.get("/api/v1/timelines/tag/"+this.id,{params:{max_id:this.maxId,limit:40}}).then((function(a){var e;a.data&&a.data.length?((e=t.feed).push.apply(e,o(a.data)),t.maxId=a.data[a.data.length-1].id,t.canLoadMore=!0):t.canLoadMore=!1})).finally((function(){t.isIntersecting=!1})))},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.followingLoading=!0,axios.post("/api/v1/tags/"+this.id+"/follow").then((function(a){setTimeout((function(){t.hashtag.following=!0,t.followingLoading=!1}),500)}))},unfollowHashtag:function(){var t=this;this.followingLoading=!0,axios.post("/api/v1/tags/"+this.id+"/unfollow").then((function(a){setTimeout((function(){t.hashtag.following=!1,t.followingLoading=!1}),500)}))}}}},50371:(t,a,e)=>{e.r(a),e.d(a,{default:()=>s});const s={data:function(){return{user:window._sharedData.user}}}},84154:(t,a,e)=>{e.r(a),e.d(a,{default:()=>s});const s={props:["user"],data:function(){return{loaded:!1,avatarUpdateIndex:0,avatarUpdateFile:void 0,avatarUpdatePreview:void 0}},methods:{open:function(){this.$refs.avatarUpdateModal.show()},avatarUpdateClose:function(){this.$refs.avatarUpdateModal.hide(),this.avatarUpdateIndex=0,this.avatarUpdateFile=void 0},avatarUpdateClear:function(){this.avatarUpdateIndex=0,this.avatarUpdateFile=void 0},avatarUpdateStep:function(t){this.$refs.avatarUpdateRef.click(),this.avatarUpdateIndex=t},handleAvatarUpdate:function(){var t=this,a=event.target.files;Array.prototype.forEach.call(a,(function(a,e){t.avatarUpdateFile=a,t.avatarUpdatePreview=URL.createObjectURL(a),t.avatarUpdateIndex=1}))},handleDrop:function(t){t.preventDefault();var a=this;if(t.dataTransfer.items){for(var e=0;e<t.dataTransfer.items.length;e++)if("file"===t.dataTransfer.items[e].kind){var s=t.dataTransfer.items[e].getAsFile();if(!s)return;a.avatarUpdateFile=s,a.avatarUpdatePreview=URL.createObjectURL(s),a.avatarUpdateIndex=1}}else for(e=0;e<t.dataTransfer