A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
es6 html strings
Christian Fei8ff91235a02c
diff --git a/client/components/add-channel-form.js b/client/components/add-channel-form.jsindex 97dd8f0..c0f74e3 100644--- a/client/components/add-channel-form.js+++ b/client/components/add-channel-form.js@@ -16,7 +16,7 @@ class AddChannelForm extends HTMLElement {this.querySelector('form').removeEventListener('submit', this.addChannelHandler.bind(this))}render () {- this.innerHTML = `+ this.innerHTML = /*html*/`<form id="add-channel-form"><label for="channel-name">Add a new channel</label><input type="text" id="channel-name" placeholder="Channel Name" required>diff --git a/client/components/channels-list.js b/client/components/channels-list.jsindex 9c9e3a7..6725caf 100644--- a/client/components/channels-list.js+++ b/client/components/channels-list.js@@ -34,7 +34,7 @@ class Channels extends HTMLElement {deregisterEvents () {}render () {- this.innerHTML = `+ this.innerHTML = /*html*/`<details class="channels-container"><summary>Channels</summary><div></div>diff --git a/client/components/video-element.js b/client/components/video-element.jsindex a51ec17..adaf820 100644--- a/client/components/video-element.js+++ b/client/components/video-element.js@@ -27,16 +27,16 @@ class VideoElement extends HTMLElement {if (!this.video) returnthis.classList.add('video')this.dataset['videoId'] = this.video.id- this.innerHTML = `+ this.innerHTML = /*html*/`${this.video.downloaded- ? `<video controls width="280">+ ? /*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>`- : `<img loading="lazy" src="${this.video.thumbnail}"/>`}+ : /*html*/`<img loading="lazy" src="${this.video.thumbnail}"/>`}<div class="info"><span>${this.video.channelName}</span><br>@@ -46,10 +46,10 @@ class VideoElement extends HTMLElement {<div class="actions">${this.video.downloaded? ''- : `<span tabindex="0" class="action download" data-video-id="${this.video.id}">⬇️ Download</span>`}+ : /*html*/`<span tabindex="0" class="action download" data-video-id="${this.video.id}">⬇️ Download</span>`}${!this.video.summary- ? `<span tabindex="0" class="action summarize" data-video-id="${this.video.id}">📖 Summarize</span>`- : `<span tabindex="0" class="action show-summary" data-video-id="${this.video.id}">📖 Summary</span>`}+ ? /*html*/`<span tabindex="0" class="action summarize" data-video-id="${this.video.id}">📖 Summarize</span>`+ : /*html*/`<span tabindex="0" class="action show-summary" data-video-id="${this.video.id}">📖 Summary</span>`}</div>`}@@ -106,7 +106,13 @@ class VideoElement extends HTMLElement {const video = this.videoif (video) {document.querySelector('dialog#summary').showModal()- document.querySelector('dialog#summary div').innerHTML = `<pre>${video.summary}</pre><details><summary>transcript</summary><pre>${video.transcript}</pre></details>`+ document.querySelector('dialog#summary div').innerHTML = /*html*/`+ <pre>${video.summary}</pre>+ <details>+ <summary>transcript</summary>+ <pre>${video.transcript}</pre>+ </details>+ `}}}