PageSourceSearch

https://bookcrossing.ru/_nuxt/CyDTQZg7.js

js bookcrossing.ru collected 2026-09-24 22:00:55 UTC 7,677 bytes, 1 lines download raw bytes

1import{_ as A}from"./BsgjGSxF.js";import{_ as R}from"./HiY4nuWc.js";import{_ as P}from"./BwHB2evJ.js";import{aP as E,b7 as L,bB as D,bC as T,bd as U,aQ as i,aR as a,aT as k,aU as x,be as m,aY as d,aS as c,a_ as g,aV as S,a$ as u,aX as l,b0 as C,aZ as O,b4 as v,b5 as V,bD as I,b1 as $,b2 as h}from"./BM_Hxj11.js";import{g as B,b as K,f as q}from"./m_4Qi_Kp.js";import{u as _}from"./B5NSwsoa.js";import{_ as Y}from"./BRWUID4r.js";import{_ as j}from"./CB5QrfQZ.js";import"./DLi_oT0-.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"6af96dec"};var s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="8f15dbf0-498f-49c2-b2c8-1b02ab69d968",e._sentryDebugIdIdentifier="sentry-dbid-8f15dbf0-498f-49c2-b2c8-1b02ab69d968")}catch{}})();const z={name:"DialogsList",components:{Avatar:A},data(){return{loadingMore:!1}},async fetch(){await this.getDialogs()},computed:{...T(_,["recipient","dialogsLoading","dialogs","dialogsPage","dialogsPages"])},methods:{formatShortTime:K,formatDateTime:B,...D(_,["setSelectedRecipient","getDialogs"]),...D(_,["SET_DIALOGS_PAGE","SET_DIALOGS_PAGES","APPEND_DIALOGS"]),async loadMoreDialogs(){if(!(this.dialogsPage>=this.dialogsPages)){this.loadingMore=!0;try{const e=await this.$api("/messages",{params:{page:this.dialogsPage}});e.data.length?(this.SET_DIALOGS_PAGE(this.dialogsPage+1),this.APPEND_DIALOGS(...e.data),$state.loaded()):$state.complete()}catch(e){console.error(e),L().error("Не удалось подгрузить диалоги")}finally{this.loadingMore=!1}}},selectUser(e){history.pushState({},null,"/messages/"+e.id),this.setSelectedRecipient(e)},mainUserInDialog(e){return e.in?e.sender:e.recipient}}},F=["data-id","onClick"],H={class:"recipient__header"},Q={class:"recipient__name"},X={class:"recipient__time"},Z={key:0,class:"recipient__message-you"},J={key:0,class:"recipients__empty"};function W(e,s,M,N,n,t){const f=A,b=R,p=P,y=U("tooltip");return i(),a("div",{class:m(["recipients",{skeleton:e.dialogsLoading}])},[(i(!0),a(k,null,x(e.dialogs,r=>(i(),a("div",{key:t.mainUserInDialog(r).id,class:m(["recipient",{recipient_selected:e.recipient?.id===t.mainUserInDialog(r).id}]),"data-id":t.mainUserInDialog(r).id,onClick:w=>t.selectUser(t.mainUserInDialog(r))},[d(f,{src:t.mainUserInDialog(r).avatar,class:"recipient__avatar"},null,8,["src"]),c("div",H,[c("div",Q,g(t.mainUserInDialog(r).login),1),S((i(),a("div",X,[u(g(t.formatShortTime(r.time)),1)])),[[y,t.formatDateTime(r.time)]])]),c("div",{class:m(["recipient__message",{recipient__message_unread:!r.isRead}])},[r.in?l("",!0):(i(),a("span",Z,"Вы: ")),u(" "+g(r.message),1)],2)],10,F))),128)),!e.dialogs.length&&!e.dialogsLoading?(i(),a("div",J," у вас нет диалогов ")):l("",!0),n.loadingMore?(i(),C(b,{key:1})):l("",!0),d(p,{onIntersect:t.loadMoreDialogs},null,8,["onIntersect"])],2)}const G=Object.assign(E(z,[["render",W],["__scopeId","data-v-e97a0c5f"]]),{__name:"Dialogs"}),ee={name:"MessagesPage",components:{Loader:R,Dialogs:G},data(){return{loading:!1,sending:!1,messages:[],messageText:"",page:Number((this._.provides[h]||this.$route).query.page||1),pages:1,loadingMore:!1}},async fetch(){if((this._.provides[h]||this.$route).params.id){const e=await this.getUser((this._.provides[h]||this.$route).params.id);await this.setSelectedRecipient(e),await this.getDialog((this._.provides[h]||this.$route).params.id)}},head(){return $({title:"Диалоги",description:"Список ваших диалогов с другими буккроссерами"})},computed:{...T(_,{selectedRecipient:"recipient",newMessage:"newMessage"}),...T(_,["getDraft"])},watch:{selectedRecipient(e,s){s&&this.setDraft({userId:s.id,message:this.messageText}),e&&(this.messageText=this.getDraft(e.id),this.getMessages(e.id))},newMessage(e){e.sender.id===this.selectedRecipient.id&&this.getMessages(this.selectedRecipient.id)}},async mounted(){this.scrollToBottom()},methods:{...D(_,["setSelectedRecipient","setDraft","getDialogs","markAsRead"]),formatDateTime:B,formatTime:q,async getDialog(e){await this.getMessages(e)},getMessages(e){return this.loading=!0,this.$api("/messages/"+e).then(s=>{this.page=1,this.loading=!1,this.messages=s.data.reverse(),this.pages=s.pagination.totalPages,this.scrollToBottom(),this.markAsRead(e)})},scrollToBottom(){this.$nextTick(()=>{!this.$isServer&&this.$refs.messagesArea&&(this.$refs.messagesArea.scrollTop=this.$refs.messagesArea.scrollHeight)})},async loadMoreMessages(){if(!(this.page>=this.pages)){this.loadingMore=!0;try{const e=await this.$api("/messages/"+this.selectedRecipient.id,{params:{page:this.page+1}});this.page+=1,this.messages.unshift(...e.data.reverse())}catch(e){console.error(e),L().error("Не удалось подгрузить сообщения")}finally{this.loadingMore=!1}}},unselectRecipient(){this.setSelectedRecipient(null),history.pushState({},null,"/messages")},getUser(e){return this.$api("/users/"+e).then(s=>s.data.user)},send(){this.sending=!0,this.$api("/messages/"+this.selectedRecipient.id,{method:"POST",body:{message:this.messageText}}).then(e=>{this.messages.push(e.data),this.messageText="",this.sending=!1,this.scrollToBottom(),this.getDialogs()})}}},se={class:"dialog"},te={key:0,class:"dialog__header"},ie={key:1,ref:"messagesArea",class:"dialog__content"},ae={key:0,class:"loader-wrapper"},oe={key:0,class:"loader-more-wrapper"},ne={class:"message__content"},re={class:"message__info"},le={key:2,class:"dialog__no-messages"},de=["disabled"],ce=["disabled"],ge={key:3,class:"dialog__placeholder"};function _e(e,s,M,N,n,t){const f=G,b=Y,p=R,y=P,r=j,w=U("tooltip");return i(),a("div",{class:m(["messages",{"messages_dialog-selected":e.selectedRecipient!==null}])},[d(f),c("div",se,[e.selectedRecipient?(i(),a("div",te,[c("button",{class:"dialog__back-button",onClick:s[0]||(s[0]=(...o)=>t.unselectRecipient&&t.unselectRecipient(...o))}),d(b,{to:"/users/"+e.selectedRecipient.id},{default:O(()=>[u(g(e.selectedRecipient.login),1)]),_:1},8,["to"])])):l("",!0),e.selectedRecipient?(i(),a("div",ie,[n.loading?(i(),a("div",ae,[d(p)])):l("",!0),n.loading?l("",!0):(i(),a(k,{key:1},[n.loadingMore?(i(),a("div",oe,[d(p)])):l("",!0),d(y,{onIntersect:t.loadMoreMessages},null,8,["onIntersect"]),(i(!0),a(k,null,x(n.messages,o=>(i(),a("div",{key:o.id,class:m(["message",{message_out:!o.in,message_in:o.in,message_unread:!o.isRead}])},[c("div",ne,[d(r,{source:o.message,"anchor-attributes":{target:"_blank",rel:"noopener noreferrer nofollow"},quotes:"«»„“"},null,8,["source"])]),S((i(),a("div",re,[u(g(t.formatTime(o.time)),1)])),[[w,t.formatDateTime(o.time)]])],2))),128))],64)),!n.messages.length&&!n.loading?(i(),a("div",le," У вас с "+g(e.selectedRecipient.login)+" нет сообщений ",1)):l("",!0)],512)):l("",!0),e.selectedRecipient&&!n.loading?(i(),a("form",{key:2,class:"dialog-reply-form",onSubmit:s[4]||(s[4]=v((...o)=>t.send&&t.send(...o),["prevent"]))},[S(c("textarea",{"onUpdate:modelValue":s[1]||(s[1]=o=>n.messageText=o),class:"dialog-reply-form__field",placeholder:"Введите сообщение",autofocus:"",disabled:n.sending,onKeyup:s[2]||(s[2]=I(v((...o)=>t.send&&t.send(...o),["ctrl"]),["enter"])),onKeydown:s[3]||(s[3]=I(v((...o)=>t.send&&t.send(...o),["meta"]),["enter"]))},null,40,de),[[V,n.messageText]]),c("button",{disabled:n.sending,type:"submit",class:"dialog-reply-form__button"},null,8,ce)],32)):l("",!0),!e.selectedRecipient&&!n.loading?(i(),a("div",ge," Ð
1’ыберите собеседника ")):l("",!0)])],2)}const Te=E(ee,[["render",_e],["__scopeId","data-v-3d534764"]]);export{Te as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.