-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.vue
More file actions
306 lines (251 loc) · 7.09 KB
/
App.vue
File metadata and controls
306 lines (251 loc) · 7.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<script setup lang="ts">
import '&/randomElement'
import { Icon } from '@iconify/vue'
import type { Ref } from 'vue'
import { onMounted, ref } from 'vue'
import { ProgressiveBlur } from 'vue-progressive-blur'
import type { LocationQuery } from 'vue-router'
import { getFlag, setFlag } from '&/setUserFlag'
import { useRouter } from '#app'
import type { Router } from '#vue-router'
import LangPickerCard from '+/langs/LangPickerCard.vue'
import HStack from '+/layout/HStack.vue'
import CursorParticles from '+/premade/CursorParticles.vue'
import Navbar from '+/premade/navbar/Navbar.vue'
import TransitionElement from '+/premade/TransitionElement.vue'
import Modal from '+/utils/Modal.vue'
import Spacer from '+/utils/Spacer.vue'
import { showingInterfaceOptions } from '$/visibility'
const { t } = useI18n()
const i18nHead = useLocaleHead()
// Set head lang metadata.
// @ts-ignore
useHead(() => ({
...i18nHead.value,
}))
const showingUi: Ref<boolean> = ref(true)
const showDomainTip: Ref<boolean> = ref(false)
const showLangPicker: Ref<boolean> = ref(false)
const redirectLink: Ref<string> = ref('')
const cover: Ref = ref(null)
const router: Router = useRouter()
const params: LocationQuery = router.currentRoute.value.query
const backgrounds: string[] = [
// Closeups
'Purple-Close',
'Blue-Close',
'Moon-Close',
'Green-Close',
// Scenes
'All-Planets',
// Collections
'Moon-Purple',
'Moon-Purple-Green',
'Blue-Purple',
]
const currentBackground: Ref<string> = ref(backgrounds[0] as string)
function neverShowDomainTip(): void {
setFlag('hideDomainTip', true)
showDomainTip.value = false
}
function hideLangPicker(): void {
setFlag('showLangPicker', false)
showLangPicker.value = false
}
onMounted(() => {
if (getFlag('hideDomainTip')) {
showDomainTip.value = false
} else if (
location.hostname.includes('pages.dev') ||
location.port.includes('5173')
) {
showDomainTip.value = true
}
redirectLink.value = `https://a35hie.me${location.pathname}${location.search}${location.hash}`
if (params.noLangPicker == 'true') {
showLangPicker.value = false
setFlag('showLangPicker', false)
} else if (params.noLangPicker == 'false') {
showLangPicker.value = true
setFlag('showLangPicker', true)
} else {
showLangPicker.value = getFlag('showLangPicker', true)
}
router.beforeEach((_to, _from, next) => {
cover.value?.show()
setTimeout(() => {
next()
}, 400)
})
router.afterEach(() => {
setTimeout(() => {
cover.value?.hide()
}, 200)
})
cycleBackgrounds()
})
// Background Cycling
const fadingOut: Ref<boolean> = ref(false)
const fadingIn: Ref<boolean> = ref(false)
const animationTime: number = 500
const waitTime: number = 10000
const sleep = (time: number) =>
new Promise((resolve) => setTimeout(resolve, time))
async function cycleBackgrounds(): Promise<never | void> {
if (window.location.href.includes('uwu')) {
currentBackground.value = 'catgirl'
return
}
while (true) {
fadingIn.value = true
fadingOut.value = false
await sleep(animationTime)
fadingIn.value = false
await sleep(waitTime)
fadingOut.value = true
await sleep(animationTime)
currentBackground.value = getNextBackground()
fadingOut.value = false
}
}
function getNextBackground(): string {
const nextBackground: string = backgrounds.randomElement()!
if (nextBackground == currentBackground.value) {
return getNextBackground()
}
return nextBackground
}
</script>
<template>
<VitePwaManifest />
<h1 class="hidden">Your CSS is disabled!</h1>
<noscript><h1>Your JS is disabled!</h1></noscript>
<HStack class="interfaceOptions" v-if="showingInterfaceOptions">
<button @click="showingUi = !showingUi">
<Icon
:icon="
showingUi
? 'solar:window-frame-line-duotone'
: 'solar:window-frame-bold-duotone'
"
/>
{{ t(showingUi ? 'app.hideInterface' : 'app.showInterface') }}
</button>
<a href="https://ko-fi.com/s/b635cf0ef1" target="_blank">
<button>
<Icon icon="solar:bag-heart-line-duotone" />
{{ t('app.getWalls') }}
</button>
</a>
</HStack>
<NuxtPage v-if="showingUi" />
<div class="progBlurContainer">
<ProgressiveBlur class="progBlur" :blur="18" :border-radius="0" />
<div class="progMask" />
</div>
<img
class="siteBackground"
:src="`/backgrounds/${currentBackground}.svg`"
alt="Background"
aria-hidden="true"
loading="lazy"
:class="{
fadeInBackground: fadingIn,
fadeOutBackground: fadingOut,
dimmed: showingUi,
}"
/>
<Navbar v-if="showingUi" />
<TransitionElement ref="cover" />
<CursorParticles />
<Modal v-if="showDomainTip">
<h1>{{ t('app.oldDomain.title') }}</h1>
<p>{{ t('app.oldDomain.desc') }}</p>
<Spacer />
<HStack class="autoSpace fullWidth">
<HStack>
<button @click="neverShowDomainTip">
{{ t('app.oldDomain.never') }}
</button>
<button @click="showDomainTip = false">
{{ t('app.oldDomain.later') }}
</button>
</HStack>
<a :href="redirectLink">
<button id="goToNewUrlButton" class="prominent">
{{ t('app.oldDomain.go') }}
</button>
</a>
</HStack>
</Modal>
<Modal plain v-if="showLangPicker">
<LangPickerCard @set="hideLangPicker" />
</Modal>
</template>
<style scoped lang="sass">
@use "@/styles/colors"
$blurHeight: 9rem
$blurTop: calc(100vh - $blurHeight)
$blurTop: calc(100dvh - $blurHeight)
html
--backgroundOpacity: 1
.dimmed
--backgroundOpacity: 0.25
html[lang="ca-ES"]
--backgroundOpacity: 0.5
$backgroundOpacity: var(--backgroundOpacity)
.progBlurContainer
position: fixed
height: $blurHeight
bottom: 0 !important
left: 0
right: 0
z-index: 9
pointer-events: none
border-radius: 0
.progBlur, .progMask
top: 0
bottom: 0
left: 0
right: 0
width: 100%
height: 100%
.progBlur
z-index: 10
.progMask
background: linear-gradient(to top, colors.$backgroundColor, transparent)
opacity: 0.6
.interfaceOptions
margin-top: 1rem
width: calc(100vw - 2rem)
max-width: 30rem
z-index: 11
button, a
flex-grow: 1
.siteBackground
position: fixed
top: 50%
left: 50%
transform: translate(-50%, -50%)
min-width: 100%
min-height: 100%
z-index: 0
pointer-events: none
opacity: $backgroundOpacity
transition: opacity 0.2s ease
// Background animations
.fadeOutBackground
animation: fadeOutBackground 0.5s forwards ease
@keyframes fadeOutBackground
0%
opacity: $backgroundOpacity
100%
opacity: 0
.fadeInBackground
animation: fadeInBackground 0.5s forwards ease
@keyframes fadeInBackground
0%
opacity: 0
100%
opacity: $backgroundOpacity
</style>