pixelfed/public/js/status.js

1 wiersz
133 KiB
JavaScript
Czysty Zwykły widok Historia

2024-04-12 10:00:25 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[4312],{38660:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>u});var a=s(79288),i=s(78841),o=s(2547),n=s(79984),r=s(24848),l=s(74692);function c(t){return function(t){if(Array.isArray(t))return d(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 d(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);"Object"===s&&t.constructor&&(s=t.constructor.name);if("Map"===s||"Set"===s)return Array.from(t);if("Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return d(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 d(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,a=new Array(e);s<e;s++)a[s]=t[s];return a}pixelfed.postComponent={};const u={props:["status-id","status-username","status-template","status-url","status-profile-url","status-avatar","status-profile-id","profile-layout","profile-recent"],components:{VueTribute:a.default,PollCard:i.default,CommentFeed:o.default,StatusCard:n.default},data:function(){return{config:window.App.config,status:!1,media:{},user:!1,reactions:{liked:!1,shared:!1},likes:[],likesCursor:null,likesCanLoadMore:!0,likedLoaded:!1,shares:[],lightboxMedia:!1,replyText:"",replyStatus:{},replySensitive:!1,relationship:{},results:[],pagination:{},min_id:0,max_id:0,reply_to_profile_id:0,thread:!1,showComments:!1,warning:!1,loaded:!1,loading:null,replyingToId:this.statusId,replyingToUsername:this.statusUsername,replyToIndex:0,replySending:!1,emoji:window.App.util.emoji,showReadMore:!0,showCaption:!0,ctxEmbedPayload:!1,copiedEmbed:!1,ctxEmbedShowCaption:!0,ctxEmbedShowLikes:!1,ctxEmbedCompactMode:!1,layout:this.profileLayout,showProfileMorePosts:!1,profileMorePosts:[],reactionBarLoading:!0,tributeSettings:{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)}))}}]},content:void 0}},watch:{ctxEmbedShowCaption:function(t,e){1==t&&(this.ctxEmbedCompactMode=!1);var s=this.ctxEmbedCompactMode?"compact":"full";this.ctxEmbedPayload=window.App.util.embed.post(this.status.url,this.ctxEmbedShowCaption,this.ctxEmbedShowLikes,s)},ctxEmbedShowLikes:function(t,e){1==t&&(this.ctxEmbedCompactMode=!1);var s=this.ctxEmbedCompactMode?"compact":"full";this.ctxEmbedPayload=window.App.util.embed.post(this.status.url,this.ctxEmbedShowCaption,this.ctxEmbedShowLikes,s)},ctxEmbedCompactMode:function(t,e){1==t&&(this.ctxEmbedShowCaption=!1,this.ctxEmbedShowLikes=!1);var s=this.ctxEmbedCompactMode?"compact":"full";this.ctxEmbedPayload=window.App.util.embed.post(this.status.url,this.ctxEmbedShowCaption,this.ctxEmbedShowLikes,s)}},beforeMount:function(){this.layout="metro"},mounted:function(){this.fetchRelationships(),"false"==localStorage.getItem("pf_metro_ui.exp.rm")?this.showReadMore=!1:this.showReadMore=!0},updated:function(){l(".carousel").carousel(),l('[data-toggle="tooltip"]').tooltip(),1==this.showReadMore&&window.pixelfed.readmore()},methods:{reportUrl:function(){return"/i/report?type=post&id="+this.status.id},editUrl:function(){return this.status.url+"/edit"},timestampFormat:function(){var t=new Date(this.status.created_at);return t.toDateString()+" · "+t.toLocaleTimeString()},fetchData:function(){var t=this,e=this;axios.get("/api/v2/profile/"+this.statusUsername+"/status/"+this.statusId).then((function(s){"poll"==s.data.status.pf_type&&(e.layout="poll"),"text"==s.data.status.pf_type&&(e.layout="text"),e.status=s.data.status,e.media=e.status.media_attachments,e.content=s.data.status.content,e.status.emojis.forEach((function(t){var s='<img draggable="false" class=