Fix linting issues.
This commit is contained in:
parent
774e1411bb
commit
6e1a953d63
|
@ -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}`, {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
const result = await window.fetch(
|
||||
`https://coverartarchive.org/release/${releaseMbid}`,
|
||||
{
|
||||
headers: {
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@use 'mixins';
|
||||
@use "mixins";
|
||||
|
||||
.listenbrainz {
|
||||
align-items: center;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@use 'mixins';
|
||||
@use "mixins";
|
||||
|
||||
.page-footer {
|
||||
@include mixins.responsive-container;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@use 'mixins';
|
||||
@use "mixins";
|
||||
|
||||
.page-header {
|
||||
--anchor-color: #000;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -1 +1 @@
|
|||
@use '../../node_modules/modern-normalize/modern-normalize.css';
|
||||
@use "../../node_modules/modern-normalize/modern-normalize.css";
|
||||
|
|
Loading…
Reference in New Issue