|
@@ -10,11 +10,11 @@
|
|
<p class="col-span-5 sm:col-span-11"><strong>Consent</strong>: I must use a cookie to keep track of your choices, no way around it.</p>
|
|
<p class="col-span-5 sm:col-span-11"><strong>Consent</strong>: I must use a cookie to keep track of your choices, no way around it.</p>
|
|
</div>
|
|
</div>
|
|
<div class="sm:pl-4 pt-2 grid sm:grid-cols-12 grid-cols-6">
|
|
<div class="sm:pl-4 pt-2 grid sm:grid-cols-12 grid-cols-6">
|
|
- <p><input type="checkbox" class="form-control toggle toggle-primary" v-model="consentStore.analytics" @change="(e) => { consentStore.analytics = e.target.checked }" /></p>
|
|
|
|
|
|
+ <p><input type="checkbox" class="form-control toggle toggle-primary" v-model="consentStore.analytics" @change="(e: Event) => consentStore.analytics = (e.target as HTMLInputElement).checked " /></p>
|
|
<p class="col-span-5 sm:col-span-11"><strong>Analytics</strong>: optional, but it'd be great if you agreed 😊</p>
|
|
<p class="col-span-5 sm:col-span-11"><strong>Analytics</strong>: optional, but it'd be great if you agreed 😊</p>
|
|
</div>
|
|
</div>
|
|
<div class="sm:pl-4 pt-2 grid sm:grid-cols-12 grid-cols-6">
|
|
<div class="sm:pl-4 pt-2 grid sm:grid-cols-12 grid-cols-6">
|
|
- <p><input type="checkbox" class="form-control toggle toggle-primary" v-model="consentStore.ads" @change="(e) => { consentStore.ads = e.target.checked }" /></p>
|
|
|
|
|
|
+ <p><input type="checkbox" class="form-control toggle toggle-primary" v-model="consentStore.ads" @change="(e: Event) => consentStore.ads = (e.target as HTMLInputElement).checked" /></p>
|
|
<p class="col-span-5 sm:col-span-11"><strong>Advertising</strong>: fully optional, feel free to skip this one.</p>
|
|
<p class="col-span-5 sm:col-span-11"><strong>Advertising</strong>: fully optional, feel free to skip this one.</p>
|
|
</div>
|
|
</div>
|
|
<p class="pt-2">You can read more on how I use cookies on <a href="/cookies">this page</a>.</p>
|
|
<p class="pt-2">You can read more on how I use cookies on <a href="/cookies">this page</a>.</p>
|
|
@@ -26,36 +26,38 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div v-else @click="isOpen = true" class="fixed max-w-0 bottom-2 sm:right-16 right-11 cursor-pointer">
|
|
|
|
|
|
+ <div v-else class="fixed max-w-0 bottom-2 sm:right-16 right-11 cursor-pointer" @click="isOpen = true">
|
|
<ClientOnly><fa-icon icon="fa-solid fa-cookie-bite" class="sm:text-6xl text-4xl text-sky-500" /></ClientOnly>
|
|
<ClientOnly><fa-icon icon="fa-solid fa-cookie-bite" class="sm:text-6xl text-4xl text-sky-500" /></ClientOnly>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
-<script setup>
|
|
|
|
|
|
+<script lang="ts" setup>
|
|
import { useConsent } from '~~/store/consent';
|
|
import { useConsent } from '~~/store/consent';
|
|
const consentStore = useConsent();
|
|
const consentStore = useConsent();
|
|
|
|
|
|
const error = useError();
|
|
const error = useError();
|
|
const isOpen = useState('isOpen', () => !consentStore.preferenceGiven && error.value === undefined);
|
|
const isOpen = useState('isOpen', () => !consentStore.preferenceGiven && error.value === undefined);
|
|
|
|
|
|
-const rejectAll = () => {
|
|
|
|
|
|
+const rejectAll = (e: MouseEvent | undefined) => {
|
|
window._paq.push(['forgetCookieConsentGiven']);
|
|
window._paq.push(['forgetCookieConsentGiven']);
|
|
consentStore.analytics = false;
|
|
consentStore.analytics = false;
|
|
consentStore.ads = false;
|
|
consentStore.ads = false;
|
|
consentStore.preferenceGiven = true;
|
|
consentStore.preferenceGiven = true;
|
|
isOpen.value = false;
|
|
isOpen.value = false;
|
|
|
|
+ return e;
|
|
}
|
|
}
|
|
|
|
|
|
-const acceptAll = (e) => {
|
|
|
|
|
|
+const acceptAll = (e: MouseEvent | undefined) => {
|
|
window._paq.push(['rememberCookieConsentGiven']);
|
|
window._paq.push(['rememberCookieConsentGiven']);
|
|
consentStore.analytics = true;
|
|
consentStore.analytics = true;
|
|
consentStore.ads = true;
|
|
consentStore.ads = true;
|
|
consentStore.preferenceGiven = true;
|
|
consentStore.preferenceGiven = true;
|
|
isOpen.value = false;
|
|
isOpen.value = false;
|
|
|
|
+ return e;
|
|
}
|
|
}
|
|
|
|
|
|
-const acceptMyChoice = () => {
|
|
|
|
|
|
+const acceptMyChoice = (e: MouseEvent | undefined) => {
|
|
consentStore.preferenceGiven = true;
|
|
consentStore.preferenceGiven = true;
|
|
isOpen.value = false;
|
|
isOpen.value = false;
|
|
if (consentStore.analytics) {
|
|
if (consentStore.analytics) {
|
|
@@ -63,6 +65,7 @@ const acceptMyChoice = () => {
|
|
} else {
|
|
} else {
|
|
window._paq.push(['forgetCookieConsentGiven']);
|
|
window._paq.push(['forgetCookieConsentGiven']);
|
|
}
|
|
}
|
|
|
|
+ return e;
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|