diff --git a/src-tauri/templates/overlay/browsersource.html.j2 b/src-tauri/templates/overlay/browsersource.html.j2
index b1882c4..a447598 100644
--- a/src-tauri/templates/overlay/browsersource.html.j2
+++ b/src-tauri/templates/overlay/browsersource.html.j2
@@ -12,7 +12,9 @@
- {{ content }}
+
- {% for c in countdowns %}
-
+ {% if c.icon %}
+

+ {% endif %}
+ {% if c.show_timer %}
+
- {% if c.icon %}
-
- {% endif %}
-
- {{ c.remaining }}
-
+ {{ c.remaining }}
+
+ {% endif %}
+ {% if c.show_timer and c.show_progress %}
+
+ {% endif %}
+ {% if c.show_progress %}
+
- {% endfor %}
+ {% endif %}
diff --git a/src-tauri/templates/overlay/countdown/countdown.js.j2 b/src-tauri/templates/overlay/countdown/countdown.js.j2
index d8f210a..ae4d53c 100644
--- a/src-tauri/templates/overlay/countdown/countdown.js.j2
+++ b/src-tauri/templates/overlay/countdown/countdown.js.j2
@@ -1,13 +1,20 @@
const hideIdle = {{ hide_idle | lower }};
const es = new EventSource('/sse/group/{{ id }}');
es.addEventListener('countdown-tick', e => {
- const {id, remaining} = JSON.parse(e.data);
- document.getElementById('timer-' + id).textContent = remaining;
+ const {id, remaining, percent} = JSON.parse(e.data);
+ const timer = document.getElementById('timer-' + id);
+ if(timer){
+ timer.textContent = remaining;
+ }
+ const progressInner = document.getElementById('progress-inner-' + id);
+ if(progressInner){
+ progressInner.style.width = percent + '%';
+ }
});
es.addEventListener('countdown-state', e => {
const {id, state} = JSON.parse(e.data);
if (hideIdle) {
- document.getElementById('countdown-' + id).style.display = state === 'Idle' ? 'none' : '';
+ document.getElementById('countdown-' + id).dataset.hidden = state === 'Idle';
}
});
es.addEventListener('reload', () => location.reload());