pixelfed/public/js/spa.js

1 line
1.5 MiB
JavaScript
Raw Normal View History

2021-12-22 04:45:43 +00:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[20],{"+3PN":function(t,e,n){var i=n("eWeD");"string"==typeof i&&(i=[[t.i,i,""]]);var a={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(i,a);i.locals&&(t.exports=i.locals)},"+VHp":function(t,e,n){"use strict";n("V8Te")},"+uhv":function(t,e,n){"use strict";n("M24V")},"/RaH":function(t,e,n){var i=n("iTP3");"string"==typeof i&&(i=[[t.i,i,""]]);var a={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(i,a);i.locals&&(t.exports=i.locals)},"/Y1X":function(t,e,n){"use strict";n("KOWi")},"/jad":function(t,e,n){"use strict";var i=n("1gDp"),a=n("ngXG"),r={props:{status:{type:Object},recommended:{type:Boolean,default:!1},reactionBar:{type:Boolean,default:!0},hasTopBorder:{type:Boolean,default:!1},size:{type:String,validator:function(t){return["regular","small"].includes(t)},default:"regular"}},components:{"context-menu":i.a,"poll-card":a.a},data:function(){return{config:window.App.config,profile:{},loading:!0,replies:[],replyId:null,lightboxMedia:!1,showSuggestions:!0,showReadMore:!0,replyStatus:{},replyText:"",replyNsfw:!1,emoji:window.App.util.emoji}},mounted:function(){this.profile=window._sharedData.curUser},methods:{formatCount:function(t){return App.util.format.count(t)},statusUrl:function(t){return 1==t.local?t.url:"/i/web/post/_/"+t.account.id+"/"+t.id},profileUrl:function(t){return 1==t.local?t.account.url:"/i/web/profile/_/"+t.account.id},timestampFormat:function(t){var e=new Date(t);return e.toDateString()+" "+e.toLocaleTimeString()},shortTimestamp:function(t){return window.App.util.format.timeAgo(t)},statusCardUsernameFormat:function(t){if(1==t.account.local)return t.account.username;var e=window.App.config.username.remote.format,n=window.App.config.username.remote.custom,i=t.account.username,a=document.createElement("a");switch(a.href=t.account.url,a=a.hostname,e){case"@":return i+'<span class="text-lighter font-weight-bold">@'+a+"</span>";case"from":return i+'<span class="text-lighter font-weight-bold"> <span class="font-weight-normal">from</span> '+a+"</span>";case"custom":return i+'<span class="text-lighter font-weight-bold"> '+n+" "+a+"</span>";default:return i+'<span class="text-lighter font-weight-bold">@'+a+"</span>"}},lightbox:function(t){window.location.href=t.media_attachments[0].url},labelRedirect:function(t){var e="/i/redirect?url="+encodeURI(this.config.features.label.covid.url);window.location.href=e},likeStatus:function(t,e){if(0!=$("body").hasClass("loggedIn")){var n=t.favourites_count;t.favourited=!t.favourited,axios.post("/i/like",{item:t.id}).then((function(e){t.favourites_count=e.data.count,t.favourited=!!t.favourited})).catch((function(e){t.favourited=!!t.favourited,t.favourites_count=n,swal("Error","Something went wrong, please try again later.","error")})),window.navigator.vibrate(200),t.favourited&&setTimeout((function(){e.target.classList.add("animate__animated","animate__bounce")}),100)}},commentFocus:function(t,e){this.$emit("comment-focus",t)},commentSubmit:function(t,e){var n=this;this.replySending=!0;var i=t.id,a=this.replyText,r=this.config.uploader.max_caption_length;if(a.length>r)return this.replySending=!1,void swal("Comment Too Long","Please make sure your comment is "+r+" characters or less.","error");axios.post("/i/comment",{item:i,comment:a,sensitive:this.replyNsfw}).then((function(t){n.replyText="",n.replies.push(t.data.entity),n.$refs.replyModal.hide()})),this.replySending=!1},owner:function(t){return this.profile.id===t.account.id},admin:function(){return 1==this.profile.is_admin},ownerOrAdmin:function(t){return this.owner(t)||this.admin()},ctxMenu:function(){this.$refs.contextMenu.open()},timeAgo:function(t){return App.util.format.timeAgo(t)},statusDeleted:function(t){this.$emit("status-delete",t)},canFollow:function(t){return!!t.hasOwnProperty("relationship")&&(!(!t.hasOwnProperty("account")||!t.account.hasOwnProperty("id"))&&(t.account.id!=this.profile.id&&!t.relationship.following))},follow:function(t){var e=this;event.currentTarget.blur(),axios.post("/i/follow",{item:t}).then((function(n){e.status.relationship.fol