Fix a couple JavaScript errors

This commit is contained in:
Sijmen 2024-01-06 01:30:53 +01:00
parent 31a2719ca2
commit d1fd1da54b
Signed by: vijfhoek
GPG key ID: DAF7821E067D9C48

View file

@ -30,15 +30,15 @@
</ul>
<script>
htmx.onLoad(() => {
const scrollCurrentSongIntoView = () => {
const hoveredSong = document.querySelector(".queue li:hover");
if (hoveredSong === null) {
const currentSong = document.querySelector(".queue li.playing");
currentSong.scrollIntoView({ block: "nearest" });
currentSong?.scrollIntoView({ block: "nearest" });
}
}
htmx.onLoad(() => {
const isReduced = window
.matchMedia("(prefers-reduced-motion: reduce)")
.matches;