2018-05-02 00:05:36 +00:00
|
|
|
{#if sensitive }
|
2018-12-08 17:44:12 +00:00
|
|
|
<div class={computedClass}>
|
2018-05-02 00:05:36 +00:00
|
|
|
{#if sensitiveShown}
|
2018-02-04 23:59:42 +00:00
|
|
|
<button type="button"
|
|
|
|
class="status-sensitive-media-button"
|
|
|
|
aria-label="Hide sensitive media"
|
2018-05-02 00:05:36 +00:00
|
|
|
delegate-key={delegateKey} >
|
2018-02-04 18:16:27 +00:00
|
|
|
<div class="svg-wrapper">
|
2018-03-16 15:42:10 +00:00
|
|
|
<svg class="status-sensitive-media-svg">
|
2018-12-08 20:46:16 +00:00
|
|
|
<use xlink:href="icons.svg#fa-eye-slash" />
|
2018-02-04 18:16:27 +00:00
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
</button>
|
2018-05-02 00:05:36 +00:00
|
|
|
<MediaAttachments {mediaAttachments} {sensitive} {uuid} />
|
|
|
|
{:else}
|
2018-02-04 23:59:42 +00:00
|
|
|
<button type="button"
|
|
|
|
class="status-sensitive-media-button"
|
|
|
|
aria-label="Show sensitive media"
|
2018-05-02 00:05:36 +00:00
|
|
|
delegate-key={delegateKey} >
|
2018-02-04 23:59:42 +00:00
|
|
|
|
|
|
|
<div class="status-sensitive-media-warning">
|
|
|
|
<span>Sensitive content. Click to show.</span>
|
|
|
|
</div>
|
|
|
|
<div class="svg-wrapper">
|
2018-03-16 15:42:10 +00:00
|
|
|
<svg class="status-sensitive-media-svg">
|
2018-12-08 20:46:16 +00:00
|
|
|
<use xlink:href="icons.svg#fa-eye" />
|
2018-02-04 23:59:42 +00:00
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
</button>
|
2018-05-02 00:05:36 +00:00
|
|
|
{/if}
|
2018-02-04 18:16:27 +00:00
|
|
|
</div>
|
2018-05-02 00:05:36 +00:00
|
|
|
{:else}
|
|
|
|
<MediaAttachments {mediaAttachments} {sensitive} {uuid} />
|
|
|
|
{/if}
|
2018-02-04 18:16:27 +00:00
|
|
|
<style>
|
|
|
|
.status-sensitive-media-container {
|
2018-02-10 04:07:48 +00:00
|
|
|
grid-area: media;
|
2018-12-08 17:42:38 +00:00
|
|
|
width: 100%;
|
2018-02-04 18:16:27 +00:00
|
|
|
margin: 10px 0;
|
|
|
|
position: relative;
|
|
|
|
border-radius: 0;
|
|
|
|
border: none;
|
|
|
|
background: none;
|
|
|
|
}
|
|
|
|
|
2018-12-08 17:44:12 +00:00
|
|
|
.status-sensitive-media-container.grouped-images {
|
|
|
|
grid-area: media-grp;
|
|
|
|
}
|
|
|
|
|
2018-02-04 18:16:27 +00:00
|
|
|
.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-04 23:59:42 +00:00
|
|
|
.status-sensitive-media-hidden .status-sensitive-media-button {
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
2018-02-04 18:16:27 +00: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-04 23:59:42 +00:00
|
|
|
.status-sensitive-media-hidden .svg-wrapper {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
}
|
2018-12-08 17:44:12 +00:00
|
|
|
|
|
|
|
.status-sensitive-media-container.grouped-images .svg-wrapper {
|
|
|
|
border-radius: 6px;
|
|
|
|
}
|
2018-02-04 18:16:27 +00:00
|
|
|
.status-sensitive-media-container.status-sensitive-media-shown .svg-wrapper {
|
|
|
|
background: none;
|
|
|
|
}
|
2018-03-16 15:42:10 +00:00
|
|
|
.status-sensitive-media-svg {
|
2018-02-04 18:16:27 +00:00
|
|
|
width: 24px;
|
|
|
|
height: 24px;
|
|
|
|
fill: var(--mask-svg-fill);
|
|
|
|
border-radius: 2px;
|
|
|
|
background: var(--mask-opaque-bg);
|
|
|
|
margin: 1px;
|
|
|
|
padding: 6px 10px;
|
|
|
|
}
|
2018-03-16 15:42:10 +00:00
|
|
|
.status-sensitive-media-container.status-sensitive-media-hidden .status-sensitive-media-svg {
|
2018-02-04 18:16:27 +00:00
|
|
|
fill: var(--deemphasized-text-color);
|
|
|
|
background: var(--mask-opaque-bg);
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
2018-02-05 03:56:06 +00:00
|
|
|
import MediaAttachments from './MediaAttachments.html'
|
2018-02-04 18:16:27 +00:00
|
|
|
import { store } from '../../_store/store'
|
2018-04-18 04:47:30 +00:00
|
|
|
import { registerClickDelegate } from '../../_utils/delegate'
|
2018-12-08 17:44:12 +00:00
|
|
|
import { classname } from '../../_utils/classname'
|
2018-02-04 18:16:27 +00:00
|
|
|
|
|
|
|
export default {
|
2018-04-20 04:38:01 +00:00
|
|
|
oncreate () {
|
2018-04-19 16:37:05 +00:00
|
|
|
let { delegateKey } = this.get()
|
|
|
|
registerClickDelegate(this, delegateKey, () => this.onClickSensitiveMediaButton())
|
2018-03-15 15:59:30 +00:00
|
|
|
},
|
2018-02-04 18:16:27 +00:00
|
|
|
components: {
|
2018-02-05 03:56:06 +00:00
|
|
|
MediaAttachments
|
2018-02-04 18:16:27 +00:00
|
|
|
},
|
|
|
|
store: () => store,
|
|
|
|
computed: {
|
2018-12-08 17:44:12 +00:00
|
|
|
computedClass: ({ sensitiveShown, $largeInlineMedia }) => classname(
|
|
|
|
'status-sensitive-media-container',
|
|
|
|
sensitiveShown ? 'status-sensitive-media-shown' : 'status-sensitive-media-hidden',
|
|
|
|
!$largeInlineMedia && 'grouped-images'
|
|
|
|
),
|
2018-05-02 00:05:36 +00:00
|
|
|
mediaAttachments: ({ originalStatus }) => originalStatus.media_attachments,
|
|
|
|
sensitiveShown: ({ $sensitivesShown, uuid }) => !!$sensitivesShown[uuid],
|
2018-12-01 22:09:08 +00:00
|
|
|
sensitive: ({ originalStatus, $markMediaAsSensitive, $neverMarkMediaAsSensitive }) => (
|
|
|
|
!$neverMarkMediaAsSensitive && ($markMediaAsSensitive || originalStatus.sensitive)
|
|
|
|
),
|
2018-05-02 00:05:36 +00:00
|
|
|
delegateKey: ({ uuid }) => `sensitive-${uuid}`
|
2018-02-04 18:16:27 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2018-04-20 04:38:01 +00:00
|
|
|
onClickSensitiveMediaButton () {
|
2018-04-19 16:37:05 +00:00
|
|
|
let { uuid } = this.get()
|
|
|
|
let { sensitivesShown } = this.store.get()
|
|
|
|
sensitivesShown[uuid] = !sensitivesShown[uuid]
|
2018-08-30 04:42:57 +00:00
|
|
|
this.store.set({ sensitivesShown })
|
2018-02-04 18:16:27 +00:00
|
|
|
this.fire('recalculateHeight')
|
2018-02-04 23:59:42 +00:00
|
|
|
}
|
2018-02-04 18:16:27 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-08 17:42:38 +00:00
|
|
|
</script>
|