mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-27 16:53:17 +00:00
1 line
51 KiB
JavaScript
1 line
51 KiB
JavaScript
|
"use strict";(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[7019],{56714:(t,a,e)=>{e.r(a),e.d(a,{default:()=>c});var s=e(42755),i=e(78423),r=e(88231),n=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:i.default,sidebar:r.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(a){if(t.feedLoaded=!0,0==a.data.tags.length&&(t.canLoadMore=!1),t.isLoaded=!0,!a.data.tags||!a.data.tags.length)return t.canLoadMore=!1,void(t.isIntersecting=!1);var e;t.feed.tags&&t.feed.tags.length?(e=t.feed.tags).push.apply(e,o(a.data.tags)):t.feed=a.data;t.page++,t.isIntersecting=!1,t.follows=!!a.data.hasOwnProperty("follows")&&a.data.follows,0==a.data.tags.length&&(t.canLoadMore=!1)})).catch((function(a){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(a){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(a){t.follows=!1,t.isFollowing=!1}))}}}},89250:(t,a,e)=>{e.r(a),e.d(a,{default:()=>s});const s={data:function(){return{user:window._sharedData.user}}}},29022:(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.files.length;e++){if(!t.dataTransfer.files[e].hasOwnProperty("name"))return;a.avatarUpdateFile=t.dataTransfer.files[e],a.avatarUpdatePreview=URL.createObjectURL(t.dataTransfer.files[e]),a.avatarUpdateIndex=1}},confirmUpload:function(){var t=this;if(window.confirm("Are yo
|