A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
chore: remove video-filters
Christian Fei94a8f0d4bf9d
diff --git a/client/components/video-filters.js b/client/components/video-filters.jsdeleted file mode 100644index b1708b2..0000000--- a/client/components/video-filters.js+++ /dev/null@@ -1,44 +0,0 @@-class VideoFilters extends HTMLElement {- constructor () {- super()- }- connectedCallback () {- this.render()- this.registerEvents()- }- disconnectedCallback () {- this.unregisterEvents()- }- registerEvents () {- this.querySelector('#show-downloaded-videos').addEventListener('click', this.handleDownloadedVideos.bind(this))- this.querySelector('#show-summarized-videos').addEventListener('click', this.handleSummarizedVideos.bind(this))- this.querySelector('#show-ignored-videos').addEventListener('click', this.handleIgnoredVideos.bind(this))- }- unregisterEvents () {- this.querySelector('#show-downloaded-videos').removeEventListener('click', this.handleDownloadedVideos.bind(this))- this.querySelector('#show-summarized-videos').removeEventListener('click', this.handleSummarizedVideos.bind(this))- this.querySelector('#show-ignored-videos').removeEventListener('click', this.handleIgnoredVideos.bind(this))- }- render () {- this.innerHTML = /*html*/`- <div id="filters-container" class="flex space-around p-1">- <button id="show-downloaded-videos">Downloaded videos</button>- <button id="show-summarized-videos">Summarized videos</button>- <button id="show-ignored-videos">Ignored videos</button>- </div>- `- }- handleDownloadedVideos(event) {- event.target.classList.toggle('active')- document.body.classList.toggle('show-downloaded-videos')- }- handleSummarizedVideos(event) {- event.target.classList.toggle('active')- document.body.classList.toggle('show-summarized-videos')- }- handleIgnoredVideos(event) {- event.target.classList.toggle('active')- document.body.classList.toggle('show-ignored-videos')- }-}-customElements.define('video-filters', VideoFilters)diff --git a/client/index.html b/client/index.htmlindex 7dddecb..3654124 100644--- a/client/index.html+++ b/client/index.html@@ -35,7 +35,6 @@<template id="main-template"><channels-list></channels-list><div id="filter-results-status"></div>- <video-filters></video-filters><div class="main-videos-container"></div><empty-state style="display:none"></empty-state></template>@@ -91,7 +90,6 @@<script type="module" src="/lib/utils.js"></script><script type="module" src="/components/empty-state.js"></script>- <script type="module" src="/components/video-filters.js"></script><script type="module" src="/components/search-videos.js"></script><script type="module" src="/components/channels-list.js"></script><script type="module" src="/components/video-element.js"></script>diff --git a/client/lib/router.js b/client/lib/router.jsindex c5c82f6..714ed3c 100644--- a/client/lib/router.js+++ b/client/lib/router.js@@ -9,10 +9,8 @@ const routes = {console.log('videos.length', videos.length)if (videos.length === 0) {document.querySelector('empty-state').style.display = ''- document.querySelector('video-filters').style.display = 'none'} else {document.querySelector('empty-state').style.display = 'none'- document.querySelector('video-filters').style.display = ''}document.querySelector('search-videos #search').removeAttribute('disabled', 'disabled')diff --git a/lib/server.js b/lib/server.jsindex 9ff5ed6..e392e47 100644--- a/lib/server.js+++ b/lib/server.js@@ -98,8 +98,6 @@ export function createServer ({repo, connections = [], updateVideos = true} = {}return fileHandler('client/components/channels-list.js', 'application/javascript')(req, res)if (url.pathname === '/components/empty-state.js')return fileHandler('client/components/empty-state.js', 'application/javascript')(req, res)- if (url.pathname === '/components/video-filters.js')- return fileHandler('client/components/video-filters.js', 'application/javascript')(req, res)return fileHandler('client/index.html', 'text/html')(req, res)} catch (error) {