pixelfed/public/js/discover.chunk.1404d3172761...

1 wiersz
70 KiB
JavaScript
Czysty Zwykły widok Historia

2024-04-06 08:47:39 +00:00
"use strict";(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[6535],{28724:(t,e,a)=>{a.r(e),a.d(e,{default:()=>f});var s=a(5787),i=a(28772),n=a(59993),r=a(88675),o=a(32653),l=a(46130),c=a(6555),d=a(25027);const f={components:{drawer:s.default,sidebar:i.default,rightbar:n.default,discover:r.default,"news-slider":o.default,"discover-spotlight":l.default,"daily-trending":c.default,"grid-card":d.default},data:function(){return{isLoaded:!1,profile:void 0,config:{},tab:"index",popularAccounts:[],followingIndex:void 0}},updated:function(){},mounted:function(){this.profile=window._sharedData.user,this.fetchConfig()},methods:{fetchConfig:function(){var t=this;axios.get("/api/pixelfed/v2/discover/meta").then((function(e){t.config=e.data,t.isLoaded=!0,window._sharedData.discoverMeta=e.data}))},fetchPopularAccounts:function(){},followProfile:function(t){var e=this;event.currentTarget.blur(),this.followingIndex=t;var a=this.popularAccounts[t].id;axios.post("/api/v1/accounts/"+a+"/follow").then((function(a){e.followingIndex=void 0,e.popularAccounts.splice(t,1)})).catch((function(t){e.followingIndex=void 0,swal("Oops!","An error occured when attempting to follow this account.","error")}))},goToProfile:function(t){this.$router.push({path:"/i/web/profile/".concat(t.id),params:{id:t.id,cachedProfile:t,cachedUser:this.profile}})},toggleTab:function(t){this.tab=t,setTimeout((function(){window.scrollTo({top:0,behavior:"smooth"})}),300)},openManageModal:function(){event.currentTarget.blur(),swal("Settings","Discover settings here","info")}}}},83085:(t,e,a)=>{a.r(e),a.d(e,{default:()=>s});const s={data:function(){return{isLoaded:!1,initialFetch:!1,trending:[]}},mounted:function(){this.initialFetch||this.fetchTrending()},methods:{fetchTrending:function(){var t=this;axios.get("/api/pixelfed/v2/discover/posts/trending",{params:{range:"daily"}}).then((function(e){t.trending=e.data.filter((function(t){return"photo"===t.pf_type})).slice(0,9),t.isLoaded=!0,t.initialFetch=!0}))},gotoPost:function(t){this.$router.push("/i/web/post/"+t)},viewMore:function(){this.$emit("btn-click","trending")}}}},72328:(t,e,a)=>{a.r(e),a.d(e,{default:()=>s});const s={data:function(){return{isLoaded:!1}},mounted:function(){var t=this;setTimeout((function(){t.isLoaded=!0}),1e3)}}},6455:(t,e,a)=>{a.r(e),a.d(e,{default:()=>s});const s={props:{small:{type:Boolean,default:!1},dark:{type:Boolean,default:!1},subtitle:{type:String},title:{type:String},buttonText:{type:String},buttonLink:{type:String},buttonEvent:{type:Boolean,default:!1},iconClass:{type:String}},methods:{handleLink:function(){1!=this.buttonEvent?this.buttonLink&&null!=this.buttonLink?this.$router.push(this.buttonLink):swal("Oops","This is embarassing, we cannot redirect you to the proper page at the moment","warning"):this.$emit("btn-click")}}}},37737:(t,e,a)=>{a.r(e),a.d(e,{default:()=>s});const s={}},50371:(t,e,a)=>{a.r(e),a.d(e,{default:()=>s});const s={data:function(){return{user:window._sharedData.user}}}},84154:(t,e,a)=>{a.r(e),a.d(e,{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,e=event.target.files;Array.prototype.forEach.call(e,(function(e,a){t.avatarUpdateFile=e,t.avatarUpdatePreview=URL.createObjectURL(e),t.avatarUpdateIndex=1}))},handleDrop:function(t){t.preventDefault();var e=this;if(t.dataTransfer.items){for(var a=0;a<t.dataTransfer.items.length;a++)if("file"===t.dataTransfer.items[a].kind){var s=t.dataTransfer.items[a].getAsFile();if(!s)return;e.avatarUpdateFile=s,e.avatarUpdatePreview=URL.createObjectURL(s),e.avatarUpdateIndex=1}}else for(a=0;a<t.dataTransfer.files.length;a++){if(!t.dataTransf