mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-20 13:31:28 +00:00
1 line
24 KiB
JavaScript
1 line
24 KiB
JavaScript
|
"use strict";(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[336],{2519:(t,e,s)=>{s.r(e),s.d(e,{default:()=>o});var a=s(87757),i=s.n(a);function n(t,e,s,a,i,n,o){try{var r=t[n](o),l=r.value}catch(t){return void s(t)}r.done?e(l):Promise.resolve(l).then(a,i)}const o={props:["initialData"],data:function(){return{loading:!0,isAuthed:void 0,user:void 0,settings:void 0,post:void 0,profile:void 0,settingsUrl:window._portfolio.path+"/settings"}},mounted:function(){var t=JSON.parse(this.initialData);this.post=t.post,this.profile=t.profile,this.isAuthed=t.authed,this.fetchUser()},methods:{fetchUser:function(){var t,e=this;return(t=i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.isAuthed){t.next=3;break}return t.next=3,axios.get("/api/v1/accounts/verify_credentials").then((function(t){e.user=t.data})).catch((function(t){}));case 3:return t.next=5,axios.get("/api/portfolio/account/settings.json",{params:{id:e.profile.id}}).then((function(t){e.settings=t.data})).then((function(){setTimeout((function(){e.loading=!1}),500)}));case 5:case"end":return t.stop()}}),t)})),function(){var e=this,s=arguments;return new Promise((function(a,i){var o=t.apply(e,s);function r(t){n(o,a,i,r,l,"next",t)}function l(t){n(o,a,i,r,l,"throw",t)}r(void 0)}))})()},profileUrl:function(){return"https://".concat(window._portfolio.domain).concat(window._portfolio.path,"/").concat(this.profile.username)},postUrl:function(t){return"/".concat(this.profile.username,"/").concat(t.id)},formatDate:function(t){return new Date(t).toLocaleDateString(void 0,{weekday:"short",year:"numeric",month:"long",day:"numeric"})}}}},41843:(t,e,s)=>{s.r(e),s.d(e,{default:()=>l});var a=s(87757),i=s.n(a),n=(s(4155),s(31991),s(19755));function o(t,e,s,a,i,n,o){try{var r=t[n](o),l=r.value}catch(t){return void s(t)}r.done?e(l):Promise.resolve(l).then(a,i)}function r(t){return function(){var e=this,s=arguments;return new Promise((function(a,i){var n=t.apply(e,s);function r(t){o(n,a,i,r,l,"next",t)}function l(t){o(n,a,i,r,l,"throw",t)}r(void 0)}))}}const l={props:["initialData"],data:function(){return{loading:!0,user:void 0,profile:void 0,settings:void 0,feed:[],albumIndex:0,settingsUrl:window._portfolio.path+"/settings"}},mounted:function(){var t=JSON.parse(this.initialData);this.profile=t.profile,this.fetchUser()},methods:{fetchUser:function(){var t=this;return r(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return axios.get("/api/v1/accounts/verify_credentials").then((function(e){t.user=e.data})).catch((function(t){})),e.next=3,axios.get("/api/portfolio/account/settings.json",{params:{id:t.profile.id}}).then((function(e){t.settings=e.data})).then((function(){t.fetchFeed()}));case 3:case"end":return e.stop()}}),e)})))()},fetchFeed:function(){var t=this;return r(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:axios.get("/api/portfolio/"+t.profile.id+"/feed").then((function(e){t.feed=e.data.filter((function(t){return"photo"===t.pf_type}))})).then((function(){t.setAlbumSlide()})).then((function(){setTimeout((function(){t.loading=!1}),500)})).then((function(){"masonry"===t.settings.profile_layout&&setTimeout((function(){t.initMasonry()}),500)}));case 1:case"end":return e.stop()}}),e)})))()},postUrl:function(t){return"".concat(window._portfolio.path,"/").concat(this.profile.username,"/").concat(t.id)},albumPrev:function(){if(0!==this.albumIndex){if(1===this.albumIndex){this.albumIndex--;var t=new URL(window.location);return t.searchParams.delete("slide"),void window.history.pushState({},"",t)}this.albumIndex--;var e=new URL(window.location);e.searchParams.set("slide",this.albumIndex+1),window.history.pushState({},"",e)}},albumNext:function(){if(this.albumIndex!==this.feed.length-1){this.albumIndex++;var t=new URL(window.location);t.searchParams.set("slide",this.albumIndex+1),window.history.pushState({},"",t)}},setAlbumSlide:function(){var t=new URL(window.location);if(t.searchParams.has("slide")){var e=Number.parseInt(t.searchParams.get("slide"));if(Nu
|