feat: add new blinkies, make getting the same blinkie more rare

This commit is contained in:
dusk 2025-01-16 14:56:10 +03:00
parent 2b30a0fd08
commit 48727b60e7
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw
4 changed files with 13 additions and 5 deletions

View File

@ -171,8 +171,8 @@
<Tooltip>
<svelte:fragment slot="tooltipContent">
<p class="font-monospace">
<nobr>total visits = <span class="text-ralsei-green-light text-shadow-green">{data.visitCount.toString().padStart(9, "0")}</span></nobr>
<nobr>uniq recent visits = <span class="text-ralsei-green-light text-shadow-green">{data.lastVisitors.size.toString().padStart(3, "0")}</span></nobr>
<nobr>total visits = <span class="text-ralsei-green-light text-shadow-green">{data.visitCount.toString().padStart(9, ".")}</span></nobr>
<nobr>uniq recent visits = <span class="text-ralsei-green-light text-shadow-green">{data.lastVisitors.size.toString().padStart(3, ".")}</span></nobr>
</p>
</svelte:fragment>
<div class="navbox"><p><span class="text-ralsei-green-light text-shadow-green">{recentVisitCount}</span> recent clicks</p></div>

View File

@ -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
};

BIN
static/banners/19.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
static/banners/20.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB