From 2f2046a8ae869e3950887a06e9fdd62f9f871945 Mon Sep 17 00:00:00 2001 From: Redume Date: Sun, 21 Jul 2024 21:39:29 +0300 Subject: [PATCH] Fixed the code. I did the removal of unnecessary reits, the date is no longer transmitted as a number, now as a string --- static/script/wallpaperLoad.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/script/wallpaperLoad.js b/static/script/wallpaperLoad.js index 9462bcd..31c3dfc 100644 --- a/static/script/wallpaperLoad.js +++ b/static/script/wallpaperLoad.js @@ -1,7 +1,6 @@ function load(date) { fetch(`https://api.starlio.space/wallpaper/${date}`).then(res => { res.json().then(data => { - console.log(data); if (data.length === 0) return; document.querySelector("div.wallpaper img").src = data.url; @@ -13,12 +12,13 @@ function load(date) { } function parseURL() { - const pathname = document.location.pathname + let pathname = document.location.pathname + pathname = pathname.slice(pathname.lastIndexOf('/')+1) if (isNaN(new Date(pathname).getTime())) return null; if (!isValidDate(pathname)) return null; - return Number(pathname); + return pathname; }