Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

chore: cleanup

Christian Fei0e60088bc688
diff --git a/client/lib/router.js b/client/lib/router.js
index 84f7e16..7be8ace 100644
--- a/client/lib/router.js
+++ b/client/lib/router.js
@@ -12,14 +12,9 @@ const routes = {
document.querySelector('search-videos #search').removeAttribute('disabled', 'disabled')
document.querySelector('search-videos').classList.remove('hide')
- // const showOriginalThumbnail = store.get(store.showOriginalThumbnailKey)
- const $videosContainer = document.querySelector('.main-videos-container')
- $videosContainer.innerHTML = ''
-
- // let videos = await fetch('/api/videos').then(res => res.json())
- // videos = videos
- // .sort((a, b) => +new Date(b.publishedAt) - +new Date(a.publishedAt))
- // videos.forEach(video => $videosContainer.appendChild(createVideoElement(video, showOriginalThumbnail)))
+ if (document.querySelector('search-videos')) {
+ document.querySelector('search-videos').searchHandler()
+ }
const channels = await fetch('/api/channels').then(res => res.json())
document.querySelector('channels-list').dataset.list = JSON.stringify(channels.map(c => c.name).filter(Boolean))
@@ -29,7 +24,7 @@ const routes = {
new MutationObserver((mutationList, observer) => {
handleEmptyState()
- }).observe($videosContainer, { attributes: false, childList: true, subtree: true })
+ }).observe(document.querySelector('.main-videos-container'), { attributes: false, childList: true, subtree: true })
applyShowThumbnails(store.get(store.showThumbnailsKey))
applyShowBigPlayer(store.get(store.showBigPlayerKey))