Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

feat: state update indicator

Christian Fei140c93c23d33
diff --git a/client/index.html b/client/index.html
index bc5dbc4..f2a2821 100644
--- a/client/index.html
+++ b/client/index.html
@@ -31,7 +31,7 @@
<sse-connection></sse-connection>
<details class="state">
- <summary>state & logs <span class="count"></span></summary>
+ <summary>state & logs <span class="count"></span><span class="indicator"></span></summary>
<div class="flex mt-1">
<div class="flex-1 gap downloading">Downloading</div>
<div class="flex-1 gap summarizing">Summarizing</div>
diff --git a/client/main.css b/client/main.css
index bbc00c9..f09c057 100644
--- a/client/main.css
+++ b/client/main.css
@@ -411,7 +411,15 @@ video-element, video-element video {
.state > div {
margin-top: 0.5rem;
}
-
+.state.updated .indicator {
+ background-color: #3498db;
+ border-radius: 50%;
+ width: .4rem;
+ height: .4rem;
+ margin-bottom: .1rem;
+ display: inline-block;
+ margin-left: 0.5rem;
+}
.state .lines {
font-size: 1rem;
diff --git a/client/main.js b/client/main.js
index c9116cb..3727d69 100644
--- a/client/main.js
+++ b/client/main.js
@@ -56,6 +56,8 @@ window.eventSource.onmessage = (message) => {
if (data.type === 'download-log-line' && data.line) {
const $state = document.querySelector('.state')
if (!$state) { return console.warn('missing $state') }
+ $state.classList.add('updated')
+ setTimeout(() => $state.classList.remove('updated'), 5000)
const $downloadLogLines = $state.querySelector(' .lines')
const text = $downloadLogLines.innerText