From ee77dc16ebebcbf01a826addc129e76c0ab4bdc2 Mon Sep 17 00:00:00 2001 From: "jill \"oatmealine\" monoids" Date: Tue, 19 Oct 2021 15:34:08 +0000 Subject: [PATCH] more fixes --- public/index.html | 4 ++++ src/index.js | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index f74ac27..cb0582a 100644 --- a/public/index.html +++ b/public/index.html @@ -34,6 +34,7 @@ const search = document.getElementById('album-search'); search.setAttribute('placeholder', placeholders[Math.floor(Math.random() * placeholders.length)]); search.addEventListener('change', async (e) => { + if (e.target.value === '') return document.getElementById('albums').innerHTML = ''; document.getElementById('progress-album').innerHTML = ''; document.getElementById('progress-bar-wrapper').innerHTML = ''; document.getElementById('albums').innerHTML = '
'; @@ -42,6 +43,9 @@ document.getElementById('albums').innerHTML = d.data.map(d => `
${d.title}
by ${d.artist.name}
` ).join('
\n'); + + if (d.data.length === 0) return document.getElementById('albums').innerHTML = 'Not found!'; + for (c of document.getElementById('albums').children) { if (c.children[5]) { let id = c.id.split('-')[1]; diff --git a/src/index.js b/src/index.js index 8643944..bb81b57 100644 --- a/src/index.js +++ b/src/index.js @@ -25,8 +25,7 @@ app.get('/api/search', async (req, res) => { if (!req.query.search) return res.sendStatus(400); let s = await deezerInstance.api.search_album(req.query.search, { - strict: true, - limit: 7, + limit: 15, }); let format = s.data.map(s => {