feat: ✨ add NSFW confirm alert
This commit is contained in:
parent
80be636384
commit
d1a7f89c2e
4 changed files with 166 additions and 13 deletions
42
src/App.vue
42
src/App.vue
|
@ -1,5 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
|
<nsfw-warning v-show="isWarn"></nsfw-warning>
|
||||||
|
|
||||||
<ref-header
|
<ref-header
|
||||||
mainHeading="Sebin Nyshkim"
|
mainHeading="Sebin Nyshkim"
|
||||||
subHeading="Character Reference Page"
|
subHeading="Character Reference Page"
|
||||||
|
@ -189,14 +191,23 @@
|
||||||
|
|
||||||
<h3>Additional Muscle References</h3>
|
<h3>Additional Muscle References</h3>
|
||||||
<div class="prose" v-show="!nsfw">
|
<div class="prose" v-show="!nsfw">
|
||||||
<p class="nsfw-bar">
|
<div class="nsfw-bar">
|
||||||
|
<div class="nsfw-bar__content flex flex--row flex--nowrap">
|
||||||
|
<div>
|
||||||
<strong>
|
<strong>
|
||||||
Some of these additional references are NSFW. Click
|
Some of these additional references are NSFW. Please enable
|
||||||
<a href="#" @click.prevent="nsfw = !nsfw">here</a> to enable NSFW
|
NSFW mode to reveal them.
|
||||||
mode.
|
|
||||||
</strong>
|
</strong>
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
<nsfw-switch
|
||||||
|
id="nsfw-switch-muscle"
|
||||||
|
v-model="nsfw"
|
||||||
|
@change="showWarning()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<gallery v-show="nsfw">
|
<gallery v-show="nsfw">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
@ -628,6 +639,8 @@ import Gallery from "@components/Gallery.vue";
|
||||||
import RefFigure from "@components/Figure.vue";
|
import RefFigure from "@components/Figure.vue";
|
||||||
import RefHeader from "@components/Header.vue";
|
import RefHeader from "@components/Header.vue";
|
||||||
import RefFooter from "@components/Footer.vue";
|
import RefFooter from "@components/Footer.vue";
|
||||||
|
import NsfwSwitch from "@components/NsfwSwitch.vue";
|
||||||
|
import NsfwWarning from "@components/NsfwWarning.vue";
|
||||||
|
|
||||||
import Sebin from "@mixins/Sebin.js";
|
import Sebin from "@mixins/Sebin.js";
|
||||||
import Helper from "@mixins/Helper.js";
|
import Helper from "@mixins/Helper.js";
|
||||||
|
@ -640,15 +653,30 @@ export default {
|
||||||
Gallery,
|
Gallery,
|
||||||
RefFigure,
|
RefFigure,
|
||||||
RefHeader,
|
RefHeader,
|
||||||
RefFooter
|
RefFooter,
|
||||||
|
NsfwSwitch,
|
||||||
|
NsfwWarning
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
nsfw: false,
|
nsfw: false,
|
||||||
|
isWarn: false,
|
||||||
|
isConfirmedHorny: false,
|
||||||
version: require("../package.json").version
|
version: require("../package.json").version
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mixins: [Sebin, Helper]
|
mixins: [Sebin, Helper],
|
||||||
|
methods: {
|
||||||
|
showWarning() {
|
||||||
|
if (!this.isConfirmedHorny) {
|
||||||
|
this.isWarn = true;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.nsfw = false;
|
||||||
|
}, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,11 @@
|
||||||
<div>
|
<div>
|
||||||
If you wish to see NSFW content on this page flip this switch.
|
If you wish to see NSFW content on this page flip this switch.
|
||||||
</div>
|
</div>
|
||||||
<nsfw-switch v-model="$parent.nsfw" />
|
<nsfw-switch
|
||||||
|
id="nsfw-switch-top"
|
||||||
|
v-model="$parent.nsfw"
|
||||||
|
@change="$parent.showWarning()"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<label class="nsfw-switch" for="nsfw-switch">
|
<label class="nsfw-switch" :for="id">
|
||||||
<div>😇</div>
|
<div>😇</div>
|
||||||
<div class="toggle-wrap">
|
<div class="toggle-wrap">
|
||||||
<input
|
<input
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
@change="$emit('change', $event.target.checked)"
|
@change="$emit('change', $event.target.checked)"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="nsfw"
|
name="nsfw"
|
||||||
id="nsfw-switch"
|
:id="id"
|
||||||
/>
|
/>
|
||||||
<div class="toggle"></div>
|
<div class="toggle"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,7 +22,8 @@ export default {
|
||||||
event: "change"
|
event: "change"
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
checked: Boolean
|
checked: Boolean,
|
||||||
|
id: { type: String, required: true }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
120
src/components/NsfwWarning.vue
Normal file
120
src/components/NsfwWarning.vue
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
<template>
|
||||||
|
<div class="nsfw-warning">
|
||||||
|
<div class="nsfw-warning__background"></div>
|
||||||
|
<div class="nsfw-warning__message">
|
||||||
|
<div>
|
||||||
|
<h2>⚠️ Whoa, Nelly! ⚠️</h2>
|
||||||
|
<p>
|
||||||
|
By enabling NSFW mode you confirm that you are of legal age to view
|
||||||
|
adult content.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="btn-container">
|
||||||
|
<a href="#" class="btn positive" @click.prevent="confirmNsfw(true)">
|
||||||
|
Yes, show me the goods 👀
|
||||||
|
</a>
|
||||||
|
<a href="#" class="btn negative" @click.prevent="confirmNsfw(false)">
|
||||||
|
NO, STAHP 😱
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
confirmNsfw(input) {
|
||||||
|
this.$parent.nsfw = input;
|
||||||
|
this.$parent.isConfirmedHorny = input;
|
||||||
|
this.$parent.isWarn = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import "@scss/_variables.scss";
|
||||||
|
@import "@scss/_mixins.scss";
|
||||||
|
|
||||||
|
.nsfw-warning {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
|
||||||
|
z-index: 9001;
|
||||||
|
|
||||||
|
backdrop-filter: blur(1em);
|
||||||
|
background-color: rgba(#000, 0.5);
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row nowrap;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
padding: 2em;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
&__background {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__message {
|
||||||
|
flex: 0 1 30em;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row wrap;
|
||||||
|
justify-content: center;
|
||||||
|
align-content: center;
|
||||||
|
|
||||||
|
margin: auto;
|
||||||
|
border: 0.25em solid $bg-color-warning;
|
||||||
|
border-radius: 1em;
|
||||||
|
padding: 1em;
|
||||||
|
|
||||||
|
z-index: 9002;
|
||||||
|
|
||||||
|
background-color: $bg-color-dark;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
flex: 0 1 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-container {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row wrap;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
flex: 0 1 100%;
|
||||||
|
background-color: $bg-color-light;
|
||||||
|
border-radius: 0.25em;
|
||||||
|
font-size: 1.5em;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0.25em 0.5em;
|
||||||
|
margin: 0 0 1em 0;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
@include mq-desktop {
|
||||||
|
flex: 0 1 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.positive {
|
||||||
|
background-color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.negative {
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Add table
Add a link
Reference in a new issue