12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307 |
- <template>
- <div class="container" style="">
- <div class="row">
- <div :class="[modes.distractionFree ? 'col-md-8 col-lg-8 offset-md-2 px-0 my-sm-3 timeline order-2 order-md-1':'col-md-8 col-lg-8 px-0 my-sm-3 timeline order-2 order-md-1']">
- <div style="padding-top:10px;">
- <div v-if="loading" class="text-center">
- <div class="spinner-border" role="status">
- <span class="sr-only">Loading...</span>
- </div>
- </div>
- <div :data-status-id="status.id" v-for="(status, index) in feed" :key="`${index}-${status.id}`">
- <div v-if="index == 2 && showSuggestions == true && suggestions.length" class="card mb-sm-4 status-card card-md-rounded-0 shadow-none border">
- <div class="card-header d-flex align-items-center justify-content-between bg-white border-0 pb-0">
- <h6 class="text-muted font-weight-bold mb-0">Suggestions For You</h6>
- <span class="cursor-pointer text-muted" v-on:click="hideSuggestions"><i class="fas fa-times"></i></span>
- </div>
- <div class="card-body row mx-0">
- <div class="col-12 col-md-4 mb-3" v-for="(rec, index) in suggestions">
- <div class="card">
- <div class="card-body text-center pt-3">
- <p class="mb-0">
- <a :href="'/'+rec.username">
- <img :src="rec.avatar" class="img-fluid rounded-circle cursor-pointer" width="45px" height="45px">
- </a>
- </p>
- <div class="py-3">
- <p class="font-weight-bold text-dark cursor-pointer mb-0">
- <a :href="'/'+rec.username" class="text-decoration-none text-dark">
- {{rec.username}}
- </a>
- </p>
- <p class="small text-muted mb-0">{{rec.message}}</p>
- </div>
- <p class="mb-0">
- <a class="btn btn-primary btn-block font-weight-bold py-0" href="#" @click.prevent="expRecFollow(rec.id, index)">Follow</a>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div v-if="index == 4 && showHashtagPosts && hashtagPosts.length" class="card mb-sm-4 status-card card-md-rounded-0 shadow-none border">
- <div class="card-header d-flex align-items-center justify-content-between bg-white border-0 pb-0">
- <span></span>
- <h6 class="text-muted font-weight-bold mb-0"><a :href="'/discover/tags/'+hashtagPostsName+'?src=tr'">#{{hashtagPostsName}}</a></h6>
- <span class="cursor-pointer text-muted" v-on:click="showHashtagPosts = false"><i class="fas fa-times"></i></span>
- </div>
- <div class="card-body row mx-0">
- <div v-for="(tag, index) in hashtagPosts" class="col-4 p-0 p-sm-2 p-md-3 hashtag-post-square">
- <a class="card info-overlay card-md-border-0" :href="tag.status.url">
- <div :class="[tag.status.filter ? 'square ' + tag.status.filter : 'square']">
- <div class="square-content" :style="'background-image: url('+tag.status.thumb+')'"></div>
- <div class="info-overlay-text">
- <h5 class="text-white m-auto font-weight-bold">
- <span class="pr-4">
- <span class="far fa-heart fa-lg pr-1"></span> {{tag.status.like_count}}
- </span>
- <span>
- <span class="fas fa-retweet fa-lg pr-1"></span> {{tag.status.share_count}}
- </span>
- </h5>
- </div>
- </div>
- </a>
- </div>
- </div>
- </div>
- <div class="card mb-sm-4 status-card card-md-rounded-0 shadow-none border">
- <div v-if="!modes.distractionFree" class="card-header d-inline-flex align-items-center bg-white">
- <img v-bind:src="status.account.avatar" width="32px" height="32px" style="border-radius: 32px;">
- <a class="username font-weight-bold pl-2 text-dark" v-bind:href="status.account.url">
- {{status.account.username}}
- </a>
- <div class="text-right" style="flex-grow:1;">
- <button class="btn btn-link text-dark py-0" type="button" @click="ctxMenu(status)">
- <span class="fas fa-ellipsis-h text-dark"></span>
- </button>
- <!-- <div class="dropdown-menu dropdown-menu-right">
- <a class="dropdown-item font-weight-bold" :href="status.url">Go to post</a>
- <!-- <a class="dropdown-item font-weight-bold" href="#">Share</a>
- <a class="dropdown-item font-weight-bold" href="#">Embed</a> ->
- <span v-if="statusOwner(status) == false">
- <a class="dropdown-item font-weight-bold" :href="reportUrl(status)">Report</a>
- <a class="dropdown-item font-weight-bold" v-on:click="muteProfile(status)">Mute Profile</a>
- <a class="dropdown-item font-weight-bold" v-on:click="blockProfile(status)">Block Profile</a>
- </span>
- <span v-if="statusOwner(status) == true">
- <a class="dropdown-item font-weight-bold text-danger" v-on:click="deletePost(status)">Delete</a>
- </span>
- <span v-if="profile.is_admin == true && modes.mod == true">
- <div class="dropdown-divider"></div>
- <a v-if="!statusOwner(status)" class="dropdown-item font-weight-bold text-danger" v-on:click="deletePost(status)">Delete</a>
- <div class="dropdown-divider"></div>
- <h6 class="dropdown-header">Mod Tools</h6>
- <a class="dropdown-item font-weight-bold" v-on:click="moderatePost(status, 'autocw')">
- <p class="mb-0" data-toggle="tooltip" data-placement="bottom" title="Adds a CW to every post made by this account.">Enforce CW</p>
- </a>
- <a class="dropdown-item font-weight-bold" v-on:click="moderatePost(status, 'noautolink')">
- <p class="mb-0" title="Do not transform mentions, hashtags or urls into HTML.">No Autolinking</p>
- </a>
- <a class="dropdown-item font-weight-bold" v-on:click="moderatePost(status, 'unlisted')">
- <p class="mb-0" title="Removes account from public/network timelines.">Unlisted Posts</p>
- </a>
- <a class="dropdown-item font-weight-bold" v-on:click="moderatePost(status, 'disable')">
- <p class="mb-0" title="Temporarily disable account until next time user log in.">Disable Account</p>
- </a>
- <a class="dropdown-item font-weight-bold" v-on:click="moderatePost(status, 'suspend')">
- <p class="mb-0" title="This prevents any new interactions, without deleting existing data.">Suspend Account</p>
- </a>
- </span>
- </div> -->
- </div>
- </div>
- <div class="postPresenterContainer" v-on:dblclick="likeStatus(status)">
- <div v-if="status.pf_type === 'photo'" class="w-100">
- <photo-presenter :status="status" v-on:lightbox="lightbox"></photo-presenter>
- </div>
- <div v-else-if="status.pf_type === 'video'" class="w-100">
- <video-presenter :status="status"></video-presenter>
- </div>
- <div v-else-if="status.pf_type === 'photo:album'" class="w-100">
- <photo-album-presenter :status="status" v-on:lightbox="lightbox"></photo-album-presenter>
- </div>
- <div v-else-if="status.pf_type === 'video:album'" class="w-100">
- <video-album-presenter :status="status"></video-album-presenter>
- </div>
- <div v-else-if="status.pf_type === 'photo:video:album'" class="w-100">
- <mixed-album-presenter :status="status" v-on:lightbox="lightbox"></mixed-album-presenter>
- </div>
- <div v-else class="w-100">
- <p class="text-center p-0 font-weight-bold text-white">Error: Problem rendering preview.</p>
- </div>
- </div>
- <div class="card-body">
- <div v-if="!modes.distractionFree" class="reactions my-1">
- <h3 v-bind:class="[status.favourited ? '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(status, $event)"></h3>
- <h3 v-if="!status.comments_disabled" class="far fa-comment pr-3 m-0 cursor-pointer" title="Comment" v-on:click="commentFocus(status, $event)"></h3>
- <h3 v-if="status.visibility == 'public'" v-bind:class="[status.reblogged ? '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(status, $event)"></h3>
- </div>
- <div class="likes font-weight-bold" v-if="expLc(status) == true && !modes.distractionFree">
- <span class="like-count">{{status.favourites_count}}</span> {{status.favourites_count == 1 ? 'like' : 'likes'}}
- </div>
- <div class="caption">
- <p class="mb-2 read-more" style="overflow: hidden;">
- <span class="username font-weight-bold">
- <bdi><a class="text-dark" :href="status.account.url">{{status.account.username}}</a></bdi>
- </span>
- <span v-html="status.content"></span>
- </p>
- </div>
- <div class="comments" v-if="status.id == replyId && !status.comments_disabled">
- <p class="mb-0 d-flex justify-content-between align-items-top read-more" style="overflow-y: hidden;" v-for="(reply, index) in replies">
- <span>
- <a class="text-dark font-weight-bold mr-1" :href="reply.account.url">{{reply.account.username}}</a>
- <span v-html="reply.content"></span>
- </span>
- <span class="mb-0" style="min-width:38px">
- <span v-on:click="likeStatus(reply, $event)"><i v-bind:class="[reply.favourited ? 'fas fa-heart fa-sm text-danger':'far fa-heart fa-sm text-lighter']"></i></span>
- <post-menu :status="reply" :profile="profile" size="sm" :modal="'true'" :feed="feed" class="d-inline-flex pl-2"></post-menu>
- </span>
- </p>
- </div>
- <div class="timestamp mt-2">
- <p class="small text-uppercase mb-0">
- <a :href="status.url" class="text-muted">
- <timeago :datetime="status.created_at" :auto-update="60" :converter-options="{includeSeconds:true}" :title="timestampFormat(status.created_at)" v-b-tooltip.hover.bottom></timeago>
- </a>
- <a v-if="modes.distractionFree" class="float-right" :href="status.url">
- <i class="fas fa-ellipsis-h fa-lg text-muted"></i>
- </a>
- </p>
- </div>
- </div>
- <div v-if="status.id == replyId && !status.comments_disabled" class="card-footer bg-white px-2 py-0">
- <ul class="nav align-items-center emoji-reactions" style="overflow-x: scroll;flex-wrap: unset;">
- <li class="nav-item" v-on:click="emojiReaction(status)">๐</li>
- <li class="nav-item" v-on:click="emojiReaction(status)">๐ฏ</li>
- <li class="nav-item" v-on:click="emojiReaction(status)">โค๏ธ</li>
- <li class="nav-item" v-on:click="emojiReaction(status)">๐</li>
- <li class="nav-item" v-on:click="emojiReaction(status)">๐</li>
- <li class="nav-item" v-on:click="emojiReaction(status)">๐</li>
- <li class="nav-item" v-on:click="emojiReaction(status)">๐</li>
- <li class="nav-item" v-on:click="emojiReaction(status)">๐ฏ</li>
- <li class="nav-item" v-on:click="emojiReaction(status)">๐ข</li>
- <li class="nav-item" v-on:click="emojiReaction(status)">๐
</li>
- <li class="nav-item" v-on:click="emojiReaction(status)">๐</li>
- <li class="nav-item" v-on:click="emojiReaction(status)">๐</li>
- <li class="nav-item" v-on:click="emojiReaction(status)">๐</li>
- <li class="nav-item" v-on:click="emojiReaction(status)" v-for="e in emoji">{{e}}</li>
- </ul>
- </div>
- <div v-if="status.id == replyId && !status.comments_disabled" class="card-footer bg-white sticky-md-bottom p-0">
- <form class="border-0 rounded-0 align-middle" method="post" action="/i/comment" :data-id="status.id" data-truncate="false">
- <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>
- <input type="button" value="Post" class="d-inline-block btn btn-link font-weight-bold reply-btn text-decoration-none" v-on:click.prevent="commentSubmit(status, $event)"/>
- </form>
- </div>
- </div>
- </div>
- <div v-if="!loading && feed.length > 0">
- <div class="card">
- <div class="card-body">
- <infinite-loading @infinite="infiniteTimeline" :distance="800">
- <div slot="no-more" class="font-weight-bold">No more posts to load</div>
- <div slot="no-results" class="font-weight-bold">No posts found</div>
- </infinite-loading>
- </div>
- </div>
- </div>
- <div v-if="!loading && scope == 'home' && feed.length == 0">
- <div class="card">
- <div class="card-body text-center">
- <p class="h2 font-weight-lighter p-5">Hello, {{profile.acct}}</p>
- <p class="text-lighter"><i class="fas fa-camera-retro fa-5x"></i></p>
- <p class="h3 font-weight-lighter p-5">Start following people to build your timeline.</p>
- <p><a href="/discover" class="btn btn-primary font-weight-bold py-0">Discover new people and posts</a></p>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div v-if="!modes.distractionFree" class="col-md-4 col-lg-4 my-3 order-1 order-md-2 d-none d-md-block">
- <div class="position-sticky" style="top:68px;">
- <div class="mb-4">
- <div class="">
- <div class="">
- <div class="media d-flex align-items-center">
- <a :href="profile.url">
- <img class="mr-3 rounded-circle box-shadow" :src="profile.avatar || '/storage/avatars/default.png'" alt="avatar" width="64px" height="64px">
- </a>
- <div class="media-body d-flex justify-content-between word-break" >
- <div>
- <p class="mb-0 px-0 font-weight-bold"><a :href="profile.url" class="text-dark">{{profile.username || 'loading...'}}</a></p>
- <p class="my-0 text-muted pb-0">{{profile.display_name || 'loading...'}}</p>
- </div>
- <div class="ml-2">
- <a class="text-muted" href="/settings/home"><i class="fas fa-cog fa-lg"></i></a>
- </div>
- </div>
- </div>
- </div>
- <!-- <div class="card-footer bg-white py-1 d-none">
- <div class="d-flex justify-content-between text-center">
- <span class="pl-3 cursor-pointer" v-on:click="redirect(profile.url)">
- <p class="mb-0 font-weight-bold">{{profile.statuses_count}}</p>
- <p class="mb-0 small text-muted">Posts</p>
- </span>
- <span class="cursor-pointer" v-on:click="followersModal()">
- <p class="mb-0 font-weight-bold">{{profile.followers_count}}</p>
- <p class="mb-0 small text-muted">Followers</p>
- </span>
- <span class="pr-3 cursor-pointer" v-on:click="followingModal()">
- <p class="mb-0 font-weight-bold">{{profile.following_count}}</p>
- <p class="mb-0 small text-muted">Following</p>
- </span>
- </div>
- </div> -->
- </div>
- </div>
- <div v-show="modes.notify == true" class="mb-4">
- <notification-card></notification-card>
- </div>
- <div v-show="showSuggestions == true && suggestions.length && config.ab && config.ab.rec == true" class="mb-4">
- <div class="card">
- <div class="card-header bg-white d-flex align-items-center justify-content-between">
- <a class="small text-muted cursor-pointer" href="#" @click.prevent="refreshSuggestions" ref="suggestionRefresh"><i class="fas fa-sync-alt"></i></a>
- <div class="small text-dark text-uppercase font-weight-bold">Suggestions</div>
- <div class="small text-muted cursor-pointer" v-on:click="hideSuggestions"><i class="fas fa-times"></i></div>
- </div>
- <div class="card-body pt-0">
- <div v-for="(rec, index) in suggestions" class="media align-items-center mt-3">
- <a :href="'/'+rec.username">
- <img :src="rec.avatar" width="32px" height="32px" class="rounded-circle mr-3">
- </a>
- <div class="media-body">
- <p class="mb-0 font-weight-bold small">
- <a :href="'/'+rec.username" class="text-decoration-none text-dark">
- {{rec.username}}
- </a>
- </p>
- <p class="mb-0 small text-muted">{{rec.message}}</p>
- </div>
- <a class="font-weight-bold small" href="#" @click.prevent="expRecFollow(rec.id, index)">Follow</a>
- </div>
- </div>
- </div>
- </div>
- <footer>
- <div class="container pb-5">
- <p class="mb-0 text-uppercase font-weight-bold text-muted small">
- <a href="/site/about" class="text-dark pr-2">About Us</a>
- <a href="/site/help" class="text-dark pr-2">Help</a>
- <a href="/site/open-source" class="text-dark pr-2">Open Source</a>
- <a href="/site/language" class="text-dark pr-2">Language</a>
- <a href="/site/terms" class="text-dark pr-2">Terms</a>
- <a href="/site/privacy" class="text-dark pr-2">Privacy</a>
- <a href="/site/platform" class="text-dark pr-2">API</a>
- </p>
- <p class="mb-0 text-uppercase font-weight-bold text-muted small">
- <a href="http://pixelfed.org" class="text-muted" rel="noopener" title="" data-toggle="tooltip">Powered by Pixelfed</a>
- </p>
- </div>
- </footer>
- </div>
- </div>
- </div>
- <!-- <b-modal ref="followingModal"
- id="following-modal"
- hide-footer
- centered
- title="Following"
- body-class="list-group-flush p-0">
- <div class="list-group">
- <div class="list-group-item border-0" v-for="(user, index) in following" :key="'following_'+index">
- <div class="media">
- <a :href="user.url">
- <img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + 'โs avatar'" width="30px">
- </a>
- <div class="media-body">
- <p class="mb-0" style="font-size: 14px">
- <a :href="user.url" class="font-weight-bold text-dark">
- {{user.username}}
- </a>
- </p>
- <p class="text-muted mb-0" style="font-size: 14px">
- {{user.display_name}}
- </p>
- </div>
- <a class="btn btn-outline-secondary btn-sm" href="#" @click.prevent="followModalAction(user.id, index, 'following')">Unfollow</a>
- </div>
- </div>
- <div v-if="following.length == 0" class="list-group-item border-0">
- <div class="list-group-item border-0">
- <p class="p-3 text-center mb-0 lead">You are not following anyone.</p>
- </div>
- </div>
- <div v-if="following.length != 0 && followingMore" class="list-group-item text-center" v-on:click="followingLoadMore()">
- <p class="mb-0 small text-muted font-weight-light cursor-pointer">Load more</p>
- </div>
- </div>
- </b-modal>
- <b-modal ref="followerModal"
- id="follower-modal"
- hide-footer
- centered
- title="Followers"
- body-class="list-group-flush p-0">
- <div class="list-group">
- <div class="list-group-item border-0" v-for="(user, index) in followers" :key="'follower_'+index">
- <div class="media">
- <a :href="user.url">
- <img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + 'โs avatar'" width="30px">
- </a>
- <div class="media-body">
- <p class="mb-0" style="font-size: 14px">
- <a :href="user.url" class="font-weight-bold text-dark">
- {{user.username}}
- </a>
- </p>
- <p class="text-muted mb-0" style="font-size: 14px">
- {{user.display_name}}
- </p>
- </div>
- </div>
- </div>
- <div v-if="followerMore" class="list-group-item text-center" v-on:click="followersLoadMore()">
- <p class="mb-0 small text-muted font-weight-light cursor-pointer">Load more</p>
- </div>
- </div>
- </b-modal> -->
- <b-modal ref="ctxModal"
- id="ctx-modal"
- hide-header
- hide-footer
- centered
- rounded
- size="sm"
- body-class="list-group-flush p-0 rounded">
- <div class="list-group text-center">
- <div v-if="ctxMenuStatus && ctxMenuStatus.account.id != profile.id" class="list-group-item rounded cursor-pointer font-weight-bold text-danger" @click="ctxMenuReportPost()">Report inappropriate</div>
- <div v-if="ctxMenuRelationship && ctxMenuRelationship.following" class="list-group-item rounded cursor-pointer font-weight-bold text-danger" @click="ctxMenuUnfollow()">Unfollow</div>
- <div v-if="ctxMenuRelationship && !ctxMenuRelationship.following" class="list-group-item rounded cursor-pointer font-weight-bold text-primary" @click="ctxMenuFollow()">Follow</div>
- <div class="list-group-item rounded cursor-pointer" @click="ctxMenuGoToPost()">Go to post</div>
- <!-- <div class="list-group-item rounded cursor-pointer" @click="ctxMenuEmbed()">Embed</div>
- <div class="list-group-item rounded cursor-pointer" @click="ctxMenuShare()">Share</div> -->
- <div class="list-group-item rounded cursor-pointer" @click="ctxMenuCopyLink()">Copy Link</div>
- <div class="list-group-item rounded cursor-pointer text-lighter" @click="closeCtxMenu()">Cancel</div>
- </div>
- </b-modal>
- <b-modal ref="ctxShareModal"
- id="ctx-share-modal"
- title="Share"
- hide-footer
- centered
- rounded
- size="sm"
- body-class="list-group-flush p-0 rounded text-center">
- <div class="list-group-item rounded cursor-pointer border-top-0">Email</div>
- <div class="list-group-item rounded cursor-pointer">Facebook</div>
- <div class="list-group-item rounded cursor-pointer">Mastodon</div>
- <div class="list-group-item rounded cursor-pointer">Pinterest</div>
- <div class="list-group-item rounded cursor-pointer">Pixelfed</div>
- <div class="list-group-item rounded cursor-pointer">Twitter</div>
- <div class="list-group-item rounded cursor-pointer">VK</div>
- <div class="list-group-item rounded cursor-pointer text-lighter" @click="closeCtxShareMenu()">Cancel</div>
- </b-modal>
- <b-modal ref="ctxEmbedModal"
- id="ctx-embed-modal"
- hide-header
- hide-footer
- centered
- rounded
- size="md"
- body-class="p-2 rounded">
- <div>
- <textarea class="form-control disabled" rows="1" style="border: 1px solid #efefef; font-size: 14px; line-height: 17px; min-height: 37px; margin: 0 0 7px; resize: none; white-space: nowrap;" v-model="ctxEmbedPayload"></textarea>
- <hr>
- <button :class="copiedEmbed ? 'btn btn-primary btn-block btn-sm py-1 font-weight-bold disabed': 'btn btn-primary btn-block btn-sm py-1 font-weight-bold'" @click="ctxCopyEmbed" :disabled="copiedEmbed">{{copiedEmbed ? 'Embed Code Copied!' : 'Copy Embed Code'}}</button>
- <p class="mb-0 px-2 small text-muted">By using this embed, you agree to our <a href="#">API Terms of Use</a>.</p>
- </div>
- </b-modal>
- <b-modal
- id="lightbox"
- ref="lightboxModal"
- hide-header
- hide-footer
- centered
- size="lg"
- body-class="p-0"
- >
- <div v-if="lightboxMedia" :class="lightboxMedia.filter_class">
- <img :src="lightboxMedia.url" class="img-fluid" style="min-height: 100%; min-width: 100%">
- </div>
- </b-modal>
- </div>
- </template>
- <style type="text/css" scoped>
- .postPresenterContainer {
- display: flex;
- align-items: center;
- background: #fff;
- }
- .word-break {
- word-break: break-all;
- }
- .small .custom-control-label {
- padding-top: 3px;
- }
- .reply-btn {
- position: absolute;
- bottom: 12px;
- right: 20px;
- width: 60px;
- text-align: center;
- border-radius: 0 3px 3px 0;
- }
- .emoji-reactions .nav-item {
- font-size: 1.2rem;
- padding: 9px;
- cursor: pointer;
- }
- .emoji-reactions::-webkit-scrollbar {
- width: 0px;
- height: 0px;
- background: transparent;
- }
- </style>
- <script type="text/javascript">
- export default {
- props: ['scope'],
- data() {
- return {
- ids: [],
- config: window.App.config,
- page: 2,
- feed: [],
- profile: {},
- min_id: 0,
- max_id: 0,
- stories: {},
- suggestions: {},
- loading: true,
- replies: [],
- replyId: null,
- modes: {
- 'mod': false,
- 'dark': false,
- 'notify': true,
- 'distractionFree': false
- },
- followers: [],
- followerCursor: 1,
- followerMore: true,
- following: [],
- followingCursor: 1,
- followingMore: true,
- lightboxMedia: false,
- showSuggestions: false,
- showReadMore: true,
- replyStatus: {},
- replyText: '',
- emoji: ['๐','๐คฃ','๐','๐','๐','๐','๐','๐','๐','๐','๐','๐','๐ค','๐คฉ','๐ค','๐คจ','๐','๐','๐ถ','๐','๐','๐ฃ','๐ฅ','๐ฎ','๐ค','๐ช','๐ซ','๐ด','๐','๐','๐','๐','๐คค','๐','๐','๐','๐','๐','๐ค','๐ฒ','๐','๐','๐','๐','๐ค','๐ญ','๐ฆ','๐ง','๐จ','๐ฉ','๐คฏ','๐ฌ','๐ฐ','๐ฑ','๐ณ','๐คช','๐ต','๐ก','๐ ','๐คฌ','๐ท','๐ค','๐ค','๐คข','๐คฎ','๐คง','๐','๐ค ','๐คก','๐คฅ','๐คซ','๐คญ','๐ง','๐ค','๐','๐ฟ','๐น','๐บ','๐','๐ป','๐ฝ','๐ค','๐ฉ','๐บ','๐ธ','๐น','๐ป','๐ผ','๐ฝ','๐','๐ฟ','๐พ','๐คฒ','๐','๐ค','๐','๐','๐','โ','๐ค','๐ค','๐ค','โ๏ธ','๐ค','๐ค','๐','๐','๐','๐','โ๏ธ','โ','๐ค','๐','๐','๐','๐ค','๐ช','๐','โ๏ธ','๐','๐','๐','๐','๐','๐
','๐','๐','๐ฃ','๐','๐','๐ง ','๐ฃ','๐ค','๐ฅ'],
- showHashtagPosts: false,
- hashtagPosts: [],
- hashtagPostsName: '',
- ctxMenuStatus: false,
- ctxMenuRelationship: false,
- ctxEmbedPayload: false,
- copiedEmbed: false
- }
- },
- beforeMount() {
- this.fetchProfile();
- this.fetchTimelineApi();
- // if(this.config.announcement.enabled == true) {
- // let msg = $('<div>')
- // .addClass('alert alert-warning mb-0 rounded-0 text-center font-weight-bold')
- // .html(this.config.announcement.message);
- // $('body').prepend(msg);
- // }
- },
- mounted() {
- if($('link[data-stylesheet="dark"]').length != 0) {
- this.modes.dark = true;
- }
- if(localStorage.getItem('pf_metro_ui.exp.rec') == 'false') {
- this.showSuggestions = false;
- } else {
- this.showSuggestions = true;
- }
- if(localStorage.getItem('pf_metro_ui.exp.rm') == 'false') {
- this.showReadMore = false;
- } else {
- this.showReadMore = true;
- }
- if(localStorage.getItem('pf_metro_ui.exp.df') == 'true') {
- this.modes.distractionFree = true;
- } else {
- this.modes.distractionFree = false;
- }
- this.$nextTick(function () {
- $('[data-toggle="tooltip"]').tooltip()
- });
- },
- updated() {
- if(this.showReadMore == true) {
- pixelfed.readmore();
- }
- },
- methods: {
- fetchProfile() {
- axios.get('/api/v1/accounts/verify_credentials').then(res => {
- this.profile = res.data;
- if(this.profile.is_admin == true) {
- this.modes.mod = true;
- }
- $('.profile-card .loader').addClass('d-none');
- $('.profile-card .contents').removeClass('d-none');
- $('.profile-card .card-footer').removeClass('d-none');
- this.expRec();
- }).catch(err => {
- swal(
- 'Oops, something went wrong',
- 'Please reload the page.',
- 'error'
- );
- });
- },
- fetchTimelineApi() {
- let apiUrl = false;
- switch(this.scope) {
- case 'home':
- apiUrl = '/api/v1/timelines/home';
- break;
- case 'local':
- apiUrl = '/api/v1/timelines/public';
- break;
- case 'network':
- apiUrl = '/api/v1/timelines/network';
- break;
- }
- axios.get(apiUrl, {
- params: {
- max_id: this.max_id,
- limit: 6
- }
- }).then(res => {
- let data = res.data;
- this.feed.push(...data);
- let ids = data.map(status => status.id);
- this.ids = ids;
- this.min_id = Math.max(...ids);
- this.max_id = Math.min(...ids);
- $('.timeline .pagination').removeClass('d-none');
- this.loading = false;
- this.fetchHashtagPosts();
- }).catch(err => {
- });
- },
- infiniteTimeline($state) {
- if(this.loading) {
- return;
- }
- let apiUrl = false;
- switch(this.scope) {
- case 'home':
- apiUrl = '/api/v1/timelines/home';
- break;
- case 'local':
- apiUrl = '/api/v1/timelines/public';
- break;
- case 'network':
- apiUrl = '/api/v1/timelines/network';
- break;
- }
- axios.get(apiUrl, {
- params: {
- max_id: this.max_id,
- limit: 6
- },
- }).then(res => {
- if (res.data.length && this.loading == false) {
- let data = res.data;
- let self = this;
- data.forEach((d, index) => {
- if(self.ids.indexOf(d.id) == -1) {
- self.feed.push(d);
- self.ids.push(d.id);
- }
- });
- this.min_id = Math.max(...this.ids);
- this.max_id = Math.min(...this.ids);
- this.page += 1;
- $state.loaded();
- this.loading = false;
- } else {
- $state.complete();
- }
- });
- },
- loadMore(event) {
- let homeTimeline = '/api/v1/timelines/home';
- let localTimeline = '/api/v1/timelines/public';
- let apiUrl = this.scope == 'home' ? homeTimeline : localTimeline;
- event.target.innerText = 'Loading...';
- axios.get(apiUrl, {
- params: {
- page: this.page,
- },
- }).then(res => {
- if (res.data.length && this.loading == false) {
- let data = res.data;
- let ids = data.map(status => status.id);
- this.min_id = Math.min(...ids);
- if(this.page == 1) {
- this.max_id = Math.max(...ids);
- }
- this.feed.push(...data);
- this.page += 1;
- this.loading = false;
- event.target.innerText = 'Load more posts';
- } else {
- }
- });
- },
- reportUrl(status) {
- let type = status.in_reply_to ? 'comment' : 'post';
- let id = status.id;
- return '/i/report?type=' + type + '&id=' + id;
- },
- commentFocus(status, $event) {
- if(this.replyId == status.id || status.comments_disabled) {
- return;
- }
- this.replies = {};
- this.replyStatus = {};
- this.replyText = '';
- this.replyId = status.id;
- this.replyStatus = status;
- this.fetchStatusComments(status, '');
- },
- likeStatus(status) {
- if($('body').hasClass('loggedIn') == false) {
- return;
- }
- let count = status.favourites_count;
- status.favourited = !status.favourited;
- axios.post('/i/like', {
- item: status.id
- }).then(res => {
- status.favourites_count = res.data.count;
- }).catch(err => {
- status.favourited = !status.favourited;
- status.favourites_count = count;
- swal('Error', 'Something went wrong, please try again later.', 'error');
- });
- },
- shareStatus(status, $event) {
- if($('body').hasClass('loggedIn') == false) {
- return;
- }
- axios.post('/i/share', {
- item: status.id
- }).then(res => {
- status.reblogs_count = res.data.count;
- status.reblogged = !status.reblogged;
- }).catch(err => {
- swal('Error', 'Something went wrong, please try again later.', 'error');
- });
- },
- timestampFormat(timestamp) {
- let ts = new Date(timestamp);
- return ts.toDateString() + ' ' + ts.toLocaleTimeString();
- },
- editUrl(status) {
- return status.url + '/edit';
- },
- redirect(url) {
- window.location.href = url;
- return;
- },
- replyUrl(status) {
- let username = this.profile.username;
- let id = status.account.id == this.profile.id ? status.id : status.in_reply_to_id;
- return '/p/' + username + '/' + id;
- },
- mentionUrl(status) {
- let username = status.account.username;
- let id = status.id;
- return '/p/' + username + '/' + id;
- },
- statusOwner(status) {
- let sid = status.account.id;
- let uid = this.profile.id;
- if(sid == uid) {
- return true;
- } else {
- return false;
- }
- },
- fetchStatusComments(status, card) {
- axios.get('/api/v2/status/'+status.id+'/replies')
- .then(res => {
- let data = res.data.filter(res => {
- return res.sensitive == false;
- });
- this.replies = _.reverse(data);
- }).catch(err => {
- })
- },
- muteProfile(status) {
- if($('body').hasClass('loggedIn') == false) {
- return;
- }
- axios.post('/i/mute', {
- type: 'user',
- item: status.account.id
- }).then(res => {
- this.feed = this.feed.filter(s => s.account.id !== status.account.id);
- swal('Success', 'You have successfully muted ' + status.account.acct, 'success');
- }).catch(err => {
- swal('Error', 'Something went wrong. Please try again later.', 'error');
- });
- },
- blockProfile(status) {
- if($('body').hasClass('loggedIn') == false) {
- return;
- }
- axios.post('/i/block', {
- type: 'user',
- item: status.account.id
- }).then(res => {
- this.feed = this.feed.filter(s => s.account.id !== status.account.id);
- swal('Success', 'You have successfully blocked ' + status.account.acct, 'success');
- }).catch(err => {
- swal('Error', 'Something went wrong. Please try again later.', 'error');
- });
- },
- deletePost(status, index) {
- if($('body').hasClass('loggedIn') == false || this.ownerOrAdmin(status) == false) {
- return;
- }
- if(window.confirm('Are you sure you want to delete this post?') == false) {
- return;
- }
- axios.post('/i/delete', {
- type: 'status',
- item: status.id
- }).then(res => {
- this.feed = this.feed.filter(s => {
- return s.id != status.id;
- })
- swal('Success', 'You have successfully deleted this post', 'success');
- }).catch(err => {
- swal('Error', 'Something went wrong. Please try again later.', 'error');
- });
- },
- commentSubmit(status, $event) {
- let id = status.id;
- let comment = this.replyText;
- axios.post('/i/comment', {
- item: id,
- comment: comment
- }).then(res => {
- this.replyText = '';
- this.replies.push(res.data.entity);
- });
- },
- moderatePost(status, action, $event) {
- let username = status.account.username;
- switch(action) {
- case 'autocw':
- let msg = 'Are you sure you want to enforce CW for ' + username + ' ?';
- swal({
- title: 'Confirm',
- text: msg,
- icon: 'warning',
- buttons: true,
- dangerMode: true
- }).then(res => {
- if(res) {
- axios.post('/api/v2/moderator/action', {
- action: action,
- item_id: status.id,
- item_type: 'status'
- }).then(res => {
- swal('Success', 'Successfully enforced CW for ' + username, 'success');
- }).catch(err => {
- swal(
- 'Error',
- 'Something went wrong, please try again later.',
- 'error'
- );
- });
- }
- });
- break;
- case 'noautolink':
- msg = 'Are you sure you want to disable auto linking for ' + username + ' ?';
- swal({
- title: 'Confirm',
- text: msg,
- icon: 'warning',
- buttons: true,
- dangerMode: true
- }).then(res => {
- if(res) {
- axios.post('/api/v2/moderator/action', {
- action: action,
- item_id: status.id,
- item_type: 'status'
- }).then(res => {
- swal('Success', 'Successfully disabled autolinking for ' + username, 'success');
- }).catch(err => {
- swal(
- 'Error',
- 'Something went wrong, please try again later.',
- 'error'
- );
- });
- }
- });
- break;
- case 'unlisted':
- msg = 'Are you sure you want to unlist from timelines for ' + username + ' ?';
- swal({
- title: 'Confirm',
- text: msg,
- icon: 'warning',
- buttons: true,
- dangerMode: true
- }).then(res => {
- if(res) {
- axios.post('/api/v2/moderator/action', {
- action: action,
- item_id: status.id,
- item_type: 'status'
- }).then(res => {
- swal('Success', 'Successfully unlisted for ' + username, 'success');
- }).catch(err => {
- swal(
- 'Error',
- 'Something went wrong, please try again later.',
- 'error'
- );
- });
- }
- });
- break;
- case 'disable':
- msg = 'Are you sure you want to disable ' + username + 'โs account ?';
- swal({
- title: 'Confirm',
- text: msg,
- icon: 'warning',
- buttons: true,
- dangerMode: true
- }).then(res => {
- if(res) {
- axios.post('/api/v2/moderator/action', {
- action: action,
- item_id: status.id,
- item_type: 'status'
- }).then(res => {
- swal('Success', 'Successfully disabled ' + username + 'โs account', 'success');
- }).catch(err => {
- swal(
- 'Error',
- 'Something went wrong, please try again later.',
- 'error'
- );
- });
- }
- });
- break;
- case 'suspend':
- msg = 'Are you sure you want to suspend ' + username + 'โs account ?';
- swal({
- title: 'Confirm',
- text: msg,
- icon: 'warning',
- buttons: true,
- dangerMode: true
- }).then(res => {
- if(res) {
- axios.post('/api/v2/moderator/action', {
- action: action,
- item_id: status.id,
- item_type: 'status'
- }).then(res => {
- swal('Success', 'Successfully suspend ' + username + 'โs account', 'success');
- }).catch(err => {
- swal(
- 'Error',
- 'Something went wrong, please try again later.',
- 'error'
- );
- });
- }
- });
- break;
- }
- },
- followingModal() {
- if(this.following.length > 0) {
- this.$refs.followingModal.show();
- return;
- }
- axios.get('/api/v1/accounts/'+this.profile.id+'/following', {
- params: {
- page: this.followingCursor
- }
- })
- .then(res => {
- this.following = res.data;
- this.followingCursor++;
- });
- if(res.data.length < 10) {
- this.followingMore = false;
- }
- this.$refs.followingModal.show();
- },
- followersModal() {
- if(this.followers.length > 0) {
- this.$refs.followerModal.show();
- return;
- }
- axios.get('/api/v1/accounts/'+this.profile.id+'/followers', {
- params: {
- page: this.followerCursor
- }
- })
- .then(res => {
- this.followers = res.data;
- this.followerCursor++;
- })
- if(res.data.length < 10) {
- this.followerMore = false;
- }
- this.$refs.followerModal.show();
- },
- followingLoadMore() {
- axios.get('/api/v1/accounts/'+this.profile.id+'/following', {
- params: {
- page: this.followingCursor
- }
- })
- .then(res => {
- if(res.data.length > 0) {
- this.following.push(...res.data);
- this.followingCursor++;
- }
- if(res.data.length < 10) {
- this.followingMore = false;
- }
- });
- },
- followersLoadMore() {
- axios.get('/api/v1/accounts/'+this.profile.id+'/followers', {
- params: {
- page: this.followerCursor
- }
- })
- .then(res => {
- if(res.data.length > 0) {
- this.followers.push(...res.data);
- this.followerCursor++;
- }
- if(res.data.length < 10) {
- this.followerMore = false;
- }
- });
- },
- lightbox(src) {
- this.lightboxMedia = src;
- this.$refs.lightboxModal.show();
- },
- expLc(status) {
- if(this.config.ab.lc == false) {
- return true;
- }
- if(this.statusOwner(status) == true) {
- return true;
- }
- return false;
- },
- expRec() {
- if(this.config.ab.rec == false) {
- return;
- }
- axios.get('/api/local/exp/rec')
- .then(res => {
- this.suggestions = res.data;
- })
- },
- expRecFollow(id, index) {
- if(this.config.ab.rec == false) {
- return;
- }
- axios.post('/i/follow', {
- item: id
- }).then(res => {
- this.suggestions.splice(index, 1);
- }).catch(err => {
- if(err.response.data.message) {
- swal('Error', err.response.data.message, 'error');
- }
- });
- },
- followModalAction(id, index, type = 'following') {
- axios.post('/i/follow', {
- item: id
- }).then(res => {
- if(type == 'following') {
- this.following.splice(index, 1);
- }
- }).catch(err => {
- if(err.response.data.message) {
- swal('Error', err.response.data.message, 'error');
- }
- });
- },
- owner(status) {
- return this.profile.id === status.account.id;
- },
- admin() {
- return this.profile.is_admin == true;
- },
- ownerOrAdmin(status) {
- return this.owner(status) || this.admin();
- },
- hideSuggestions() {
- localStorage.setItem('pf_metro_ui.exp.rec', false);
- this.showSuggestions = false;
- },
- emojiReaction(status) {
- let em = event.target.innerText;
- if(this.replyText.length == 0) {
- this.replyText = em + ' ';
- $('textarea[name="comment"]').focus();
- } else {
- this.replyText += em + ' ';
- $('textarea[name="comment"]').focus();
- }
- },
- refreshSuggestions() {
- let el = event.target.parentNode;
- if(el.classList.contains('disabled') == true) {
- return;
- }
- axios.get('/api/local/exp/rec', {
- params: {
- refresh: true
- }
- })
- .then(res => {
- this.suggestions = res.data;
- if (el.classList) {
- el.classList.add('disabled');
- el.classList.add('text-light');
- }
- else {
- el.className += ' ' + 'disabled text-light';
- }
- setTimeout(function() {
- el.setAttribute('href', '#');
- if (el.classList) {
- el.classList.remove('disabled');
- el.classList.remove('text-light');
- }
- else {
- el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), 'disabled text-light');
- }
- }, 10000);
- });
- },
- fetchHashtagPosts() {
- axios.get('/api/local/discover/tag/list')
- .then(res => {
- let tags = res.data;
- if(tags.length == 0) {
- return;
- }
- let hashtag = tags[0];
- this.hashtagPostsName = hashtag;
- axios.get('/api/v2/discover/tag', {
- params: {
- hashtag: hashtag
- }
- }).then(res => {
- if(res.data.tags.length) {
- this.showHashtagPosts = true;
- this.hashtagPosts = res.data.tags.splice(0,3);
- }
- })
- })
- },
- ctxMenu(status) {
- this.ctxMenuStatus = status;
- let payload = '<div class="pixlfed-media" data-id="'+ this.ctxMenuStatus.id + '"></div><script ';
- payload += 'src="https://pixelfed.dev/js/embed.js" async><';
- payload += '/script>';
- this.ctxEmbedPayload = payload;
- if(status.account.id == this.profile.id) {
- this.$refs.ctxModal.show();
- } else {
- axios.get('/api/v1/accounts/relationships', {
- params: {
- 'id[]': status.account.id
- }
- }).then(res => {
- this.ctxMenuRelationship = res.data[0];
- this.$refs.ctxModal.show();
- });
- }
- },
- closeCtxMenu(truncate) {
- this.copiedEmbed = false;
- this.ctxMenuStatus = false;
- this.ctxMenuRelationship = false;
- this.$refs.ctxModal.hide();
- },
- ctxMenuCopyLink() {
- let status = this.ctxMenuStatus;
- navigator.clipboard.writeText(status.url);
- this.closeCtxMenu();
- return;
- },
- ctxMenuGoToPost() {
- let status = this.ctxMenuStatus;
- window.location.href = status.url;
- this.closeCtxMenu();
- return;
- },
- ctxMenuFollow() {
- axios.post('/i/follow', {
- item: this.ctxMenuStatus.account.id
- }).then(res => {
- let username = this.ctxMenuStatus.account.acct;
- this.closeCtxMenu();
- setTimeout(function() {
- swal('Follow successful!', 'You are now following ' + username, 'success');
- }, 500);
- });
- },
- ctxMenuUnfollow() {
- axios.post('/i/follow', {
- item: this.ctxMenuStatus.account.id
- }).then(res => {
- let username = this.ctxMenuStatus.account.acct;
- this.closeCtxMenu();
- setTimeout(function() {
- swal('Unfollow successful!', 'You are no longer following ' + username, 'success');
- }, 500);
- });
- },
- ctxMenuReportPost() {
- window.location.href = '/i/report?type=post&id=' + this.ctxMenuStatus.id;
- },
- ctxMenuEmbed() {
- this.$refs.ctxModal.hide();
- this.$refs.ctxEmbedModal.show();
- },
- ctxMenuShare() {
- this.$refs.ctxModal.hide();
- this.$refs.ctxShareModal.show();
- },
- closeCtxShareMenu() {
- this.$refs.ctxShareModal.hide();
- this.$refs.ctxModal.show();
- },
- ctxCopyEmbed() {
- navigator.clipboard.writeText(this.ctxEmbedPayload);
- this.$refs.ctxEmbedModal.hide();
- }
- }
- }
- </script>
|