A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
more lightweight, play icon
Christian Feia170d1904f4f
diff --git a/client/components/video-element.js b/client/components/video-element.jsindex 7698b82..6232de8 100644--- a/client/components/video-element.js+++ b/client/components/video-element.js@@ -45,13 +45,7 @@ class VideoElement extends HTMLElement {else this.dataset['downloaded'] = "false"this.innerHTML = /*html*/`${this.video.downloaded- ? /*html*/`<video controls width="280">- <source src="/videos/${this.video.id}" type="video/mp4" />- <p>- Your browser does not support the video tag.- Download the video instead <a href="/videos/${this.video.id}" target="_blank">here</a>- </p>- </video>`+ ? /*html*/`<div class="play-video-placeholder" style="background-image: url(${this.video.thumbnail})"><div class="play-icon"></div></div>`: /*html*/`<img loading="lazy" src="${this.video.thumbnail}"/>`}<span class="action ignore" tabindex="0">ignore</span><div class="info">@@ -81,7 +75,8 @@ class VideoElement extends HTMLElement {handleClickAddListener(this.querySelector('.action.show-summary'), this.showSummaryHandler.bind(this))handleClickAddListener(this.querySelector('.action.ignore'), this.ignoreVideoHandler.bind(this))handleClickAddListener(this.querySelector('.channel-name'), this.filterByChannelHandler.bind(this))- handleDoubleClick(this.querySelector('img'), this.ignoreVideoHandler.bind(this))+ handleClickAddListener(this.querySelector('.play-video-placeholder'), this.watchVideoHandler.bind(this))+ // handleDoubleClick(this.querySelector('img'), this.ignoreVideoHandler.bind(this))this.querySelector('video') && this.registerVideoEvents(this.querySelector('video'))}unregisterEvents () {@@ -92,6 +87,16 @@ class VideoElement extends HTMLElement {handleClickRemoveListener(this.querySelector('.channel-name'), this.filterByChannelHandler.bind(this))this.querySelector('video') && this.unregisterVideoEvents(this.querySelector('video'))}+ watchVideoHandler (event) {+ event.preventDefault()+ this.querySelector('.play-video-placeholder').outerHTML = /*html*/`<video controls width="280">+ <source src="/videos/${this.video.id}" type="video/mp4" />+ <p>+ Your browser does not support the video tag.+ Download the video instead <a href="/videos/${this.video.id}" target="_blank">here</a>+ </p>+ </video>`+ }downloadVideoHandler (event) {event.preventDefault()const downloadStartedText = '⚡️ Download started'diff --git a/client/main.css b/client/main.cssindex a10c7b4..38f1920 100644--- a/client/main.css+++ b/client/main.css@@ -248,6 +248,34 @@ details {background-color: #e2ffd8;}+.play-video-placeholder {+ height: 157px;+ background-color: #ceaf80;+ display: flex;+ align-items: center;+ justify-content: center;+}+.play-icon {+ position: relative;+ width: 0;+ height: 0;+ border-top: 20px solid transparent;+ border-bottom: 20px solid transparent;+ border-left: 30px solid rgb(0, 0, 0);+ z-index: 100;+}+.play-icon::after {+ z-index: 98;+ position: absolute;+ top: -22px;+ left: -32px;+ content: "";+ width: 0;+ height: 0;+ border-top: 20px solid transparent;+ border-bottom: 20px solid transparent;+ border-left: 30px solid rgb(255, 255, 255);+}.show-downloaded-videos [data-downloaded="false"] {display: none;}