A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
chore: cleanup
Christian Fei9f234a6f3340
diff --git a/client/components/videos-container.js b/client/components/videos-container.jsindex 8e59e8b..c7c9eb5 100644--- a/client/components/videos-container.js+++ b/client/components/videos-container.js@@ -80,9 +80,7 @@ class VideosContainer extends HTMLElement {// while minimizing direct DOM manipulation for elements already in place.let nextExpectedChild = this.firstElementChild- for (let i = 0; i < newElementOrder.length; i++) {- const desiredElement = newElementOrder[i]-+ for (const desiredElement of newElementOrder) {if (nextExpectedChild === desiredElement) {// Element is already in the correct positionnextExpectedChild = nextExpectedChild.nextElementSibling@@ -94,21 +92,6 @@ class VideosContainer extends HTMLElement {}}- // Simpler Reconcile Logic for Step 4 (More robust for reordering):- // Ensure all elements from newElementOrder are children and in the correct sequence.- for (let i = 0; i < newElementOrder.length; i++) {- const desiredElement = newElementOrder[i]- const currentElementAtIndex = this.children[i]-- if (currentElementAtIndex !== desiredElement) {- // If desiredElement is already a child elsewhere, insertBefore will move it.- // If it's not a child, it will be inserted.- // If currentElementAtIndex is undefined (we're adding to the end),- // insertBefore(desired, null) acts like appendChild.- this.insertBefore(desiredElement, currentElementAtIndex || null)- }- }-// Remove any extra children at the end if newElementOrder is shorter than current childrenwhile (this.children.length > newElementOrder.length) {console.log('Removing trailing element:', this.lastElementChild.dataset.videoId)