Allowing HTML in disclaimer.

This commit is contained in:
DebaucheryLibrarian 2023-06-19 04:06:52 +02:00
parent d8b641e461
commit 4839a3b94c
1 changed files with 40 additions and 14 deletions

54
assets/components/container/container.vue Normal file → Executable file
View File

@ -8,35 +8,40 @@
/> />
<transition name="slide"> <transition name="slide">
<Sidebar <Sidebar v-if="showSidebar" />
v-if="showSidebar"
@toggle-sidebar="(state) => toggleSidebar(state)"
@show-filters="(state) => toggleFilters(state)"
/>
</transition> </transition>
<Header <Header />
@toggle-sidebar="(state) => toggleSidebar(state)"
@show-filters="(state) => toggleFilters(state)"
/>
<p <p
v-if="config.showDisclaimer" v-if="config.showDisclaimer"
class="disclaimer" class="disclaimer"
>{{ config.disclaimer }}</p> v-html="config.disclaimer"
/>
<p
v-if="config.showAnnouncement"
class="announcement"
v-html="config.announcement"
/>
<div <div
ref="content" ref="content"
class="content" class="content"
@scroll="scroll" @scroll="scroll"
> >
<router-view @scroll="scrollToTop" /> <RouterView @scroll="scrollToTop" />
</div> </div>
<Filters <Filters
v-if="showFilters" v-if="showFilters"
@close="toggleFilters(false)" @close="toggleFilters(false)"
/> />
<Settings
v-if="showSettings"
@close="toggleSettings(false)"
/>
</div> </div>
</template> </template>
@ -45,6 +50,7 @@ import Warning from './warning.vue';
import Header from '../header/header.vue'; import Header from '../header/header.vue';
import Sidebar from '../sidebar/sidebar.vue'; import Sidebar from '../sidebar/sidebar.vue';
import Filters from '../filters/filters.vue'; import Filters from '../filters/filters.vue';
import Settings from '../settings/settings.vue';
function toggleSidebar(state) { function toggleSidebar(state) {
this.showSidebar = typeof state === 'boolean' ? state : !this.showSidebar; this.showSidebar = typeof state === 'boolean' ? state : !this.showSidebar;
@ -55,6 +61,11 @@ function toggleFilters(state) {
this.showSidebar = false; this.showSidebar = false;
} }
function toggleSettings(state) {
this.showSettings = state;
this.showSidebar = false;
}
async function setConsent(consent, includeQueer) { async function setConsent(consent, includeQueer) {
if (consent) { if (consent) {
this.showWarning = false; this.showWarning = false;
@ -62,7 +73,7 @@ async function setConsent(consent, includeQueer) {
} }
if (includeQueer) { if (includeQueer) {
this.$store.dispatch('setTagFilter', this.$store.state.ui.tagFilter.filter(tag => !['gay', 'bisexual', 'transsexual'].includes(tag))); this.$store.dispatch('setTagFilter', this.$store.state.ui.tagFilter.filter((tag) => !['gay', 'bisexual', 'transsexual'].includes(tag)));
return; return;
} }
@ -88,6 +99,9 @@ function scrollToTop() {
function mounted() { function mounted() {
document.addEventListener('click', this.blur); document.addEventListener('click', this.blur);
window.addEventListener('resize', this.resize); window.addEventListener('resize', this.resize);
this.events.on('toggleSettings', this.toggleSettings);
this.events.on('toggleSidebar', this.toggleSidebar);
} }
function beforeUnmount() { function beforeUnmount() {
@ -101,12 +115,15 @@ export default {
Sidebar, Sidebar,
Warning, Warning,
Filters, Filters,
Settings,
}, },
data() { data() {
return { return {
showSidebar: false, showSidebar: false,
showWarning: localStorage.getItem('consent') !== window.env.sessionId, showWarning: localStorage.getItem('consent') !== window.env.sessionId,
showFilters: false, showFilters: false,
showSettings: false,
selected: null,
}; };
}, },
mounted, mounted,
@ -114,6 +131,7 @@ export default {
methods: { methods: {
toggleSidebar, toggleSidebar,
toggleFilters, toggleFilters,
toggleSettings,
setConsent, setConsent,
blur, blur,
resize, resize,
@ -183,13 +201,21 @@ export default {
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.disclaimer { .disclaimer,
.announcement {
padding: .5rem 1rem; padding: .5rem 1rem;
margin: 0; margin: 0;
color: var(--text-light); color: var(--text-light);
background: var(--warn);
font-weight: bold; font-weight: bold;
box-shadow: inset 0 0 3px var(--darken-weak); box-shadow: inset 0 0 3px var(--darken-weak);
text-align: center; text-align: center;
} }
.disclaimer {
background: var(--warn);
}
.announcement {
background: var(--notice);
}
</style> </style>