mirror of
https://github.com/SuperBFG7/ympd
synced 2025-01-13 19:00:37 +00:00
Fix: optimize lazy loading of coverimages
This commit is contained in:
parent
c204318fc4
commit
8058c48a38
@ -61,6 +61,7 @@ small {
|
||||
|
||||
.album-cover {
|
||||
background-size: cover;
|
||||
background-image: url("/assets/coverimage-loading.png");
|
||||
border: 1px solid black;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
|
@ -1319,7 +1319,6 @@ function parseListDBtags(obj) {
|
||||
card.classList.add('mr-0');
|
||||
card.setAttribute('id', id);
|
||||
card.setAttribute('data-album', encodeURI(obj.data[i].value));
|
||||
card.setAttribute('data-init', 'false');
|
||||
card.innerHTML = '<div class="card mb-4" id="card' + id + '">' +
|
||||
' <a href="#" class="card-img-top"></a>' +
|
||||
' <div class="card-body">' +
|
||||
@ -1399,11 +1398,9 @@ function createListTitleObserver(ele) {
|
||||
function getListTitles(changes, observer) {
|
||||
changes.forEach(change => {
|
||||
if (change.intersectionRatio > 0) {
|
||||
if (change.target.getAttribute('data-init') == 'false') {
|
||||
change.target.setAttribute('data-init', 'true');
|
||||
var album = decodeURI(change.target.getAttribute('data-album'));
|
||||
sendAPI({"cmd": "MPD_API_DATABASE_TAG_ALBUM_TITLE_LIST", "data": { "album": album, "search": app.current.search, "tag": app.current.view}}, parseListTitles);
|
||||
}
|
||||
observer.unobserve(change.target);
|
||||
var album = decodeURI(change.target.getAttribute('data-album'));
|
||||
sendAPI({"cmd": "MPD_API_DATABASE_TAG_ALBUM_TITLE_LIST", "data": { "album": album, "search": app.current.search, "tag": app.current.view}}, parseListTitles);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user