2018-02-10 06:55:11 +00:00
|
|
|
<div class="status-spoiler {{isStatusInNotification ? 'status-in-notification' : ''}} {{isStatusInOwnThread ? 'status-in-own-thread' : ''}}">
|
2018-03-16 03:04:24 +00:00
|
|
|
<p>{{originalStatus.spoiler_text}}</p>
|
2018-02-04 20:49:42 +00:00
|
|
|
</div>
|
2018-02-10 06:55:11 +00:00
|
|
|
<div class="status-spoiler-button {{isStatusInOwnThread ? 'status-in-own-thread' : ''}}">
|
2018-03-05 01:16:33 +00:00
|
|
|
<button type="button" delegate-key="{{delegateKey}}">
|
2018-02-04 18:44:04 +00:00
|
|
|
{{spoilerShown ? 'Show less' : 'Show more'}}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<style>
|
|
|
|
.status-spoiler {
|
2018-02-10 04:07:48 +00:00
|
|
|
grid-area: spoiler;
|
2018-02-04 18:44:04 +00:00
|
|
|
word-wrap: break-word;
|
|
|
|
overflow: hidden;
|
|
|
|
white-space: pre-wrap;
|
2018-02-10 06:55:11 +00:00
|
|
|
font-size: 0.9em;
|
|
|
|
margin: 10px 5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.status-spoiler.status-in-own-thread {
|
|
|
|
font-size: 1.3em;
|
|
|
|
margin: 20px 5px 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.status-spoiler.status-in-notification {
|
|
|
|
color: var(--very-deemphasized-text-color);
|
2018-02-04 18:44:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.status-spoiler-button {
|
2018-02-10 06:55:11 +00:00
|
|
|
grid-area: spoiler-btn;
|
|
|
|
margin: 10px 5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.status-spoiler-button.status-in-own-thread {
|
2018-02-04 18:44:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.status-spoiler-button button {
|
|
|
|
padding: 5px 10px;
|
|
|
|
font-size: 1.1em;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
import { store } from '../../_store/store'
|
2018-03-05 01:16:33 +00:00
|
|
|
import { registerClickDelegate, unregisterClickDelegate } from '../../_utils/delegate'
|
2018-02-04 18:44:04 +00:00
|
|
|
|
|
|
|
export default {
|
2018-03-05 01:16:33 +00:00
|
|
|
oncreate() {
|
|
|
|
registerClickDelegate(this.get('delegateKey'), () => this.onClickSpoilerButton())
|
|
|
|
},
|
|
|
|
ondestroy() {
|
|
|
|
unregisterClickDelegate(this.get('delegateKey'))
|
|
|
|
},
|
2018-02-04 18:44:04 +00:00
|
|
|
store: () => store,
|
|
|
|
computed: {
|
2018-03-16 03:04:24 +00:00
|
|
|
spoilerShown: ($spoilersShown, uuid) => !!$spoilersShown[uuid],
|
|
|
|
delegateKey: (uuid) => `spoiler-${uuid}`
|
2018-02-04 18:44:04 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onClickSpoilerButton() {
|
2018-03-16 03:04:24 +00:00
|
|
|
let uuid = this.get('uuid')
|
2018-02-04 20:27:28 +00:00
|
|
|
let $spoilersShown = this.store.get('spoilersShown')
|
2018-03-16 03:04:24 +00:00
|
|
|
$spoilersShown[uuid] = !$spoilersShown[uuid]
|
2018-02-04 18:44:04 +00:00
|
|
|
this.store.set({'spoilersShown': $spoilersShown})
|
|
|
|
this.fire('recalculateHeight')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|