You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixelfed/public/js/portfolio.js

2 lines
35 KiB
JavaScript

/*! For license information please see portfolio.js.LICENSE.txt */
"use strict";(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[4082],{9713:(t,e,s)=>{function a(){var t,e,s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",n=s.toStringTag||"@@toStringTag";function r(s,a,o,n){var r=a&&a.prototype instanceof c?a:c,d=Object.create(r.prototype);return i(d,"_invoke",function(s,a,i){var o,n,r,c=0,d=i||[],u=!1,f={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,s){return o=e,n=0,r=t,f.n=s,l}};function p(s,a){for(n=s,r=a,e=0;!u&&c&&!i&&e<d.length;e++){var i,o=d[e],p=f.p,h=o[2];s>3?(i=h===a)&&(r=o[(n=o[4])?5:(n=3,3)],o[4]=o[5]=t):o[0]<=p&&((i=s<2&&p<o[1])?(n=0,f.v=a,f.n=o[1]):p<h&&(i=s<3||o[0]>a||a>h)&&(o[4]=s,o[5]=a,f.n=h,n=0))}if(i||s>1)return l;throw u=!0,a}return function(i,d,h){if(c>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,h),n=d,r=h;(e=n<2?t:r)||!u;){o||(n?n<3?(n>1&&(f.n=-1),p(n,r)):f.n=r:f.v=r);try{if(c=2,o){if(n||(i="next"),e=o[i]){if(!(e=e.call(o,r)))throw TypeError("iterator result is not an object");if(!e.done)return e;r=e.value,n<2&&(n=0)}else 1===n&&(e=o.return)&&e.call(o),n<2&&(r=TypeError("The iterator does not provide a '"+i+"' method"),n=1);o=t}else if((e=(u=f.n<0)?r:s.call(a,f))!==l)break}catch(e){o=t,n=1,r=e}finally{c=1}}return{value:e,done:u}}}(s,o,n),!0),d}var l={};function c(){}function d(){}function u(){}e=Object.getPrototypeOf;var f=[][o]?e(e([][o]())):(i(e={},o,function(){return this}),e),p=u.prototype=c.prototype=Object.create(f);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,i(t,n,"GeneratorFunction")),t.prototype=Object.create(p),t}return d.prototype=u,i(p,"constructor",u),i(u,"constructor",d),d.displayName="GeneratorFunction",i(u,n,"GeneratorFunction"),i(p),i(p,n,"Generator"),i(p,o,function(){return this}),i(p,"toString",function(){return"[object Generator]"}),(a=function(){return{w:r,m:h}})()}function i(t,e,s,a){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}i=function(t,e,s,a){function n(e,s){i(t,e,function(t){return this._invoke(e,s,t)})}e?o?o(t,e,{value:s,enumerable:!a,configurable:!a,writable:!a}):t[e]=s:(n("next",0),n("throw",1),n("return",2))},i(t,e,s,a)}function o(t,e,s,a,i,o,n){try{var r=t[o](n),l=r.value}catch(t){return void s(t)}r.done?e(l):Promise.resolve(l).then(a,i)}s.r(e),s.d(e,{default:()=>n});const n={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=a().m(function t(){return a().w(function(t){for(;;)switch(t.n){case 0:if(!e.isAuthed){t.n=1;break}return t.n=1,axios.get("/api/v1/accounts/verify_credentials").then(function(t){e.user=t.data}).catch(function(t){});case 1:return t.n=2,axios.get("/api/portfolio/account/settings.json",{params:{id:e.profile.id}}).then(function(t){e.settings=t.data,t.data.hasOwnProperty("background_color")&&e.updateCssVariable("--body-bg",t.data.background_color),t.data.hasOwnProperty("text_color")&&(e.updateCssVariable("--text-color",t.data.text_color),e.updateCssVariable("--link-color",t.data.text_color))}).then(function(){setTimeout(function(){e.loading=!1},500)});case 2:return t.a(2)}},t)}),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)})})()},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"})},updateCssVariable:function(t,e){document.querySelector(":root").style.setProperty(t,e)}}}},10938:(t,e,s)=>{s.r(e),s.d(e,{render:()=>a,staticRenderFns:()=>i});var a=function(){var t=this,e=t._self._c;return e("div",{sta