From 48727b60e7a0751de56b956868d6d4359fa93aa4 Mon Sep 17 00:00:00 2001 From: dusk Date: Thu, 16 Jan 2025 14:56:10 +0300 Subject: [PATCH] feat: add new blinkies, make getting the same blinkie more rare --- src/routes/+layout.svelte | 4 ++-- src/routes/+page.server.ts | 14 +++++++++++--- static/banners/19.gif | Bin 0 -> 2205 bytes static/banners/20.gif | Bin 0 -> 1253 bytes 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 static/banners/19.gif create mode 100644 static/banners/20.gif diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index b0ca83b..848156b 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -171,8 +171,8 @@

- total visits = {data.visitCount.toString().padStart(9, "0")} - uniq recent visits = {data.lastVisitors.size.toString().padStart(3, "0")} + total visits = {data.visitCount.toString().padStart(9, ".")} + uniq recent visits = {data.lastVisitors.size.toString().padStart(3, ".")}

diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index 8644260..7f0c474 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -4,10 +4,18 @@ import { steamGetNowPlaying } from "$lib/steam" export const load = async ({}) => { const lastTrack = await lastFmGetNowPlaying() const lastGame = await steamGetNowPlaying() - const banners = [getBannerNo(), getBannerNo(), getBannerNo()] + let banners: number[] = [] + while (banners.length < 3) { + const no = getBannerNo(banners) + banners.push(no) + } return {banners, lastTrack, lastGame} } -const getBannerNo = () => { - return Math.floor(Math.random() * 18) + 1; +const getBannerNo = (others: number[]) => { + const no = Math.floor(Math.random() * 20) + 1 + if (others.includes(no)) { + return ((no + (Math.floor(Math.random() * 20))) % 20) + 1 + } + return no }; \ No newline at end of file diff --git a/static/banners/19.gif b/static/banners/19.gif new file mode 100644 index 0000000000000000000000000000000000000000..686865014c76249801c84558dd0f03f9c3677e07 GIT binary patch literal 2205 zcmZ?wbhEHboW>x+@QsO~-D~^*vbF#J|NmFE_IK&p7rE;`6s+44wfWzM^B230b$D-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