PostComponent.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170
  1. <template>
  2. <div>
  3. <div v-if="!loaded" style="height: 80vh;" class="d-flex justify-content-center align-items-center">
  4. <img src="/img/pixelfed-icon-grey.svg" class="">
  5. </div>
  6. <div v-if="loaded && warning" class="bg-white pt-3 border-bottom">
  7. <div class="container">
  8. <p class="text-center font-weight-bold">You are blocking this account</p>
  9. <p class="text-center font-weight-bold">Click <a href="#" class="cursor-pointer" @click.prevent="warning = false; fetchData()">here</a> to view this status</p>
  10. </div>
  11. </div>
  12. <div v-if="loaded && warning == false" class="postComponent">
  13. <div v-if="profileLayout == 'metro'" class="container px-0">
  14. <div class="card card-md-rounded-0 status-container orientation-unknown shadow-none border">
  15. <div class="row px-0 mx-0">
  16. <div class="d-flex d-md-none align-items-center justify-content-between card-header bg-white w-100">
  17. <div class="d-flex">
  18. <div class="status-avatar mr-2" @click="redirect(statusProfileUrl)">
  19. <img :src="statusAvatar" width="24px" height="24px" style="border-radius:12px;" class="cursor-pointer">
  20. </div>
  21. <div class="username">
  22. <span class="username-link font-weight-bold text-dark cursor-pointer" @click="redirect(statusProfileUrl)">{{ statusUsername }}</span>
  23. <span v-if="status.account.is_admin" class="fa-stack" title="Admin Account" data-toggle="tooltip" style="height:1em; line-height:1em; max-width:19px;">
  24. <i class="fas fa-certificate text-danger fa-stack-1x"></i>
  25. <i class="fas fa-crown text-white fa-sm fa-stack-1x" style="font-size:7px;"></i>
  26. </span>
  27. <p v-if="loaded && status.place != null" class="small mb-0 cursor-pointer text-truncate" style="color:#718096" @click="redirect('/discover/places/' + status.place.id + '/' + status.place.slug)">{{status.place.name}}, {{status.place.country}}</p>
  28. </div>
  29. </div>
  30. <div v-if="user != false" class="float-right">
  31. <div class="post-actions">
  32. <div class="dropdown">
  33. <button class="btn btn-link text-dark no-caret dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Post options">
  34. <span class="fas fa-ellipsis-v text-muted"></span>
  35. </button>
  36. <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
  37. <div v-if="!owner()">
  38. <a class="dropdown-item font-weight-bold" :href="reportUrl()">Report</a>
  39. <a class="dropdown-item font-weight-bold" v-on:click="muteProfile()">Mute Profile</a>
  40. <a class="dropdown-item font-weight-bold" v-on:click="blockProfile()">Block Profile</a>
  41. </div>
  42. <div v-if="ownerOrAdmin()">
  43. <a class="dropdown-item font-weight-bold" href="#" v-on:click.prevent="toggleCommentVisibility">{{ showComments ? 'Disable' : 'Enable'}} Comments</a>
  44. <a class="dropdown-item font-weight-bold" :href="editUrl()">Edit</a>
  45. <a class="dropdown-item font-weight-bold text-danger" v-on:click="deletePost(status)">Delete</a>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="col-12 col-md-8 px-0 mx-0">
  53. <div class="postPresenterContainer d-none d-flex justify-content-center align-items-center" v-on:dblclick="likeStatus">
  54. <div v-if="status.pf_type === 'photo'" class="w-100">
  55. <photo-presenter :status="status" v-on:lightbox="lightbox"></photo-presenter>
  56. </div>
  57. <div v-else-if="status.pf_type === 'video'" class="w-100">
  58. <video-presenter :status="status"></video-presenter>
  59. </div>
  60. <div v-else-if="status.pf_type === 'photo:album'" class="w-100">
  61. <photo-album-presenter :status="status" v-on:lightbox="lightbox"></photo-album-presenter>
  62. </div>
  63. <div v-else-if="status.pf_type === 'video:album'" class="w-100">
  64. <video-album-presenter :status="status"></video-album-presenter>
  65. </div>
  66. <div v-else-if="status.pf_type === 'photo:video:album'" class="w-100">
  67. <mixed-album-presenter :status="status" v-on:lightbox="lightbox"></mixed-album-presenter>
  68. </div>
  69. <div v-else class="w-100">
  70. <p class="text-center p-0 font-weight-bold text-white">Error: Problem rendering preview.</p>
  71. </div>
  72. </div>
  73. </div>
  74. <div class="col-12 col-md-4 px-0 d-flex flex-column border-left border-md-left-0">
  75. <div class="d-md-flex d-none align-items-center justify-content-between card-header py-3 bg-white">
  76. <div class="d-flex align-items-center status-username text-truncate" data-toggle="tooltip" data-placement="bottom" :title="statusUsername">
  77. <div class="status-avatar mr-2" @click="redirect(statusProfileUrl)">
  78. <img :src="statusAvatar" width="24px" height="24px" style="border-radius:12px;" class="cursor-pointer">
  79. </div>
  80. <div class="username">
  81. <span class="username-link font-weight-bold text-dark cursor-pointer" @click="redirect(statusProfileUrl)">{{ statusUsername }}</span>
  82. <span v-if="status.account.is_admin" class="fa-stack" title="Admin Account" data-toggle="tooltip" style="height:1em; line-height:1em; max-width:19px;">
  83. <i class="fas fa-certificate text-danger fa-stack-1x"></i>
  84. <i class="fas fa-crown text-white fa-sm fa-stack-1x" style="font-size:7px;"></i>
  85. </span>
  86. <p v-if="loaded && status.place != null" class="small mb-0 cursor-pointer text-truncate" style="color:#718096" @click="redirect('/discover/places/' + status.place.id + '/' + status.place.slug)">{{status.place.name}}, {{status.place.country}}</p>
  87. </div>
  88. </div>
  89. <div class="float-right">
  90. <div class="post-actions">
  91. <div v-if="user != false" class="dropdown">
  92. <button class="btn btn-link text-dark no-caret dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Post options">
  93. <span class="fas fa-ellipsis-v text-muted"></span>
  94. </button>
  95. <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
  96. <span v-if="!owner()">
  97. <a class="dropdown-item font-weight-bold" :href="reportUrl()">Report</a>
  98. <a class="dropdown-item font-weight-bold" v-on:click="muteProfile">Mute Profile</a>
  99. <a class="dropdown-item font-weight-bold" v-on:click="blockProfile">Block Profile</a>
  100. </span>
  101. <span v-if="ownerOrAdmin()">
  102. <a class="dropdown-item font-weight-bold" href="#" v-on:click.prevent="toggleCommentVisibility">{{ showComments ? 'Disable' : 'Enable'}} Comments</a>
  103. <a class="dropdown-item font-weight-bold" :href="editUrl()">Edit</a>
  104. <a class="dropdown-item font-weight-bold text-danger" v-on:click="deletePost">Delete</a>
  105. </span>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <div class="d-flex flex-md-column flex-column-reverse h-100" style="overflow-y: auto;">
  112. <div class="card-body status-comments pb-5">
  113. <div class="status-comment">
  114. <div v-if="showCaption != true">
  115. <span class="py-3">
  116. <a class="text-dark font-weight-bold mr-1" :href="status.account.url" v-bind:title="status.account.username">{{truncate(status.account.username,15)}}</a>
  117. <span class="text-break">
  118. <span class="font-italic text-muted">This comment may contain sensitive material</span>
  119. <span class="text-primary cursor-pointer pl-1" @click="showCaption = true">Show</span>
  120. </span>
  121. </span>
  122. </div>
  123. <div v-else>
  124. <p :class="[status.content.length > 620 ? 'mb-1 read-more' : 'mb-1']" style="overflow: hidden;">
  125. <a class="font-weight-bold pr-1 text-dark text-decoration-none" :href="statusProfileUrl">{{statusUsername}}</a>
  126. <span class="comment-text" :id="status.id + '-status-readmore'" v-html="status.content"></span>
  127. </p>
  128. </div>
  129. <div v-if="showComments">
  130. <hr>
  131. <div class="postCommentsLoader text-center">
  132. <div class="spinner-border" role="status">
  133. <span class="sr-only">Loading...</span>
  134. </div>
  135. </div>
  136. <div class="postCommentsContainer d-none">
  137. <p v-if="status.reply_count > 10"class="mb-1 text-center load-more-link d-none"><a href="#" class="text-muted" v-on:click="loadMore">Load more comments</a></p>
  138. <div class="comments">
  139. <div v-for="(reply, index) in results" class="pb-3" :key="'tl' + reply.id + '_' + index">
  140. <div v-if="reply.sensitive == true">
  141. <span class="py-3">
  142. <a class="text-dark font-weight-bold mr-1" :href="reply.account.url" v-bind:title="reply.account.username">{{truncate(reply.account.username,15)}}</a>
  143. <span class="text-break">
  144. <span class="font-italic text-muted">This comment may contain sensitive material</span>
  145. <span class="text-primary cursor-pointer pl-1" @click="reply.sensitive = false;">Show</span>
  146. </span>
  147. </span>
  148. </div>
  149. <div v-else>
  150. <p class="d-flex justify-content-between align-items-top read-more" style="overflow-y: hidden;">
  151. <span>
  152. <a class="text-dark font-weight-bold mr-1" :href="reply.account.url" v-bind:title="reply.account.username">{{truncate(reply.account.username,15)}}</a>
  153. <span class="text-break" v-html="reply.content"></span>
  154. </span>
  155. <span class="pl-2" style="min-width:38px">
  156. <span v-on:click="likeReply(reply, $event)"><i v-bind:class="[reply.favourited ? 'fas fa-heart fa-sm text-danger':'far fa-heart fa-sm text-lighter']"></i></span>
  157. <post-menu :status="reply" :profile="user" :size="'sm'" :modal="'true'" class="d-inline-block pl-2" v-on:deletePost="deleteComment(reply.id, index)"></post-menu>
  158. </span>
  159. </p>
  160. <p class="">
  161. <a v-once class="text-muted mr-3 text-decoration-none small" style="width: 20px;" v-text="timeAgo(reply.created_at)" :href="reply.url"></a>
  162. <span v-if="reply.favourites_count" class="text-muted comment-reaction font-weight-bold mr-3">{{reply.favourites_count == 1 ? '1 like' : reply.favourites_count + ' likes'}}</span>
  163. <span class="text-muted comment-reaction font-weight-bold cursor-pointer" v-on:click="replyFocus(reply, index)">Reply</span>
  164. </p>
  165. <div v-if="reply.reply_count > 0" class="cursor-pointer" style="margin-left:30px;" v-on:click="toggleReplies(reply)">
  166. <span class="show-reply-bar"></span>
  167. <span class="comment-reaction font-weight-bold text-muted">{{reply.thread ? 'Hide' : 'View'}} Replies ({{reply.reply_count}})</span>
  168. </div>
  169. <div v-if="reply.thread == true" class="comment-thread">
  170. <div v-for="(s, sindex) in reply.replies" class="pb-3" :key="'cr' + s.id + '_' + index">
  171. <p class="d-flex justify-content-between align-items-top read-more" style="overflow-y: hidden;">
  172. <span>
  173. <a class="text-dark font-weight-bold mr-1" :href="s.account.url" :title="s.account.username">{{s.account.username}}</a>
  174. <span class="text-break" v-html="s.content"></span>
  175. </span>
  176. <span class="pl-2" style="min-width:38px">
  177. <span v-on:click="likeReply(s, $event)"><i v-bind:class="[s.favourited ? 'fas fa-heart fa-sm text-danger':'far fa-heart fa-sm text-lighter']"></i></span>
  178. <post-menu :status="s" :profile="user" :size="'sm'" :modal="'true'" class="d-inline-block pl-2" v-on:deletePost="deleteCommentReply(s.id, sindex, index) "></post-menu>
  179. </span>
  180. </p>
  181. <p class="">
  182. <a v-once class="text-muted mr-3 text-decoration-none small" style="width: 20px;" v-text="timeAgo(s.created_at)" :href="s.url"></a>
  183. <span v-if="s.favourites_count" class="text-muted comment-reaction font-weight-bold mr-3">{{s.favourites_count == 1 ? '1 like' : s.favourites_count + ' likes'}}</span>
  184. </p>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. </div>
  192. </div>
  193. </div>
  194. <div class="card-body flex-grow-0 py-1">
  195. <div class="reactions my-1">
  196. <h3 v-bind:class="[reactions.liked ? 'fas fa-heart text-danger pr-3 m-0 cursor-pointer' : 'far fa-heart pr-3 m-0 like-btn cursor-pointer']" title="Like" v-on:click="likeStatus"></h3>
  197. <h3 v-if="!status.comments_disabled" class="far fa-comment pr-3 m-0 cursor-pointer" title="Comment" v-on:click="replyFocus(status)"></h3>
  198. <h3 v-if="status.visibility == 'public'" v-bind:class="[reactions.shared ? 'far fa-share-square pr-3 m-0 text-primary cursor-pointer' : 'far fa-share-square pr-3 m-0 share-btn cursor-pointer']" title="Share" v-on:click="shareStatus"></h3>
  199. <h3 @click="lightbox(status.media_attachments[0])" class="fas fa-expand m-0 cursor-pointer"></h3>
  200. <h3 v-if="status.visibility == 'public'" v-bind:class="[reactions.bookmarked ? 'fas fa-bookmark text-warning m-0 float-right cursor-pointer' : 'far fa-bookmark m-0 float-right cursor-pointer']" title="Bookmark" v-on:click="bookmarkStatus"></h3>
  201. </div>
  202. <div class="reaction-counts font-weight-bold mb-0">
  203. <span style="cursor:pointer;" v-on:click="likesModal">
  204. <span class="like-count">{{status.favourites_count || 0}}</span> likes
  205. </span>
  206. <span v-if="status.visibility == 'public'" class="float-right" style="cursor:pointer;" v-on:click="sharesModal">
  207. <span class="share-count pl-4">{{status.reblogs_count || 0}}</span> shares
  208. </span>
  209. </div>
  210. <div class="timestamp pt-2 d-flex align-items-bottom justify-content-between">
  211. <a v-bind:href="statusUrl" class="small text-muted">
  212. {{timestampFormat()}}
  213. </a>
  214. <span class="small text-muted text-capitalize cursor-pointer" v-on:click="visibilityModal">{{status.visibility}}</span>
  215. </div>
  216. </div>
  217. </div>
  218. <div v-if="showComments && user.length !== 0" class="card-footer bg-white px-2 py-0">
  219. <ul class="nav align-items-center emoji-reactions" style="overflow-x: scroll;flex-wrap: unset;">
  220. <li class="nav-item" v-on:click="emojiReaction" v-for="e in emoji">{{e}}</li>
  221. </ul>
  222. </div>
  223. <div v-if="showComments" class="card-footer bg-white sticky-md-bottom p-0">
  224. <div v-if="user.length == 0" class="comment-form-guest p-3">
  225. <a href="/login">Login</a> to like or comment.
  226. </div>
  227. <form v-else class="border-0 rounded-0 align-middle" method="post" action="/i/comment" :data-id="statusId" data-truncate="false">
  228. <textarea class="form-control border-0 rounded-0" name="comment" placeholder="Add a comment…" autocomplete="off" autocorrect="off" style="height:56px;line-height: 18px;max-height:80px;resize: none; padding-right:4.2rem;" v-model="replyText"></textarea>
  229. <input type="button" value="Post" class="d-inline-block btn btn-link font-weight-bold reply-btn text-decoration-none" v-on:click.prevent="postReply"/>
  230. </form>
  231. </div>
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. <div v-if="profileLayout == 'moment'" class="momentui">
  237. <div class="bg-dark mt-md-n4">
  238. <div class="container" v-on:dblclick="likeStatus">
  239. <div class="postPresenterContainer d-none d-flex justify-content-center align-items-center bg-dark">
  240. <div v-if="status.pf_type === 'photo'" class="w-100">
  241. <photo-presenter :status="status" v-on:lightbox="lightbox"></photo-presenter>
  242. </div>
  243. <div v-else-if="status.pf_type === 'video'" class="w-100">
  244. <video-presenter :status="status"></video-presenter>
  245. </div>
  246. <div v-else-if="status.pf_type === 'photo:album'" class="w-100">
  247. <photo-album-presenter :status="status" v-on:lightbox="lightbox"></photo-album-presenter>
  248. </div>
  249. <div v-else-if="status.pf_type === 'video:album'" class="w-100">
  250. <video-album-presenter :status="status"></video-album-presenter>
  251. </div>
  252. <div v-else-if="status.pf_type === 'photo:video:album'" class="w-100">
  253. <mixed-album-presenter :status="status" v-on:lightbox="lightbox"></mixed-album-presenter>
  254. </div>
  255. <div v-else class="w-100">
  256. <p class="text-center p-0 font-weight-bold text-white">Error: Problem rendering preview.</p>
  257. </div>
  258. </div>
  259. </div>
  260. </div>
  261. <div class="bg-white">
  262. <div class="container">
  263. <div class="row pb-5">
  264. <div class="col-12 col-md-8 py-4">
  265. <div class="reactions d-flex align-items-center">
  266. <div class="text-center mr-5">
  267. <div v-bind:class="[reactions.liked ? 'fas fa-heart text-danger m-0 cursor-pointer' : 'far fa-heart m-0 like-btn cursor-pointer']" title="Like" v-on:click="likeStatus" style="font-size:1.575rem">
  268. </div>
  269. <div class="like-count font-weight-bold mt-2 rounded border" style="cursor:pointer;" v-on:click="likesModal">{{status.favourites_count || 0}}</div>
  270. </div>
  271. <div class="text-center">
  272. <div v-if="status.visibility == 'public'" v-bind:class="[reactions.shared ? 'h3 far fa-share-square m-0 text-primary cursor-pointer' : 'h3 far fa-share-square m-0 share-btn cursor-pointer']" title="Share" v-on:click="shareStatus">
  273. </div>
  274. <div class="share-count font-weight-bold mt-2 rounded border" v-if="status.visibility == 'public'" style="cursor:pointer;" v-on:click="sharesModal">{{status.reblogs_count || 0}}</div>
  275. </div>
  276. </div>
  277. <!-- <div class="reaction-counts font-weight-bold mb-0">
  278. <span class="like-count">{{status.favourites_count || 0}}</span> likes
  279. <span v-if="status.visibility == 'public'" class="float-right" style="cursor:pointer;" v-on:click="sharesModal">
  280. <span class="share-count pl-4">{{status.reblogs_count || 0}}</span> shares
  281. </span>
  282. </div> -->
  283. <div class="media align-items-center mt-3">
  284. <div class="media-body">
  285. <h2 class="font-weight-bold">
  286. {{status.content.length < 100 ? status.content.slice(0,100) : 'Untitled Post'}}
  287. </h2>
  288. <p class="lead mb-0">
  289. by <a :href="statusProfileUrl">{{statusUsername}}</a>
  290. <!-- <span class="px-1 text-lighter">•</span>
  291. <a class="font-weight-bold small" href="#">Follow</a> -->
  292. </p>
  293. </div>
  294. <img :src="statusAvatar" class="rounded-circle border mr-3" alt="avatar" width="72px" height="72px">
  295. </div>
  296. <hr>
  297. <div>
  298. <p class="lead">
  299. <span v-if="status.place" class="text-truncate">
  300. <i class="fas fa-map-marker-alt text-lighter mr-3"></i> {{status.place.name}}, {{status.place.country}}
  301. </span>
  302. <span v-once class="float-right">
  303. <i class="far fa-clock text-lighter mr-3"></i> {{timeAgo(status.created_at)}} ago
  304. </span>
  305. </p>
  306. <!-- <div v-if="status.content.length > 100" class="lead" v-html="status.content"></div> -->
  307. <!-- <div class="pt-4">
  308. <p class="lead">
  309. <span class="mr-3"><i class="fas fa-camera text-lighter"></i></span>
  310. <span>Nikon D850</span>
  311. </p>
  312. <p class="lead">
  313. <span class="mr-3"><i class="fas fa-ruler-horizontal text-lighter"></i></span>
  314. <span>200-500mm</span>
  315. </p>
  316. <p class="lead">
  317. <span class="mr-3"><i class="fas fa-stream text-lighter"></i></span>
  318. <span>500mm <span class="px-1"></span> ƒ/7.1 <span class="px-1"></span> 1/1600s <span class="px-1"></span> ISO 800</span>
  319. </p>
  320. </div> -->
  321. <div v-if="status.tags" class="pt-4">
  322. <p class="lead">
  323. <a v-for="(tag, index) in status.tags" class="btn btn-outline-dark mr-1 mb-1" :href="tag.url + '?src=mp'">{{tag.name}}</a>
  324. </p>
  325. </div>
  326. </div>
  327. </div>
  328. <div class="col-12 col-md-4 pt-4 pl-md-3">
  329. <p class="lead font-weight-bold">Comments</p>
  330. <div v-if="user" class="moment-comments">
  331. <div class="form-group">
  332. <textarea class="form-control" rows="3" placeholder="Add a comment ..." v-model="replyText"></textarea>
  333. <p style="padding-top:4px;">
  334. <span class="small text-lighter font-weight-bold">
  335. {{replyText.length}}/{{config.uploader.max_caption_length}}
  336. </span>
  337. <button
  338. :class="[replyText.length > 1 ? 'btn btn-sm font-weight-bold float-right btn-outline-dark ':'btn btn-sm font-weight-bold float-right btn-outline-lighter']"
  339. :disabled="replyText.length < 2"
  340. @click="postReply"
  341. >Post</button>
  342. </p>
  343. </div>
  344. <hr>
  345. </div>
  346. <div class="comment mt-3" style="max-height: 500px; overflow-y: auto;">
  347. <div v-for="(reply, index) in results" :key="'tl' + reply.id + '_' + index" class="media mb-3">
  348. <img :src="reply.account.avatar" class="rounded-circle border mr-3" alt="avatar" width="32px" height="32px">
  349. <div class="media-body">
  350. <div class="d-flex justify-content-between">
  351. <span class="font-weight-bold">{{reply.account.username}}</span>
  352. <span class="small">
  353. <a class="text-lighter text-decoration-none" :href="reply.url">{{timeAgo(reply.created_at)}}</a>
  354. </span>
  355. </div>
  356. <p v-html="reply.content"></p>
  357. </div>
  358. </div>
  359. <!-- <div class="media mb-3">
  360. <img :src="statusAvatar" class="rounded-circle border mr-3" alt="avatar" width="32px" height="32px">
  361. <div class="media-body">
  362. <div class="d-flex justify-content-between">
  363. <span class="font-weight-bold">mona</span>
  364. <span class="text-lighter small">2h ago</span>
  365. </div>
  366. <p>Stunning my friend!</p>
  367. </div>
  368. </div>
  369. <div class="media mb-3">
  370. <img :src="statusAvatar" class="rounded-circle border mr-3" alt="avatar" width="32px" height="32px">
  371. <div class="media-body">
  372. <div class="d-flex justify-content-between">
  373. <span class="font-weight-bold">Andre</span>
  374. <span class="text-lighter small">3h ago</span>
  375. </div>
  376. <p>Wow</p>
  377. </div>
  378. </div> -->
  379. </div>
  380. </div>
  381. </div>
  382. </div>
  383. </div>
  384. </div>
  385. </div>
  386. <b-modal ref="likesModal"
  387. id="l-modal"
  388. hide-footer
  389. centered
  390. title="Likes"
  391. body-class="list-group-flush p-0">
  392. <div class="list-group">
  393. <div class="list-group-item border-0" v-for="(user, index) in likes" :key="'modal_likes_'+index">
  394. <div class="media">
  395. <a :href="user.url">
  396. <img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + '’s avatar'" width="30px">
  397. </a>
  398. <div class="media-body">
  399. <p class="mb-0" style="font-size: 14px">
  400. <a :href="user.url" class="font-weight-bold text-dark">
  401. {{user.username}}
  402. </a>
  403. </p>
  404. <p class="text-muted mb-0" style="font-size: 14px">
  405. {{user.display_name}}
  406. </a>
  407. </p>
  408. </div>
  409. </div>
  410. </div>
  411. <infinite-loading @infinite="infiniteLikesHandler" spinner="spiral">
  412. <div slot="no-more"></div>
  413. <div slot="no-results"></div>
  414. </infinite-loading>
  415. </div>
  416. </b-modal>
  417. <b-modal ref="sharesModal"
  418. id="s-modal"
  419. hide-footer
  420. centered
  421. title="Shares"
  422. body-class="list-group-flush p-0">
  423. <div class="list-group">
  424. <div class="list-group-item border-0" v-for="(user, index) in shares" :key="'modal_shares_'+index">
  425. <div class="media">
  426. <a :href="user.url">
  427. <img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + '’s avatar'" width="30px">
  428. </a>
  429. <div class="media-body">
  430. <div class="d-inline-block">
  431. <p class="mb-0" style="font-size: 14px">
  432. <a :href="user.url" class="font-weight-bold text-dark">
  433. {{user.username}}
  434. </a>
  435. </p>
  436. <p class="text-muted mb-0" style="font-size: 14px">
  437. {{user.display_name}}
  438. </a>
  439. </p>
  440. </div>
  441. <p class="float-right"><!-- <a class="btn btn-primary font-weight-bold py-1" href="#">Follow</a> --></p>
  442. </div>
  443. </div>
  444. </div>
  445. <infinite-loading @infinite="infiniteSharesHandler" spinner="spiral">
  446. <div slot="no-more"></div>
  447. <div slot="no-results"></div>
  448. </infinite-loading>
  449. </div>
  450. </b-modal>
  451. <b-modal
  452. id="lightbox"
  453. ref="lightboxModal"
  454. :hide-header="true"
  455. :hide-footer="true"
  456. centered
  457. size="lg"
  458. body-class="p-0"
  459. >
  460. <div v-if="lightboxMedia" >
  461. <img :src="lightboxMedia.url" :class="lightboxMedia.filter_class + ' img-fluid'" style="min-height: 100%; min-width: 100%">
  462. </div>
  463. </b-modal>
  464. </div>
  465. </template>
  466. <style type="text/css" scoped>
  467. .status-comments,
  468. .reactions {
  469. background: #fff;
  470. }
  471. .postPresenterContainer {
  472. background: #fff;
  473. }
  474. @media(min-width: 720px) {
  475. .postPresenterContainer {
  476. min-height: 600px;
  477. }
  478. }
  479. ::-webkit-scrollbar {
  480. width: 0px;
  481. background: transparent;
  482. }
  483. .reply-btn {
  484. position: absolute;
  485. bottom: 12px;
  486. right: 20px;
  487. width: 60px;
  488. text-align: center;
  489. border-radius: 0 3px 3px 0;
  490. }
  491. .text-lighter {
  492. color:#B8C2CC !important;
  493. }
  494. .text-break {
  495. overflow-wrap: break-word;
  496. }
  497. .comments p {
  498. margin-bottom: 0;
  499. }
  500. .comment-reaction {
  501. font-size: 80%;
  502. }
  503. .show-reply-bar {
  504. display: inline-block;
  505. border-bottom: 1px solid #999;
  506. height: 0;
  507. margin-right: 16px;
  508. vertical-align: middle;
  509. width: 24px;
  510. }
  511. .comment-thread {
  512. margin: 4px 0 0 40px;
  513. width: calc(100% - 40px);
  514. }
  515. .emoji-reactions .nav-item {
  516. font-size: 1.2rem;
  517. padding: 9px;
  518. cursor: pointer;
  519. }
  520. .emoji-reactions::-webkit-scrollbar {
  521. width: 0px;
  522. height: 0px;
  523. background: transparent;
  524. }
  525. </style>
  526. <style type="text/css" scoped>
  527. .momentui .bg-dark {
  528. background: #000 !important;
  529. }
  530. .momentui .carousel.slide,
  531. .momentui .carousel-item {
  532. background: #000 !important;
  533. }
  534. </style>
  535. <script>
  536. pixelfed.postComponent = {};
  537. export default {
  538. props: [
  539. 'status-id',
  540. 'status-username',
  541. 'status-template',
  542. 'status-url',
  543. 'status-profile-url',
  544. 'status-avatar',
  545. 'status-profile-id',
  546. 'profile-layout'
  547. ],
  548. data() {
  549. return {
  550. config: window.App.config,
  551. status: false,
  552. media: {},
  553. user: false,
  554. reactions: {
  555. liked: false,
  556. shared: false
  557. },
  558. likes: [],
  559. likesPage: 1,
  560. shares: [],
  561. sharesPage: 1,
  562. lightboxMedia: false,
  563. replyText: '',
  564. relationship: {},
  565. results: [],
  566. pagination: {},
  567. min_id: 0,
  568. max_id: 0,
  569. reply_to_profile_id: 0,
  570. thread: false,
  571. showComments: false,
  572. warning: false,
  573. loaded: false,
  574. loading: null,
  575. replyingToId: this.statusId,
  576. replyToIndex: 0,
  577. emoji: window.App.util.emoji,
  578. showReadMore: true,
  579. showCaption: true,
  580. }
  581. },
  582. beforeMount() {
  583. let u = new URLSearchParams(window.location.search);
  584. if(u.has('ui') && u.get('ui') == 'moment' && this.profileLayout != 'moment') {
  585. this.profileLayout = 'moment';
  586. }
  587. if(u.has('ui') && u.get('ui') == 'metro' && this.profileLayout != 'metro') {
  588. this.profileLayout = 'metro';
  589. }
  590. },
  591. mounted() {
  592. this.fetchRelationships();
  593. if(localStorage.getItem('pf_metro_ui.exp.rm') == 'false') {
  594. this.showReadMore = false;
  595. } else {
  596. this.showReadMore = true;
  597. }
  598. },
  599. updated() {
  600. $('.carousel').carousel();
  601. if(this.showReadMore == true) {
  602. window.pixelfed.readmore();
  603. }
  604. },
  605. methods: {
  606. showMuteBlock() {
  607. let sid = this.status.account.id;
  608. let uid = this.user.id;
  609. if(sid == uid) {
  610. $('.post-actions .menu-author').removeClass('d-none');
  611. } else {
  612. $('.post-actions .menu-user').removeClass('d-none');
  613. }
  614. },
  615. reportUrl() {
  616. return '/i/report?type=post&id=' + this.status.id;
  617. },
  618. editUrl() {
  619. return this.status.url + '/edit';
  620. },
  621. timestampFormat() {
  622. let ts = new Date(this.status.created_at);
  623. return ts.toDateString() + ' ' + ts.toLocaleTimeString();
  624. },
  625. fetchData() {
  626. axios.get('/api/v2/profile/'+this.statusUsername+'/status/'+this.statusId)
  627. .then(response => {
  628. let self = this;
  629. self.status = response.data.status;
  630. self.user = response.data.user;
  631. self.media = self.status.media_attachments;
  632. self.reactions = response.data.reactions;
  633. self.likes = response.data.likes;
  634. self.shares = response.data.shares;
  635. self.likesPage = 2;
  636. self.sharesPage = 2;
  637. this.showMuteBlock();
  638. self.showCaption = !response.data.status.sensitive;
  639. if(self.status.comments_disabled == false) {
  640. self.showComments = true;
  641. this.fetchComments();
  642. }
  643. this.loaded = true;
  644. $('head title').text(this.status.account.username + ' posted a photo: ' + this.status.favourites_count + ' likes');
  645. }).catch(error => {
  646. if(!error.response) {
  647. } else {
  648. switch(error.response.status) {
  649. case 401:
  650. break;
  651. default:
  652. break;
  653. }
  654. }
  655. });
  656. },
  657. likesModal() {
  658. if(this.status.favourites_count == 0 || $('body').hasClass('loggedIn') == false) {
  659. return;
  660. }
  661. this.$refs.likesModal.show();
  662. },
  663. sharesModal() {
  664. if(this.status.reblogs_count == 0 || $('body').hasClass('loggedIn') == false) {
  665. return;
  666. }
  667. this.$refs.sharesModal.show();
  668. },
  669. infiniteLikesHandler($state) {
  670. let api = '/api/v2/likes/profile/'+this.statusUsername+'/status/'+this.statusId;
  671. axios.get(api, {
  672. params: {
  673. page: this.likesPage,
  674. },
  675. }).then(({ data }) => {
  676. if (data.data.length > 0) {
  677. this.likes.push(...data.data);
  678. this.likesPage++;
  679. $state.loaded();
  680. } else {
  681. $state.complete();
  682. }
  683. });
  684. },
  685. infiniteSharesHandler($state) {
  686. axios.get('/api/v2/shares/profile/'+this.statusUsername+'/status/'+this.statusId, {
  687. params: {
  688. page: this.sharesPage,
  689. },
  690. }).then(({ data }) => {
  691. if (data.data.length > 0) {
  692. this.shares.push(...data.data);
  693. this.sharesPage++;
  694. $state.loaded();
  695. } else {
  696. $state.complete();
  697. }
  698. });
  699. },
  700. likeStatus(event) {
  701. if($('body').hasClass('loggedIn') == false) {
  702. window.location.href = '/login?next=' + encodeURIComponent(window.location.pathname);
  703. return;
  704. }
  705. axios.post('/i/like', {
  706. item: this.status.id
  707. }).then(res => {
  708. this.status.favourites_count = res.data.count;
  709. if(this.reactions.liked == true) {
  710. this.reactions.liked = false;
  711. let user = this.user.id;
  712. this.likes = this.likes.filter(function(like) {
  713. return like.id !== user;
  714. });
  715. } else {
  716. this.reactions.liked = true;
  717. let user = this.user;
  718. this.likes.push(user);
  719. }
  720. }).catch(err => {
  721. console.error(err);
  722. swal('Error', 'Something went wrong, please try again later.', 'error');
  723. });
  724. },
  725. shareStatus() {
  726. if($('body').hasClass('loggedIn') == false) {
  727. window.location.href = '/login?next=' + encodeURIComponent(window.location.pathname);
  728. return;
  729. }
  730. axios.post('/i/share', {
  731. item: this.status.id
  732. }).then(res => {
  733. this.status.reblogs_count = res.data.count;
  734. if(this.reactions.shared == true) {
  735. this.reactions.shared = false;
  736. let user = this.user.id;
  737. this.shares = this.shares.filter(function(reaction) {
  738. return reaction.id !== user;
  739. });
  740. } else {
  741. this.reactions.shared = true;
  742. let user = this.user;
  743. this.shares.push(user);
  744. }
  745. }).catch(err => {
  746. console.error(err);
  747. swal('Error', 'Something went wrong, please try again later.', 'error');
  748. });
  749. },
  750. bookmarkStatus() {
  751. if($('body').hasClass('loggedIn') == false) {
  752. window.location.href = '/login?next=' + encodeURIComponent(window.location.pathname);
  753. return;
  754. }
  755. axios.post('/i/bookmark', {
  756. item: this.status.id
  757. }).then(res => {
  758. if(this.reactions.bookmarked == true) {
  759. this.reactions.bookmarked = false;
  760. } else {
  761. this.reactions.bookmarked = true;
  762. }
  763. }).catch(err => {
  764. swal('Error', 'Something went wrong, please try again later.', 'error');
  765. });
  766. },
  767. muteProfile() {
  768. if($('body').hasClass('loggedIn') == false) {
  769. return;
  770. }
  771. axios.post('/i/mute', {
  772. type: 'user',
  773. item: this.status.account.id
  774. }).then(res => {
  775. swal('Success', 'You have successfully muted ' + this.status.account.acct, 'success');
  776. }).catch(err => {
  777. swal('Error', 'Something went wrong. Please try again later.', 'error');
  778. });
  779. },
  780. blockProfile() {
  781. if($('body').hasClass('loggedIn') == false) {
  782. return;
  783. }
  784. axios.post('/i/block', {
  785. type: 'user',
  786. item: this.status.account.id
  787. }).then(res => {
  788. swal('Success', 'You have successfully blocked ' + this.status.account.acct, 'success');
  789. }).catch(err => {
  790. swal('Error', 'Something went wrong. Please try again later.', 'error');
  791. });
  792. },
  793. deletePost(status) {
  794. if(!this.ownerOrAdmin()) {
  795. return;
  796. }
  797. var result = confirm('Are you sure you want to delete this post?');
  798. if (result) {
  799. if($('body').hasClass('loggedIn') == false) {
  800. return;
  801. }
  802. axios.post('/i/delete', {
  803. type: 'status',
  804. item: this.status.id
  805. }).then(res => {
  806. swal('Success', 'You have successfully deleted this post', 'success');
  807. setTimeout(function() {
  808. window.location.href = '/';
  809. }, 3000);
  810. }).catch(err => {
  811. swal('Error', 'Something went wrong. Please try again later.', 'error');
  812. });
  813. }
  814. },
  815. owner() {
  816. return this.user.id === this.status.account.id;
  817. },
  818. admin() {
  819. return this.user.is_admin == true;
  820. },
  821. ownerOrAdmin() {
  822. return this.owner() || this.admin();
  823. },
  824. lightbox(src) {
  825. this.lightboxMedia = src;
  826. this.$refs.lightboxModal.show();
  827. },
  828. postReply() {
  829. let self = this;
  830. if(this.replyText.length == 0 ||
  831. this.replyText.trim() == '@'+this.status.account.acct) {
  832. self.replyText = null;
  833. $('textarea[name="comment"]').blur();
  834. return;
  835. }
  836. let data = {
  837. item: this.replyingToId,
  838. comment: this.replyText
  839. }
  840. this.replyText = '';
  841. axios.post('/i/comment', data)
  842. .then(function(res) {
  843. let entity = res.data.entity;
  844. if(entity.in_reply_to_id == self.status.id) {
  845. if(self.profileLayout == 'metro') {
  846. self.results.push(entity);
  847. } else {
  848. self.results.unshift(entity);
  849. }
  850. let elem = $('.status-comments')[0];
  851. elem.scrollTop = elem.clientHeight;
  852. } else {
  853. if(self.replyToIndex >= 0) {
  854. let el = self.results[self.replyToIndex];
  855. el.replies.push(entity);
  856. el.reply_count = el.reply_count + 1;
  857. }
  858. }
  859. });
  860. },
  861. deleteComment(id, i) {
  862. axios.post('/i/delete', {
  863. type: 'comment',
  864. item: id
  865. }).then(res => {
  866. this.results.splice(i, 1);
  867. }).catch(err => {
  868. swal('Something went wrong!', 'Please try again later', 'error');
  869. });
  870. },
  871. deleteCommentReply(id, i, pi) {
  872. axios.post('/i/delete', {
  873. type: 'comment',
  874. item: id
  875. }).then(res => {
  876. this.results[pi].replies.splice(i, 1);
  877. --this.results[pi].reply_count;
  878. }).catch(err => {
  879. swal('Something went wrong!', 'Please try again later', 'error');
  880. });
  881. },
  882. l(e) {
  883. let len = e.length;
  884. if(len < 10) { return e; }
  885. return e.substr(0, 10)+'...';
  886. },
  887. replyFocus(e, index) {
  888. this.replyToIndex = index;
  889. this.replyingToId = e.id;
  890. this.reply_to_profile_id = e.account.id;
  891. this.replyText = '@' + e.account.username + ' ';
  892. $('textarea[name="comment"]').focus();
  893. },
  894. fetchComments() {
  895. let url = '/api/v2/comments/'+this.statusUsername+'/status/'+this.statusId;
  896. axios.get(url)
  897. .then(response => {
  898. let self = this;
  899. this.results = this.profileLayout == 'metro' ?
  900. _.reverse(response.data.data) :
  901. response.data.data;
  902. this.pagination = response.data.meta.pagination;
  903. if(this.results.length > 0) {
  904. $('.load-more-link').removeClass('d-none');
  905. }
  906. $('.postCommentsLoader').addClass('d-none');
  907. $('.postCommentsContainer').removeClass('d-none');
  908. }).catch(error => {
  909. if(!error.response) {
  910. $('.postCommentsLoader .lds-ring')
  911. .attr('style','width:100%')
  912. .addClass('pt-4 font-weight-bold text-muted')
  913. .text('An error occurred, cannot fetch comments. Please try again later.');
  914. } else {
  915. switch(error.response.status) {
  916. case 401:
  917. $('.postCommentsLoader .lds-ring')
  918. .attr('style','width:100%')
  919. .addClass('pt-4 font-weight-bold text-muted')
  920. .text('Please login to view.');
  921. break;
  922. default:
  923. $('.postCommentsLoader .lds-ring')
  924. .attr('style','width:100%')
  925. .addClass('pt-4 font-weight-bold text-muted')
  926. .text('An error occurred, cannot fetch comments. Please try again later.');
  927. break;
  928. }
  929. }
  930. });
  931. },
  932. loadMore(e) {
  933. e.preventDefault();
  934. if(this.pagination.total_pages == 1 || this.pagination.current_page == this.pagination.total_pages) {
  935. $('.load-more-link').addClass('d-none');
  936. return;
  937. }
  938. $('.postCommentsLoader').removeClass('d-none');
  939. let next = this.pagination.links.next;
  940. axios.get(next)
  941. .then(response => {
  942. let self = this;
  943. let res = response.data.data;
  944. $('.postCommentsLoader').addClass('d-none');
  945. for(let i=0; i < res.length; i++) {
  946. this.results.unshift(res[i]);
  947. }
  948. this.pagination = response.data.meta.pagination;
  949. });
  950. },
  951. likeReply(status, $event) {
  952. if($('body').hasClass('loggedIn') == false) {
  953. return;
  954. }
  955. axios.post('/i/like', {
  956. item: status.id
  957. }).then(res => {
  958. status.favourites_count = res.data.count;
  959. if(status.favourited == true) {
  960. status.favourited = false;
  961. } else {
  962. status.favourited = true;
  963. }
  964. }).catch(err => {
  965. swal('Error', 'Something went wrong, please try again later.', 'error');
  966. });
  967. },
  968. truncate(str,lim) {
  969. return _.truncate(str,{
  970. length: lim
  971. });
  972. },
  973. timeAgo(ts) {
  974. let date = Date.parse(ts);
  975. let seconds = Math.floor((new Date() - date) / 1000);
  976. let interval = Math.floor(seconds / 31536000);
  977. if (interval >= 1) {
  978. return interval + "y";
  979. }
  980. interval = Math.floor(seconds / 604800);
  981. if (interval >= 1) {
  982. return interval + "w";
  983. }
  984. interval = Math.floor(seconds / 86400);
  985. if (interval >= 1) {
  986. return interval + "d";
  987. }
  988. interval = Math.floor(seconds / 3600);
  989. if (interval >= 1) {
  990. return interval + "h";
  991. }
  992. interval = Math.floor(seconds / 60);
  993. if (interval >= 1) {
  994. return interval + "m";
  995. }
  996. return Math.floor(seconds) + "s";
  997. },
  998. emojiReaction() {
  999. let em = event.target.innerText;
  1000. if(this.replyText.length == 0) {
  1001. this.reply_to_profile_id = this.status.account.id;
  1002. this.replyText = em + ' ';
  1003. $('textarea[name="comment"]').focus();
  1004. } else {
  1005. this.reply_to_profile_id = this.status.account.id;
  1006. this.replyText += em + ' ';
  1007. $('textarea[name="comment"]').focus();
  1008. }
  1009. },
  1010. toggleCommentVisibility() {
  1011. if(this.ownerOrAdmin() == false) {
  1012. return;
  1013. }
  1014. let state = this.status.comments_disabled;
  1015. let self = this;
  1016. if(state == true) {
  1017. // re-enable comments
  1018. axios.post('/i/visibility', {
  1019. item: self.status.id,
  1020. disableComments: false
  1021. }).then(function(res) {
  1022. window.location.href = self.status.url;
  1023. }).catch(function(err) {
  1024. return;
  1025. });
  1026. } else {
  1027. // disable comments
  1028. axios.post('/i/visibility', {
  1029. item: self.status.id,
  1030. disableComments: true
  1031. }).then(function(res) {
  1032. self.status.comments_disabled = false;
  1033. self.showComments = false;
  1034. }).catch(function(err) {
  1035. return;
  1036. });
  1037. }
  1038. },
  1039. fetchRelationships() {
  1040. if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == false) {
  1041. this.fetchData();
  1042. return;
  1043. } else {
  1044. axios.get('/api/pixelfed/v1/accounts/relationships', {
  1045. params: {
  1046. 'id[]': this.statusProfileId
  1047. }
  1048. }).then(res => {
  1049. if(res.data[0] == null) {
  1050. this.fetchData();
  1051. return;
  1052. }
  1053. this.relationship = res.data[0];
  1054. if(res.data[0].blocking == true) {
  1055. this.loaded = true;
  1056. this.warning = true;
  1057. return;
  1058. } else {
  1059. this.fetchData();
  1060. return;
  1061. }
  1062. });
  1063. }
  1064. },
  1065. visibilityModal() {
  1066. switch(this.status.visibility) {
  1067. case 'public':
  1068. swal('Public Post', 'This post is visible to everyone.', 'info');
  1069. break;
  1070. case 'unlisted':
  1071. swal('Unlisted Post', 'This post is visible on profiles and with a direct links. It is not displayed on timelines.', 'info');
  1072. break;
  1073. case 'private':
  1074. swal('Private Post', 'This post is only visible to followers.', 'info');
  1075. break;
  1076. }
  1077. },
  1078. toggleReplies(reply) {
  1079. if(reply.thread) {
  1080. reply.thread = false;
  1081. } else {
  1082. if(reply.replies.length > 0) {
  1083. reply.thread = true;
  1084. return;
  1085. }
  1086. let url = '/api/v2/comments/'+reply.account.username+'/status/'+reply.id;
  1087. axios.get(url)
  1088. .then(response => {
  1089. reply.replies = _.reverse(response.data.data);
  1090. reply.thread = true;
  1091. });
  1092. }
  1093. },
  1094. redirect(url) {
  1095. window.location.href = url;
  1096. }
  1097. },
  1098. }
  1099. </script>