more fixes

This commit is contained in:
Jill 2021-10-19 15:34:08 +00:00
parent bec27010d2
commit ee77dc16eb
2 changed files with 5 additions and 2 deletions

View File

@ -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 = '<div class="lds-ring"><div></div><div></div><div></div><div></div></div>';
@ -42,6 +43,9 @@
document.getElementById('albums').innerHTML = d.data.map(d =>
`<div class="album" id="album-${d.id}"><span class="album-image-wrapper"><img class="album-image" width="128" height="128" src="https://e-cdns-images.dzcdn.net/images/cover/${d.cover}/128x128-000000-80-0-0.jpg"></span><span class="big">${d.title}</span><br><span class="small">by ${d.artist.name}</span><br><img class="album-download" width="48" height="48" src="https://img.icons8.com/material-sharp/48/000000/download--v1.png"></div>`
).join('<br>\n');
if (d.data.length === 0) return document.getElementById('albums').innerHTML = '<span class="small">Not found!</span>';
for (c of document.getElementById('albums').children) {
if (c.children[5]) {
let id = c.id.split('-')[1];

View File

@ -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 => {