Skip to content

Commit

Permalink
doc title
Browse files Browse the repository at this point in the history
  • Loading branch information
michealparks committed Jan 11, 2025
1 parent 8f71d28 commit f79a7aa
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
37 changes: 37 additions & 0 deletions src/lib/hooks/title.svelte.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export const useDocumentTitle = () => {
$effect(() => {
let pattern = 0

const emptyTitle = '_______________'.split('')
const title1 = '_____zesty_____'.split('')
const title2 = '____p_l_u_s____'.split('')

const pattern1 = () => {
const last = title1.pop()
title1.unshift(last!)
document.title = title1.join('')
}

const pattern2 = () => {
document.title =
document.title === emptyTitle.join('')
? title2.join('')
: emptyTitle.join('')
}

const patterns = [pattern1, pattern2]

const id1 = setInterval(() => {
patterns[pattern]()
}, 300)

const id2 = setInterval(() => {
pattern = pattern === 0 ? 1 : 0
}, 2000)

return () => {
clearInterval(id1)
clearInterval(id2)
}
})
}
3 changes: 3 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
import { preload } from '$lib/preload'
import { Keybindings, useKeybinding } from '$lib/hooks/keybindings.svelte'
import { useDocumentTitle } from '$lib/hooks/title.svelte'
let { children } = $props()
$effect(() => preload())
useKeybinding(Keybindings.Fullscreen, () => document.body.requestFullscreen())
useDocumentTitle()
</script>

{@render children()}
13 changes: 12 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,18 @@
background-size: cover;
"
>
<Logo class="w-[40%]" />
<div class="relative w-[40%]">
<img
alt=""
src="zesty.png"
/>
<img
alt=""
class="absolute bottom-0 right-0 -mr-8 w-[40%]"
src="plus.png"
/>
</div>

<div
class="flex flex-col gap-4 px-12 py-4 text-xs text-white opacity-80 sm:flex-row sm:gap-12 md:text-sm"
>
Expand Down
Binary file modified static/plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f79a7aa

Please sign in to comment.