A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
fix: video-element based ui on state
Christian Fei2fb2c65c8311
diff --git a/client/components/video-element.js b/client/components/video-element.jsindex 59886c8..c7c7b02 100644--- a/client/components/video-element.js+++ b/client/components/video-element.js@@ -82,6 +82,16 @@ class VideoElement extends HTMLElement {</div>`++ if (window.state && window.state.downloading[this.video.id]) {+ this.dataset['downloading'] = 'true'+ this.querySelector('.action.download').innerText = this.downloadStartedText+ }+ if (window.state && window.state.summarizing[this.video.id]) {+ this.dataset['summarizing'] = 'true'+ this.querySelector('.action.summarize').innerText = this.summaryStartedText+ }+this.registerEvents()}registerEvents () {diff --git a/client/main.js b/client/main.jsindex 970d6b4..f7439a0 100644--- a/client/main.js+++ b/client/main.js@@ -1,6 +1,7 @@import Store from '/lib/store.js'import { createVideoElement } from '/lib/utils.js'const store = new Store()+window.state = {}const eventSource = new EventSource('/')eventSource.onmessage = (message) => {@@ -10,6 +11,7 @@ eventSource.onmessage = (message) => {console.log('[sse] message', data)if (data.type === 'state' && data.state) {+ Object.assign(state, data.state)const $state = document.querySelector('.state')if (!$state) { return console.warn('missing $state') }const $count = $state.querySelector('.count')