also remove video from the dom
This commit is contained in:
@@ -422,14 +422,16 @@ App.feed = App.feed || {};
|
|||||||
if (r < 0) return;
|
if (r < 0) return;
|
||||||
const prevActive = state.feedActiveIndex;
|
const prevActive = state.feedActiveIndex;
|
||||||
|
|
||||||
|
// Drop the failed clip's feed slide element from the DOM, then its JSON
|
||||||
|
// from the queue, then re-key the remaining rendered slides.
|
||||||
removeSlide(r);
|
removeSlide(r);
|
||||||
videos.splice(r, 1);
|
videos.splice(r, 1);
|
||||||
reindexAfterRemoval(r);
|
reindexAfterRemoval(r);
|
||||||
|
|
||||||
// Keep the grid's parallel index-based virtualization in sync with the
|
// Remove the failed clip's grid card element from the DOM too (the grid
|
||||||
// now-shorter queue.
|
// shares the queue) and re-pack the remaining cards.
|
||||||
if (App.virtualGrid && typeof App.virtualGrid.relayout === 'function') {
|
if (App.virtualGrid && typeof App.virtualGrid.removeVideo === 'function') {
|
||||||
App.virtualGrid.relayout();
|
App.virtualGrid.removeVideo(videoId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (videos.length === 0) {
|
if (videos.length === 0) {
|
||||||
|
|||||||
@@ -814,7 +814,19 @@ App.videos = App.videos || {};
|
|||||||
if (el) { el.innerHTML = ''; el.style.height = '0px'; }
|
if (el) { el.innerHTML = ''; el.style.height = '0px'; }
|
||||||
};
|
};
|
||||||
|
|
||||||
return { ensureInit, packFrom, update: scheduleUpdate, relayout, reset };
|
// Removes a single video's card from the grid: its DOM element is
|
||||||
|
// unmounted directly (so it's gone even if the re-pack below can't run),
|
||||||
|
// then the remaining cards are re-packed against the now-shorter queue.
|
||||||
|
// The caller must have already removed the video from state.loadedVideos.
|
||||||
|
const removeVideo = function(videoId) {
|
||||||
|
const id = String(videoId);
|
||||||
|
mounted.forEach((card, i) => {
|
||||||
|
if (card.dataset.videoId === id) unmount(i);
|
||||||
|
});
|
||||||
|
relayout();
|
||||||
|
};
|
||||||
|
|
||||||
|
return { ensureInit, packFrom, update: scheduleUpdate, relayout, removeVideo, reset };
|
||||||
})();
|
})();
|
||||||
|
|
||||||
App.videos.updateLoadMoreState = function() {
|
App.videos.updateLoadMoreState = function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user