2018-02-05 17:50:08 +01:00
|
|
|
{{#if status.sensitive || $markMediaAsSensitive}}
|
2018-02-04 19:16:27 +01:00
|
|
|
<div class="status-sensitive-media-container {{sensitiveShown ? 'status-sensitive-media-shown' : 'status-sensitive-media-hidden'}}"
|
|
|
|
>
|
2018-02-05 00:59:42 +01:00
|
|
|
{{#if sensitiveShown}}
|
|
|
|
<button type="button"
|
|
|
|
class="status-sensitive-media-button"
|
|
|
|
aria-label="Hide sensitive media"
|
2018-02-04 19:16:27 +01:00
|
|
|
on:click="onClickSensitiveMediaButton()" >
|
|
|
|
<div class="svg-wrapper">
|
|
|
|
<svg>
|
2018-02-05 00:59:42 +01:00
|
|
|
<use xlink:href="#fa-eye-slash" />
|
2018-02-04 19:16:27 +01:00
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
</button>
|
2018-02-05 04:56:06 +01:00
|
|
|
<MediaAttachments mediaAttachments="{{mediaAttachments}}" sensitive="{{status.sensitive}}"/>
|
2018-02-05 00:59:42 +01:00
|
|
|
{{else}}
|
|
|
|
<button type="button"
|
|
|
|
class="status-sensitive-media-button"
|
|
|
|
aria-label="Show sensitive media"
|
|
|
|
on:click="onClickSensitiveMediaButton()" >
|
|
|
|
|
|
|
|
<div class="status-sensitive-media-warning">
|
|
|
|
<span>Sensitive content. Click to show.</span>
|
|
|
|
</div>
|
|
|
|
<div class="svg-wrapper">
|
|
|
|
<svg>
|
|
|
|
<use xlink:href="#fa-eye" />
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
</button>
|
2018-02-04 19:16:27 +01:00
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
{{else}}
|
2018-02-05 04:56:06 +01:00
|
|
|
<MediaAttachments mediaAttachments="{{mediaAttachments}}" sensitive="{{status.sensitive}}"/>
|
2018-02-04 19:16:27 +01:00
|
|
|
{{/if}}
|
|
|
|
<style>
|
|
|
|
.status-sensitive-media-container {
|
|
|
|
grid-area: status-media;
|
|
|
|
margin: 10px 0;
|
|
|
|
position: relative;
|
|
|
|
border-radius: 0;
|
|
|
|
border: none;
|
|
|
|
background: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.status-sensitive-media-button {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
border: none;
|
|
|
|
background: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.status-sensitive-media-button:hover {
|
|
|
|
background: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.status-sensitive-media-button:active {
|
|
|
|
background: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.status-sensitive-media-shown .status-sensitive-media-button {
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
z-index: 90;
|
|
|
|
}
|
|
|
|
|
2018-02-05 00:59:42 +01:00
|
|
|
.status-sensitive-media-hidden .status-sensitive-media-button {
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
2018-02-04 19:16:27 +01:00
|
|
|
.status-sensitive-media-container.status-sensitive-media-hidden {
|
|
|
|
width: 100%;
|
|
|
|
margin: 10px auto;
|
|
|
|
height: 200px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.status-sensitive-media-container .status-sensitive-media-warning {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
color: var(--deemphasized-text-color);
|
|
|
|
z-index: 60;
|
|
|
|
}
|
|
|
|
|
|
|
|
.status-sensitive-media-container .svg-wrapper {
|
|
|
|
display: flex;
|
|
|
|
align-items: flex-start;
|
|
|
|
justify-content: flex-start;
|
|
|
|
z-index: 40;
|
|
|
|
pointer-events: none;
|
|
|
|
background: var(--mask-bg);
|
|
|
|
}
|
2018-02-05 00:59:42 +01:00
|
|
|
.status-sensitive-media-hidden .svg-wrapper {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
}
|
2018-02-04 19:16:27 +01:00
|
|
|
.status-sensitive-media-container.status-sensitive-media-shown .svg-wrapper {
|
|
|
|
background: none;
|
|
|
|
}
|
|
|
|
.status-sensitive-media-container svg {
|
|
|
|
width: 24px;
|
|
|
|
height: 24px;
|
|
|
|
fill: var(--mask-svg-fill);
|
|
|
|
border-radius: 2px;
|
|
|
|
background: var(--mask-opaque-bg);
|
|
|
|
margin: 1px;
|
|
|
|
padding: 6px 10px;
|
|
|
|
}
|
|
|
|
.status-sensitive-media-container.status-sensitive-media-hidden svg {
|
|
|
|
fill: var(--deemphasized-text-color);
|
|
|
|
background: var(--mask-opaque-bg);
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
2018-02-05 04:56:06 +01:00
|
|
|
import MediaAttachments from './MediaAttachments.html'
|
2018-02-04 19:16:27 +01:00
|
|
|
import { store } from '../../_store/store'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2018-02-05 04:56:06 +01:00
|
|
|
MediaAttachments
|
2018-02-04 19:16:27 +01:00
|
|
|
},
|
|
|
|
store: () => store,
|
|
|
|
computed: {
|
2018-02-04 19:55:10 +01:00
|
|
|
mediaAttachments: (status) => status.media_attachments,
|
2018-02-04 21:27:28 +01:00
|
|
|
sensitiveShown: ($sensitivesShown, contextualStatusId) => !!$sensitivesShown[contextualStatusId]
|
2018-02-04 19:16:27 +01:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onClickSensitiveMediaButton() {
|
2018-02-04 21:27:28 +01:00
|
|
|
let contextualStatusId = this.get('contextualStatusId')
|
2018-02-04 19:16:27 +01:00
|
|
|
let $sensitivesShown = this.store.get('sensitivesShown') || {}
|
2018-02-04 21:27:28 +01:00
|
|
|
$sensitivesShown[contextualStatusId] = !$sensitivesShown[contextualStatusId]
|
2018-02-04 19:16:27 +01:00
|
|
|
this.store.set({'sensitivesShown': $sensitivesShown})
|
|
|
|
this.fire('recalculateHeight')
|
2018-02-05 00:59:42 +01:00
|
|
|
}
|
2018-02-04 19:16:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|