diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 1f9bbb0..a5331b5 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -96,7 +96,7 @@ Zhentao Wei

- Website source code + Website source code

About Us

diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 7b2982b..ac89b7e 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -17,48 +17,114 @@ const mobileThreshold : string = '600px'; // was 1000px. zhen testing let mobile : boolean; + + import { onMount } from 'svelte'; + + // Function to set a cookie + function setCookie(name: string, value: string, days: number): void { + const date = new Date(); + date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); + document.cookie = `${name}=${value};expires=${date.toUTCString()};path=/`; + } + + // Function to get a cookie + function getCookie(name: string): string | undefined { + const value = `; ${document.cookie}`; + const parts = value.split(`; ${name}=`); + if (parts.length === 2) return parts.pop()?.split(';').shift(); + return undefined; + } + + // Store scroll position in a cookie when the user scrolls + function handleScroll(): void { + setCookie('scrollPosition', window.scrollY.toString(), 1); + } + + // Restore scroll position on mount + onMount(() => { + const scrollPosition = getCookie('scrollPosition'); + if (scrollPosition) { + window.scrollTo(0, parseInt(scrollPosition, 10)); + } + window.addEventListener('scroll', handleScroll); + + // Cleanup event listener on component unmount + return () => { + window.removeEventListener('scroll', handleScroll); + }; + }); + - - -
+ + +
Background video -
-

{@html !mobile ? "Deprived Devs" : "Deprived
Devs"}

+
+

{@html !mobile ? "Deprived Devs" : "Deprived
Devs"}

{#if mobile}
{/if}
- -
-
- -

Hi, I am Alex/Zhen, I'm that chinese guy.

-

Here's my CV: pdf

-
- -

Hi, I use Arch, btw.

-

Here's my Linked-in: Linked-in

' -
- -

Hi, I am [insert text here]

-

Here's a joke about recursion: recursion

-
-
+ + + + + +
+

+ Developers! +

+ + + +
+
+
+ +

Hi, I am Alex/Zhen, I'm that chinese guy.

+

Here's my CV: pdf

+
+ +

Hi, I use Arch, btw.

+

Here's my Linked-in: Linked-in

' +
+ +

Hi, I am [insert text here]

+

Here's a joke about recursion: recursion

+
+
+
+
+
+ + +
+
+

About us

+

We are a small group of developers and artists who started out as classmates, united by our passion for all things technology.

+
+
+
+ +