pixelfed/public/js/compose.js

1 line
68 KiB
JavaScript
Raw Normal View History

2024-03-05 13:27:56 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[5666],{28320:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>c});var s=i(91584),a=(i(77333),i(2e4)),o=(i(87980),i(79288)),n=i(74692);function l(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:["filteringMedia","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){}))}},{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){}))}}]},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,isFilteringMedia:!1,filteringMediaTimeout:void 0,filteringRemainingCount:0,isPosting:!1}},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)},formatBytes:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(!+t)return"0 Bytes";var i=e<0?0:e,s=Math.floor(Math.log(t)/Math.log(1024));return"".concat(parseFloat((t/Math.pow(1024,s)).toFixed(i))," ").concat(["Bytes","KB","MB","GB","TB"][s])},defineErrorM