shorten incredibly long content warning or subject

This commit is contained in:
dave 2019-02-03 23:47:26 -05:00
parent 7115584882
commit 06cf8628e5
2 changed files with 11 additions and 1 deletions

View File

@ -36,6 +36,7 @@ const Status = {
preview: null,
showPreview: false,
showingTall: this.inConversation && this.focused,
showingTallSubject: false,
expandingSubject: typeof this.$store.state.config.collapseMessageWithSubject === 'undefined'
? !this.$store.state.instance.collapseMessageWithSubject
: !this.$store.state.config.collapseMessageWithSubject,
@ -129,6 +130,10 @@ const Status = {
const lengthScore = this.status.statusnet_html.split(/<p|<br/).length + this.status.text.length / 80
return lengthScore > 20
},
tallSubject () {
const lengthScore = this.status.summary.length / 80
return lengthScore > 10
},
isReply () {
return !!(this.status.in_reply_to_status_id && this.status.in_reply_to_user_id)
},

View File

@ -85,7 +85,12 @@
</div>
</div>
<div :class="{'tall-status': hideTallStatus}" class="status-content-wrapper">
<div class="status-content-wrapper" :class="{ 'tall-status': !showingTallSubject }" v-if="tallSubject">
<a class="tall-status-hider" :class="{ 'tall-status-hider_focused': isFocused }" v-if="!showingTallSubject" href="#" @click.prevent="showingTallSubject=true">Show more</a>
<div @click.prevent="linkClicked" class="status-content media-body" v-html="status.statusnet_html"></div>
<a v-if="showingTallSubject" href="#" class="status-unhider" @click.prevent="showingTallSubject=false">Show less</a>
</div>
<div :class="{'tall-status': hideTallStatus}" class="status-content-wrapper" v-else>
<a class="tall-status-hider" :class="{ 'tall-status-hider_focused': isFocused }" v-if="hideTallStatus" href="#" @click.prevent="toggleShowMore">Show more</a>
<div @click.prevent="linkClicked" class="status-content media-body" v-html="status.statusnet_html" v-if="!hideSubjectStatus"></div>
<div @click.prevent="linkClicked" class="status-content media-body" v-html="status.summary_html" v-else></div>