pixelfed/public/js/compose.chunk.47ba00abaa827b26.js

1 line
92 KiB
JavaScript
Raw Normal View History

2024-04-06 08:47:39 +00:00
"use strict";(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[9124],{66517:(t,e,a)=>{a.r(e),a.d(e,{default:()=>n});var i=a(5787),s=a(28772),o=a(19324);const n={components:{drawer:i.default,sidebar:s.default,"compose-modal":o.default},data:function(){return{isLoaded:!1,profile:void 0}},mounted:function(){this.profile=window._sharedData.user,this.isLoaded=!0},methods:{closeModal:function(){this.$router.push("/i/web")}}}},50371:(t,e,a)=>{a.r(e),a.d(e,{default:()=>i});const i={data:function(){return{user:window._sharedData.user}}}},84154:(t,e,a)=>{a.r(e),a.d(e,{default:()=>i});const i={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 i=t.dataTransfer.items[a].getAsFile();if(!i)return;e.avatarUpdateFile=i,e.avatarUpdatePreview=URL.createObjectURL(i),e.avatarUpdateIndex=1}}else for(a=0;a<t.dataTransfer.files.length;a++){if(!t.dataTransfer.files[a].hasOwnProperty("name"))return;e.avatarUpdateFile=t.dataTransfer.files[a],e.avatarUpdatePreview=URL.createObjectURL(t.dataTransfer.files[a]),e.avatarUpdateIndex=1}},confirmUpload:function(){var t=this;if(window.confirm("Are you sure you want to change your avatar photo?")){var e=new FormData;e.append("_method","PATCH"),e.append("avatar",this.avatarUpdateFile),axios.post("/api/v1/accounts/update_credentials",e).then((function(e){window._sharedData.user.avatar=e.data.avatar,t.avatarUpdateClose()})).catch((function(t){t.response.data&&t.response.data.errors&&t.response.data.errors.avatar&&t.response.data.errors.avatar.length&&swal("Oops!",t.response.data.errors.avatar[0],"error")}))}}}}},79318:(t,e,a)=>{a.r(e),a.d(e,{default:()=>l});var i=a(95353),s=a(90414);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function n(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,i)}return a}function r(t,e,a){var i;return i=function(t,e){if("object"!=o(t)||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var i=a.call(t,e||"default");if("object"!=o(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(e,"string"),(e="symbol"==o(i)?i:i+"")in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}const l={props:{user:{type:Object,default:function(){return{avatar:"/storage/avatars/default.jpg",username:!1,display_name:"",following_count:0,followers_count:0}}},links:{type:Array,default:function(){return[{name:"Discover",path:"/i/web/discover",icon:"fas fa-compass"},{name:"Groups",path:"/i/web/groups",icon:"far fa-user-friends"},{name:"Videos",path:"/i/web/videos",icon:"far fa-video"}]}}},components:{UpdateAvatar:s.default},computed:function(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?n(Object(a),!0).forEach((function(e){r(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):n(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}({}