A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
chore: revert download placeholder and action
Christian Feiee44fdaf8594
diff --git a/client/components/video-element.js b/client/components/video-element.jsindex 9a0aba2..6d0bd12 100644--- a/client/components/video-element.js+++ b/client/components/video-element.js@@ -53,7 +53,7 @@ class VideoElement extends HTMLElement {this.innerHTML = /*html*/`${this.video.downloaded? /*html*/`<div class="play video-placeholder" style="background-image: url(${this.video.thumbnail})"><div class="play-icon"></div></div>`- : /*html*/`<div class="download video-placeholder" style="background-image: url(${this.video.thumbnail})"><div class="download-icon"></div></div>`}+ : /*html*/`<img loading="lazy" src="${this.video.thumbnail}"/>`}<span class="action ignore" tabindex="0">ignore</span><div class="info"><span class="channel-name">${this.video.channelName}</span>@@ -85,7 +85,6 @@ class VideoElement extends HTMLElement {handleClickAddListener(this.querySelector('.action.ignore'), this.toggleIgnoreVideoHandler.bind(this))handleClickAddListener(this.querySelector('.channel-name'), this.filterByChannelHandler.bind(this))handleClickAddListener(this.querySelector('.play.video-placeholder'), this.watchVideoHandler.bind(this))- handleClickAddListener(this.querySelector('.download.video-placeholder'), this.downloadVideoHandler.bind(this))}unregisterEvents () {handleClickRemoveListener(this.querySelector('.action.download'), this.downloadVideoHandler.bind(this))@@ -95,7 +94,6 @@ class VideoElement extends HTMLElement {handleClickRemoveListener(this.querySelector('.action.ignore'), this.toggleIgnoreVideoHandler.bind(this))handleClickRemoveListener(this.querySelector('.channel-name'), this.filterByChannelHandler.bind(this))handleClickRemoveListener(this.querySelector('.play.video-placeholder'), this.watchVideoHandler.bind(this))- handleClickRemoveListener(this.querySelector('.download.video-placeholder'), this.downloadVideoHandler.bind(this))this.querySelector('video') && this.unregisterVideoEvents(this.querySelector('video'))}watchVideoHandler (event) {@@ -120,11 +118,8 @@ class VideoElement extends HTMLElement {event.preventDefault()const downloadStartedText = '⚡️ Download started'- let $downloadButton = event.target.classList.contains('.action') ? event.target : this.querySelector('.action.download')- if ($downloadButton.innerText === downloadStartedText) return console.log('already downloading')- else $downloadButton.innerText = downloadStartedText-- this.classList.add('downloading')+ if (event.target.innerText === downloadStartedText) return console.log('already downloading')+ event.target.innerText = downloadStartedTextfetch('/api/download-video', {method: 'POST',@@ -145,7 +140,6 @@ class VideoElement extends HTMLElement {.then(() => {console.log('Video deleted')this.video.downloaded = false- this.classList.remove('downloading')this.render()}).catch((error) => console.error('Error deleting video:', error))diff --git a/client/main.css b/client/main.cssindex a296941..c06854e 100644--- a/client/main.css+++ b/client/main.css@@ -130,14 +130,11 @@ input[type="text"], input[type="url"], input[type="search"] {.video {position: relative;width: 400px;- /* max-height: 300px; */text-align: left;text-decoration: none;font-weight: bold;padding: 5px;align-self: flex-start;- /* color: black; */- /* background-color: #f0f0f0; */margin: 5px;user-select: none;-webkit-user-select: none;@@ -149,7 +146,8 @@ input[type="text"], input[type="url"], input[type="search"] {z-index: 1000;background-color: #f0f0f0;color: black;- padding: 0.5rem;+ font-size: 0.8rem;+ padding: 0.75rem 1.5rem;cursor: pointer;}.video .title {@@ -239,55 +237,6 @@ video-element, video-element video {border-left: 30px solid rgb(255, 255, 255);}-.download-icon {- position: relative;- width: 0;- height: 0;- border-left: 20px solid transparent;- border-right: 20px solid transparent;- border-top: 30px solid rgb(0, 0, 0);- z-index: 100;-}-.download-icon::after {- z-index: 98;- position: absolute;- top: -28px;- left: -26px;- content: "";- width: 0;- height: 0;- border-left: 20px solid transparent;- border-right: 20px solid transparent;- border-top: 30px solid rgb(255, 255, 255);-}-.download-icon::before {- z-index: 98;- position: absolute;- top: -49px;- left: -12px;- content: "";- width: 12px;- height: 32px;- background-color: rgb(255, 255, 255);-}--.downloading .download-icon {- /*wiggle up and down animation*/- animation: wiggle 2s infinite ease-in-out;-}-@keyframes wiggle {- 0% { transform: translateY(0px); }- 50% { transform: translateY(-10px); }- 100% { transform: translateY(0px); }-}--------