From 8619472986189e39046ce600b73a48021a2c3121 Mon Sep 17 00:00:00 2001 From: serr Date: Sat, 17 May 2025 21:31:56 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D1=80=D0=B0=D1=89=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=B7?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B9,=20?= =?UTF-8?q?=D0=BF=D0=BE=D1=84=D0=B8=D0=BA=D1=81=D0=B8=D0=BB=20index=20out?= =?UTF-8?q?=20of=20range=20=D0=B2=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B8=20=D1=82=D1=80=D0=B5=D0=BA=D0=BE=D0=B2=20?= =?UTF-8?q?=D1=81=20lastfm,=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=BE=D1=82=D0=BA=D1=80=D1=8B=D0=B2=D0=B0=D1=8E=D1=89=D0=B8?= =?UTF-8?q?=D0=B9=D1=81=D1=8F=20=D0=BF=D0=BE=20=D0=BD=D0=B0=D0=B6=D0=B0?= =?UTF-8?q?=D1=82=D0=B8=D1=8E=20=D0=B1=D0=BB=D0=BE=D0=BA=20=D1=81=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8=D1=82=D0=B5=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9=20=D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC=D0=BD?= =?UTF-8?q?=D0=BE=D0=B9=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/styles.css | 29 +++++++++++++++++++++++++++-- mvc/controllers/lastfm.go | 8 +++++++- mvc/views/blocks/footer.gohtml | 18 ++++++++++++++---- mvc/views/blocks/header.gohtml | 17 +++++------------ 4 files changed, 53 insertions(+), 19 deletions(-) diff --git a/assets/css/styles.css b/assets/css/styles.css index 30a2da9..8f99159 100644 --- a/assets/css/styles.css +++ b/assets/css/styles.css @@ -75,11 +75,36 @@ pre { min-width: calc(100% - 20px); } -.lastfm-container { +details > summary { + cursor: zoom-in; +} + +details[open] > summary { + cursor: zoom-out; +} + +.rotating-pic-container { + width: 100%; + height: 100%; + overflow: hidden; +} + +.rotating-pic { + width: 100%; + height: 100%; + animation: swing 1.5s ease-in-out infinite alternate; +} + +@keyframes swing { + 0% { transform: rotate(-10deg); } + 100% { transform: rotate(10deg); } +} + +.pulse-container { text-align: center; } -.lastfm-text { +.pulse-text { font-weight: bold; color: purple; animation: scalePulse 2s infinite ease-in-out; diff --git a/mvc/controllers/lastfm.go b/mvc/controllers/lastfm.go index e0651c8..ac0e84b 100644 --- a/mvc/controllers/lastfm.go +++ b/mvc/controllers/lastfm.go @@ -17,7 +17,13 @@ func LastfmHandler(app *models.App) http.HandlerFunc { log.Println(err) } - data := fmt.Sprintf("%s - %s", resp.RecentTracks.Track[0].Name, resp.RecentTracks.Track[0].Artist.Name) + var data string + if len(resp.RecentTracks.Track) > 0 { + track := resp.RecentTracks.Track[0] + data = fmt.Sprintf("%s - %s", track.Name, track.Artist.Name) + } else { + data = "lastfm strange error..." + } sendLastfm(w, data) }) diff --git a/mvc/views/blocks/footer.gohtml b/mvc/views/blocks/footer.gohtml index 1b8130a..a54238c 100644 --- a/mvc/views/blocks/footer.gohtml +++ b/mvc/views/blocks/footer.gohtml @@ -1,7 +1,7 @@ {{ define "footer" }}