Skip to content

Commit 073e377

Browse files
committed
🐛 Fix static choice for random quote
1 parent bdd3043 commit 073e377

File tree

2 files changed

+42
-29
lines changed

2 files changed

+42
-29
lines changed

src/routes/404/+page.svelte

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,7 @@
11
<script lang="ts">
2-
export const flavorQuotes = [
3-
`Uh oh!`,
4-
`Time to fire up the ol' debugger!`,
5-
`Your item displays are sad 🥺`,
6-
`Skill Issue.`,
7-
`Should'a seen that one comming...`,
8-
`Snaviewavie did an oopsie poopsie x3`,
9-
`We to a little trolling.`,
10-
`execute run execute run execute run execute run say This is fine.`,
11-
`This is why we can't have nice things. :(`,
12-
`Have you tried turning it off and on again?`,
13-
`What if I put my command block next to yours? Haha just kidding... Unless?`,
14-
`If at first you don't succeed, try, try again!`,
15-
// We do a little trolling in binary.
16-
`B:01010111 01100101 00100000 01100100 01101111 00100000 01100001 00100000 01101100 01101001 01110100 01110100 01101100 01100101 00100000 01110100 01110010 01101111 01101100 01101100 01101001 01101110 01100111`,
17-
`I've decided to stop working for today. Try again tomorrow!`,
18-
`Every time you see this error message, a developer vanishes in a puff of binary.`,
19-
`"Flavor Text"? I've never tasted text before...`,
20-
`( ͡° ͜ʖ ͡°) nice 404 page you got there.`,
21-
`Some day you'll learn. But until then, I control the cheese.`,
22-
`Please deposit 5 coins!`,
23-
`Failed to find global 'pandemic'.`,
24-
`I'm sorry, Dave. I'm afraid I can't do that.`,
25-
`<a href="https://xkcd.com/221/"><img src="https://imgs.xkcd.com/comics/random_number.png" alt="https://xkcd.com/221/"/></a>`
26-
]
2+
import { page } from '$app/stores'
273
28-
function getRandomFlavorQuote() {
29-
return flavorQuotes[Math.floor(Math.random() * flavorQuotes.length)]
30-
}
4+
const flavorQuote = $page.data.flavorQuote as string
315
</script>
326

337
<div class="page">
@@ -43,7 +17,7 @@
4317
</p>
4418
</div>
4519
</div>
46-
<q class="quote"><span>{@html getRandomFlavorQuote()}</span></q>
20+
<q class="quote"><span>{@html flavorQuote}</span></q>
4721
</div>
4822
</div>
4923

src/routes/404/+page.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import type { PageLoad } from './$types'
2+
3+
export const ssr = false
4+
5+
const flavorQuotes = [
6+
`Uh oh!`,
7+
`Time to fire up the ol' debugger!`,
8+
`Your item displays are sad 🥺`,
9+
`Skill Issue.`,
10+
`Should'a seen that one comming...`,
11+
`Snaviewavie did an oopsie poopsie x3`,
12+
`We to a little trolling.`,
13+
`execute run execute run execute run execute run say This is fine.`,
14+
`This is why we can't have nice things. :(`,
15+
`Have you tried turning it off and on again?`,
16+
`What if I put my command block next to yours? Haha just kidding... Unless?`,
17+
`If at first you don't succeed, try, try again!`,
18+
// We do a little trolling in binary.
19+
`B:01010111 01100101 00100000 01100100 01101111 00100000 01100001 00100000 01101100 01101001 01110100 01110100 01101100 01100101 00100000 01110100 01110010 01101111 01101100 01101100 01101001 01101110 01100111`,
20+
`I've decided to stop working for today. Try again tomorrow!`,
21+
`Every time you see this error message, a developer vanishes in a puff of binary.`,
22+
`"Flavor Text"? I've never tasted text before...`,
23+
`( ͡° ͜ʖ ͡°) nice 404 page you got there.`,
24+
`Some day you'll learn. But until then, I control the cheese.`,
25+
`Please deposit 5 coins!`,
26+
`Failed to find global 'pandemic'.`,
27+
`I'm sorry, Dave. I'm afraid I can't do that.`,
28+
`<a href="https://xkcd.com/221/"><img src="https://imgs.xkcd.com/comics/random_number.png" alt="https://xkcd.com/221/"/></a>`
29+
]
30+
31+
function getRandomFlavorQuote() {
32+
return flavorQuotes[Math.floor(Math.random() * flavorQuotes.length)]
33+
}
34+
35+
export const load: PageLoad = () => {
36+
return {
37+
flavorQuote: getRandomFlavorQuote()
38+
}
39+
}

0 commit comments

Comments
 (0)