pixelfed/public/js/rempos.js

1 line
144 KiB
JavaScript
Raw Normal View History

2021-09-04 04:36:52 +00:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[21],{"/jad":function(t,e,s){"use strict";var a=s("1gDp"),i=s("ngXG"),o={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":a.a,"poll-card":i.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,s=window.App.config.username.remote.custom,a=t.account.username,i=document.createElement("a");switch(i.href=t.account.url,i=i.hostname,e){case"@":return a+'<span class="text-lighter font-weight-bold">@'+i+"</span>";case"from":return a+'<span class="text-lighter font-weight-bold"> <span class="font-weight-normal">from</span> '+i+"</span>";case"custom":return a+'<span class="text-lighter font-weight-bold"> '+s+" "+i+"</span>";default:return a+'<span class="text-lighter font-weight-bold">@'+i+"</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 s=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=s,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 s=this;this.replySending=!0;var a=t.id,i=this.replyText,o=this.config.uploader.max_caption_length;if(i.length>o)return this.replySending=!1,void swal("Comment Too Long","Please make sure your comment is "+o+" characters or less.","error");axios.post("/i/comment",{item:a,comment:i,sensitive:this.replyNsfw}).then((function(t){s.replyText="",s.replies.push(t.data.entity),s.$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)}}},n=(s("RePV"),s("KHd+")),r=Object(n.a)(o,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"status-card-component",class:{"status-card-sm":"small"===t.size}},["text"===t.status.pf_type?s("div",{staticClass:"card shadow-none border rounded-0",class:{"border-top-0":!t.hasTopBorder}},[s("div",{staticClass:"card-body"},[s("div",{staticClass:"media"},[s("img",{staticClass:"rounded-circle box-shadow mr-2",attrs:{src:t.status.account.avatar,width:"32px",height:"32px",onerror:"this.onerror=null;this.src='/storage/avatars/default.png?v=2'",alt:"avatar"}}),t._v(" "),s("div",{staticClass:"media-body"},[s("div",{staticClass:"pl-2 d-flex align-items-top"},[s("a",{staticClass:"username font-weight-bold text-dark text-decoration-none text-break",attrs:{href:t.profileUrl(t.status)