1
0
Fork 0
mirror of https://github.com/mat-1/matdoesdev.git synced 2025-08-02 06:36:04 +00:00

stake ad on all ages and add darkreader-lock

This commit is contained in:
mat 2024-12-18 09:06:06 +00:00
parent 5ee517d806
commit 30aca9fb41
4 changed files with 10 additions and 23 deletions

View file

@ -4,6 +4,7 @@
<meta charset="utf-8" />
<link rel="icon" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="darkreader-lock" />
%sveltekit.head%
</head>

View file

@ -30,22 +30,6 @@
let stopGravity: (() => void) | null = null
// stake-ad.png easter egg
let showStakeAd = false
if (browser) {
showStakeAd = getShowStakeAdFromUrl()
if (showStakeAd) {
;(async () => {
const stakeAd = await import('./stake-ad')
stakeAd.load()
})()
}
}
function getShowStakeAdFromUrl() {
return new URLSearchParams(location.search).has('stake')
}
async function onPathChange() {
// if we switched paths more than 10 times in the past 10 seconds, import $lib/gravity.js
pathChangeTimestamps.push(Date.now())
@ -67,12 +51,6 @@
}
}
}
// add ?stake if necessary
if (showStakeAd && !getShowStakeAdFromUrl()) {
// this partially breaks back/forward navigation :(
history.replaceState(null, '', '?stake')
}
}
const pageRendered = writable(false)

View file

@ -1,5 +1,13 @@
<script>
let { children } = $props();
import { browser } from '$app/environment'
let { children } = $props()
if (browser) {
// stake-ad.png easter egg
if (new URLSearchParams(location.search).has('stake'))
import('$lib/stake-ad').then((s) => s.load())
}
</script>
{@render children?.()}