mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 13:33:18 +00:00
1 line
50 KiB
JavaScript
1 line
50 KiB
JavaScript
|
"use strict";(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[7019],{88075:(t,a,e)=>{e.r(a),e.d(a,{default:()=>c});var s=e(42755),n=e(78423),i=e(88231),r=e(78375);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)return;if("string"==typeof t)return l(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return l(t,a)}(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=new Array(a);e<a;e++)s[e]=t[e];return s}const c={props:{id:{type:String}},components:{drawer:s.default,intersect:n.default,sidebar:i.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){return a.data&&a.data.length?(t.feed=a.data,t.maxId=a.data[a.data.length-1].id,!0):(t.feedLoaded=!0,t.isLoaded=!0,!1)})).then((function(a){t.canLoadMore=a})).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;return!(!a.data||!a.data.length)&&((e=t.feed).push.apply(e,o(a.data)),t.maxId=a.data[a.data.length-1].id,!0)})).then((function(a){t.canLoadMore=a})).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)}))}}}},14287:(t,a,e)=>{e.r(a),e.d(a,{default:()=>s});const s={data:function(){return{user:window._sharedData.user}}}},54895:(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.avatarUpdate
|