1
Fork 0

Fix linting issues.

This commit is contained in:
Bauke 2023-01-09 16:09:00 +01:00
parent 774e1411bb
commit 6e1a953d63
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
7 changed files with 35 additions and 24 deletions

View File

@ -1,4 +1,6 @@
window.addEventListener('DOMContentLoaded', async () => {
/* global document window */
window.addEventListener("DOMContentLoaded", async () => {
const loop = async () => {
const listen = await getCurrentListen();
if (listen === undefined) {
@ -26,11 +28,14 @@ async function getCoverArt(listen) {
return;
}
const result = await window.fetch(`https://coverartarchive.org/release/${releaseMbid}`, {
const result = await window.fetch(
`https://coverartarchive.org/release/${releaseMbid}`,
{
headers: {
Accept: 'application/json',
Accept: "application/json",
},
});
},
);
if (!result.ok) {
return;
}
@ -41,11 +46,15 @@ async function getCoverArt(listen) {
}
const thumbnails = data.images[0].thumbnails;
return thumbnails.small ?? thumbnails['250'] ?? thumbnails['500'] ?? undefined;
return (
thumbnails.small ?? thumbnails["250"] ?? thumbnails["500"] ?? undefined
);
}
async function getCurrentListen() {
const result = await window.fetch('https://api.listenbrainz.org/1/user/BaukeXYZ/playing-now');
const result = await window.fetch(
"https://api.listenbrainz.org/1/user/BaukeXYZ/playing-now",
);
if (!result.ok) {
console.warn(result.status);
return;
@ -64,16 +73,16 @@ function insertHtml(listen, image) {
return;
}
const existing = document.querySelector('.listenbrainz') ?? undefined;
const existing = document.querySelector(".listenbrainz") ?? undefined;
if (existing !== undefined) {
existing.remove();
}
const text = `${listen.track_metadata.artist_name} - ${listen.track_metadata.track_name}`;
const alt = image === undefined ? 'ListenBrainz Logo' : `${text} Cover Art`;
const alt = image === undefined ? "ListenBrainz Logo" : `${text} Cover Art`;
image = image ?? 'https://listenbrainz.org/static/img/logo_big.svg';
image = image.startsWith('http://') ? 'https' + image.slice(4) : image;
image = image ?? "https://listenbrainz.org/static/img/logo_big.svg";
image = image.startsWith("http://") ? "https" + image.slice(4) : image;
const listenHtml = `
<p class="listenbrainz">
@ -84,5 +93,7 @@ function insertHtml(listen, image) {
</a>
</p>`;
document.querySelector('.page-header').insertAdjacentHTML('beforeend', listenHtml);
document
.querySelector(".page-header")
.insertAdjacentHTML("beforeend", listenHtml);
}

View File

@ -1,4 +1,4 @@
@use 'mixins';
@use "mixins";
.listenbrainz {
align-items: center;

View File

@ -1,4 +1,4 @@
@use 'mixins';
@use "mixins";
.page-footer {
@include mixins.responsive-container;

View File

@ -1,4 +1,4 @@
@use 'mixins';
@use "mixins";
.page-header {
--anchor-color: #000;

View File

@ -1,4 +1,4 @@
@use 'mixins';
@use "mixins";
.page-main {
a {
@ -14,7 +14,7 @@
}
&.driftingnebula {
background: url('/assets/driftingnebula 2022-03-09.jpeg');
background: url("/assets/driftingnebula 2022-03-09.jpeg");
background-position: center center;
background-repeat: no-repeat;
@ -24,7 +24,7 @@
}
&.holllo {
background: url('/assets/holllo-mark-square-pattern.png');
background: url("/assets/holllo-mark-square-pattern.png");
background-color: #1f1731;
background-repeat: repeat;
background-size: 48px;

View File

@ -1,4 +1,4 @@
@use 'reset';
@use "reset";
html {
font-size: 62.5%;
@ -43,7 +43,7 @@ button {
margin-top: 2rem;
}
@use 'components/page-footer';
@use 'components/page-header';
@use 'components/page-main';
@use 'components/listenbrainz';
@use "components/page-footer";
@use "components/page-header";
@use "components/page-main";
@use "components/listenbrainz";

View File

@ -1 +1 @@
@use '../../node_modules/modern-normalize/modern-normalize.css';
@use "../../node_modules/modern-normalize/modern-normalize.css";