1
0
Fork 0
pixelfed/public/js/compose.js

1 line
65 KiB
JavaScript
Raw Normal View History

2023-07-02 04:38:53 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[2416],{12434:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>c});var s=i(17652),a=(i(70461),i(29655)),o=(i(67964),i(15235)),l=i(19755);function n(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return r(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return r(t,e)}(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 r(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=new Array(e);i<e;i++)s[i]=t[i];return s}const c={components:{VueCropper:s.default,Autocomplete:a.default,VueTribute:o.default},data:function(){return{config:window.App.config,pageLoading:!1,profile:window._sharedData.curUser,composeText:"",composeTextLength:0,nsfw:!1,filters:[],currentFilter:!1,ids:[],media:[],carouselCursor:0,uploading:!1,uploadProgress:100,mode:"photo",modes:["photo","video","plain"],page:1,composeState:"publish",visibility:"public",visibilityTag:"Public",place:!1,commentsDisabled:!1,optimizeMedia:!0,mediaCropped:!1,pageTitle:"",cropper:{aspectRatio:1,viewMode:1,zoomable:!0,zoom:0},namedPages:["cropPhoto","tagPeople","addLocation","advancedSettings","visibility","altText","addToCollection","schedulePost","mediaMetadata","addToStory","editMedia","cameraRoll","tagPeopleHelp","textOptions","licensePicker"],cameraRollMedia:[],taggedUsernames:[],taggedPeopleSearch:null,textMode:!1,tributeSettings:{noMatchTemplate:function(){return null},collection:[{trigger:"@",menuShowMinLength:2,values:function(t,e){axios.get("/api/compose/v0/search/mention",{params:{q:t}}).then((function(t){e(t.data)})).catch((function(t){console.log(t)}))}},{trigger:"#",menuShowMinLength:2,values:function(t,e){axios.get("/api/compose/v0/search/hashtag",{params:{q:t}}).then((function(t){e(t.data)})).catch((function(t){console.log(t)}))}}]},availableLicenses:[{id:1,name:"All Rights Reserved",title:""},{id:5,name:"Public Domain Work",title:""},{id:6,name:"Public Domain Dedication (CC0)",title:"CC0"},{id:11,name:"Attribution",title:"CC BY"},{id:12,name:"Attribution-ShareAlike",title:"CC BY-SA"},{id:13,name:"Attribution-NonCommercial",title:"CC BY-NC"},{id:14,name:"Attribution-NonCommercial-ShareAlike",title:"CC BY-NC-SA"},{id:15,name:"Attribution-NoDerivs",title:"CC BY-ND"},{id:16,name:"Attribution-NonCommercial-NoDerivs",title:"CC BY-NC-ND"}],licenseIndex:0,video:{title:"",description:""},composeSettings:{default_license:null,media_descriptions:!1},licenseId:1,licenseTitle:null,maxAltTextLength:140,pollOptionModel:null,pollOptions:[],pollExpiry:1440,postingPoll:!1,collections:[],collectionsSelected:[],collectionsLoaded:!1,collectionsPage:1,collectionsCanLoadMore:!1,spoilerText:void 0}},computed:{spoilerTextLength:function(){return this.spoilerText?this.spoilerText.length:0}},beforeMount:function(){var t=this;this.filters=window.App.util.filters.sort(),axios.get("/api/compose/v0/settings").then((function(e){t.composeSettings=e.data,t.licenseId=t.composeSettings.default_license,t.maxAltTextLength=e.data.max_altext_length,t.licenseId>10&&(t.licenseTitle=t.availableLicenses.filter((function(e){return e.id==t.licenseId})).map((function(t){return t.title}))[0]),t.fetchProfile()}))},mounted:function(){this.mediaWatcher()},methods:{timeAgo:function(t){return App.util.format.timeAgo(t)},fetchProfile:function(){var t=this,e={public:"Public",private:"Followers Only",unlisted:"Unlisted"};if(window._sharedData.curUser.id){if(this.profile=window._sharedData.curUser,this.composeSettings&&this.composeSettings.hasOwnProperty("default_scope")&&this.composeSettings.default_scope){var i=this.composeSettings.default_scope;this.visibility=i,this.visibi