Rename expandCW to collapseMessageWithSubject.

Add option to config.json, disabled by default.
This commit is contained in:
ensra 2018-08-20 03:41:40 +01:00
parent 671db023da
commit 3ec8e43a97
8 changed files with 26 additions and 23 deletions

View file

@ -15,7 +15,7 @@ const settings = {
streamingLocal: this.$store.state.config.streaming, streamingLocal: this.$store.state.config.streaming,
pauseOnUnfocusedLocal: this.$store.state.config.pauseOnUnfocused, pauseOnUnfocusedLocal: this.$store.state.config.pauseOnUnfocused,
hoverPreviewLocal: this.$store.state.config.hoverPreview, hoverPreviewLocal: this.$store.state.config.hoverPreview,
expandCWLocal: this.$store.state.config.expandCW, collapseMessageWithSubjectLocal: this.$store.state.config.collapseMessageWithSubject,
stopGifs: this.$store.state.config.stopGifs, stopGifs: this.$store.state.config.stopGifs,
loopSilentAvailable: loopSilentAvailable:
// Firefox // Firefox
@ -66,8 +66,8 @@ const settings = {
value = filter(value.split('\n'), (word) => trim(word).length > 0) value = filter(value.split('\n'), (word) => trim(word).length > 0)
this.$store.dispatch('setOption', { name: 'muteWords', value }) this.$store.dispatch('setOption', { name: 'muteWords', value })
}, },
expandCWLocal (value) { collapseMessageWithSubjectLocal (value) {
this.$store.dispatch('setOption', { name: 'expandCW', value }) this.$store.dispatch('setOption', { name: 'collapseMessageWithSubject', value })
}, },
stopGifs (value) { stopGifs (value) {
this.$store.dispatch('setOption', { name: 'stopGifs', value }) this.$store.dispatch('setOption', { name: 'stopGifs', value })

View file

@ -16,6 +16,10 @@
<div class="setting-item"> <div class="setting-item">
<h2>{{$t('nav.timeline')}}</h2> <h2>{{$t('nav.timeline')}}</h2>
<ul class="setting-list"> <ul class="setting-list">
<li>
<input type="checkbox" id="collapseMessageWithSubject" v-model="collapseMessageWithSubjectLocal">
<label for="collapseMessageWithSubject">{{$t('settings.collapse_subject')}}</label>
</li>
<li> <li>
<input type="checkbox" id="streaming" v-model="streamingLocal"> <input type="checkbox" id="streaming" v-model="streamingLocal">
<label for="streaming">{{$t('settings.streaming')}}</label> <label for="streaming">{{$t('settings.streaming')}}</label>
@ -34,10 +38,6 @@
<input type="checkbox" id="hoverPreview" v-model="hoverPreviewLocal"> <input type="checkbox" id="hoverPreview" v-model="hoverPreviewLocal">
<label for="hoverPreview">{{$t('settings.reply_link_preview')}}</label> <label for="hoverPreview">{{$t('settings.reply_link_preview')}}</label>
</li> </li>
<li>
<input type="checkbox" id="expandCW" v-model="expandCWLocal">
<label for="expandCW">{{$t('settings.expand_cw')}}</label>
</li>
</ul> </ul>
</div> </div>
<div class="setting-item"> <div class="setting-item">

View file

@ -31,7 +31,7 @@ const Status = {
preview: null, preview: null,
showPreview: false, showPreview: false,
showingTall: false, showingTall: false,
expandingCW: this.$store.state.config.expandCW expandingSubject: !this.$store.state.config.collapseMessageWithSubject
} }
}, },
computed: { computed: {
@ -105,14 +105,14 @@ const Status = {
const lengthScore = this.status.statusnet_html.split(/<p|<br/).length + this.status.text.length / 80 const lengthScore = this.status.statusnet_html.split(/<p|<br/).length + this.status.text.length / 80
return lengthScore > 20 return lengthScore > 20
}, },
hideCWStatus () { hideSubjectStatus () {
if (this.tallStatus && this.$store.state.config.expandCW) { if (this.tallStatus && !this.$store.state.config.collapseMessageWithSubject) {
return false return false
} }
return !this.expandingCW && this.status.summary return !this.expandingSubject && this.status.summary
}, },
hideTallStatus () { hideTallStatus () {
if (this.status.summary && !this.$store.state.config.expandCW) { if (this.status.summary && this.$store.state.config.collapseMessageWithSubject) {
return false return false
} }
if (this.showingTall) { if (this.showingTall) {
@ -121,7 +121,7 @@ const Status = {
return this.tallStatus return this.tallStatus
}, },
showingMore () { showingMore () {
return this.showingTall || (this.status.summary && this.expandingCW) return this.showingTall || (this.status.summary && this.expandingSubject)
}, },
attachmentSize () { attachmentSize () {
if ((this.$store.state.config.hideAttachments && !this.inConversation) || if ((this.$store.state.config.hideAttachments && !this.inConversation) ||
@ -184,12 +184,12 @@ const Status = {
toggleShowMore () { toggleShowMore () {
if (this.showingTall) { if (this.showingTall) {
this.showingTall = false this.showingTall = false
} else if (this.expandingCW) { } else if (this.expandingSubject) {
this.expandingCW = false this.expandingSubject = false
} else if (this.hideTallStatus) { } else if (this.hideTallStatus) {
this.showingTall = true this.showingTall = true
} else if (this.hideCWStatus) { } else if (this.hideSubjectStatus) {
this.expandingCW = true this.expandingSubject = true
} }
}, },
replyEnter (id, event) { replyEnter (id, event) {

View file

@ -77,9 +77,9 @@
<div :class="{'tall-status': hideTallStatus}" class="status-content-wrapper"> <div :class="{'tall-status': hideTallStatus}" class="status-content-wrapper">
<a class="tall-status-hider" :class="{ 'tall-status-hider_focused': isFocused }" v-if="hideTallStatus" href="#" @click.prevent="toggleShowMore">Show more</a> <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="!hideCWStatus"></div> <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" v-else></div> <div @click.prevent="linkClicked" class="status-content media-body" v-html="status.summary" v-else></div>
<a v-if="hideCWStatus" href="#" class="cw-status-hider" @click.prevent="toggleShowMore">Show more</a> <a v-if="hideSubjectStatus" href="#" class="cw-status-hider" @click.prevent="toggleShowMore">Show more</a>
<a v-if="showingMore" href="#" class="status-unhider" @click.prevent="toggleShowMore">Show less</a> <a v-if="showingMore" href="#" class="status-unhider" @click.prevent="toggleShowMore">Show less</a>
</div> </div>

View file

@ -317,7 +317,7 @@ const en = {
hide_attachments_in_tl: 'Hide attachments in timeline', hide_attachments_in_tl: 'Hide attachments in timeline',
hide_attachments_in_convo: 'Hide attachments in conversations', hide_attachments_in_convo: 'Hide attachments in conversations',
nsfw_clickthrough: 'Enable clickthrough NSFW attachment hiding', nsfw_clickthrough: 'Enable clickthrough NSFW attachment hiding',
expand_cw: 'Expand posts with subjects by default', collapse_subject: 'Collapse posts with subjects',
stop_gifs: 'Play-on-hover GIFs', stop_gifs: 'Play-on-hover GIFs',
autoload: 'Enable automatic loading when scrolled to the bottom', autoload: 'Enable automatic loading when scrolled to the bottom',
streaming: 'Enable automatic streaming of new posts when scrolled to the top', streaming: 'Enable automatic streaming of new posts when scrolled to the top',

View file

@ -45,6 +45,7 @@ Vue.use(VueChatScroll)
const persistedStateOptions = { const persistedStateOptions = {
paths: [ paths: [
'config.collapseMessageWithSubject',
'config.hideAttachments', 'config.hideAttachments',
'config.hideAttachmentsInConv', 'config.hideAttachmentsInConv',
'config.hideNsfw', 'config.hideNsfw',
@ -95,7 +96,7 @@ window.fetch('/api/statusnet/config.json')
window.fetch('/static/config.json') window.fetch('/static/config.json')
.then((res) => res.json()) .then((res) => res.json())
.then((data) => { .then((data) => {
const {theme, background, logo, showWhoToFollowPanel, whoToFollowProvider, whoToFollowLink, showInstanceSpecificPanel, scopeOptionsEnabled} = data const {theme, background, logo, showWhoToFollowPanel, whoToFollowProvider, whoToFollowLink, showInstanceSpecificPanel, scopeOptionsEnabled, collapseMessageWithSubject} = data
store.dispatch('setOption', { name: 'theme', value: theme }) store.dispatch('setOption', { name: 'theme', value: theme })
store.dispatch('setOption', { name: 'background', value: background }) store.dispatch('setOption', { name: 'background', value: background })
store.dispatch('setOption', { name: 'logo', value: logo }) store.dispatch('setOption', { name: 'logo', value: logo })
@ -104,6 +105,7 @@ window.fetch('/static/config.json')
store.dispatch('setOption', { name: 'whoToFollowLink', value: whoToFollowLink }) store.dispatch('setOption', { name: 'whoToFollowLink', value: whoToFollowLink })
store.dispatch('setOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel }) store.dispatch('setOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel })
store.dispatch('setOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled }) store.dispatch('setOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled })
store.dispatch('setOption', { name: 'collapseMessageWithSubject', value: collapseMessageWithSubject })
if (data['chatDisabled']) { if (data['chatDisabled']) {
store.dispatch('disableChat') store.dispatch('disableChat')
} }

View file

@ -4,10 +4,10 @@ import StyleSetter from '../services/style_setter/style_setter.js'
const defaultState = { const defaultState = {
name: 'Pleroma FE', name: 'Pleroma FE',
colors: {}, colors: {},
collapseMessageWithSubject: false,
hideAttachments: false, hideAttachments: false,
hideAttachmentsInConv: false, hideAttachmentsInConv: false,
hideNsfw: true, hideNsfw: true,
expandCW: false,
loopVideo: true, loopVideo: true,
loopVideoSilentOnly: true, loopVideoSilentOnly: true,
autoLoad: true, autoLoad: true,

View file

@ -11,5 +11,6 @@
"whoToFollowLink": "https://vinayaka.distsn.org/?{{host}}+{{user}}", "whoToFollowLink": "https://vinayaka.distsn.org/?{{host}}+{{user}}",
"whoToFollowLinkDummy2": "https://followlink.osa-p.net/recommend.html", "whoToFollowLinkDummy2": "https://followlink.osa-p.net/recommend.html",
"showInstanceSpecificPanel": false, "showInstanceSpecificPanel": false,
"scopeOptionsEnabled": false "scopeOptionsEnabled": false,
"collapseMessageWithSubject": false
} }