summaryrefslogtreecommitdiff
path: root/views/components
diff options
context:
space:
mode:
Diffstat (limited to 'views/components')
-rw-r--r--views/components/timer.twig26
1 files changed, 0 insertions, 26 deletions
diff --git a/views/components/timer.twig b/views/components/timer.twig
deleted file mode 100644
index ccb31a7..0000000
--- a/views/components/timer.twig
+++ /dev/null
@@ -1,26 +0,0 @@
-<span class="timer" data-time="{{ time }}">
- <span class="timer__time"></span>
-</span>
-<script>
-document.addEventListener('DOMContentLoaded', function (ev) {
- const timer = document.querySelector('.timer[data-time="{{ time }}"] .timer__time');
- const time = new Date('{{ time }}');
-
- const interval = setInterval(setTime, 1000);
- function setTime() {
- let diff = time - new Date();
- if (diff <= 0) {
- clearInterval(interval);
- window.location.reload();
- }
-
- const hh = Math.floor(diff/1000/60/60);
- diff -= hh*1000*60*60;
- const mm = Math.floor(diff/1000/60);
- diff -= mm*1000*60;
- const ss = Math.floor(diff/1000);
- timer.innerHTML = `${('00' + hh).slice(-2)}:${('00' + mm).slice(-2)}:${('00' + ss).slice(-2)}`;
- }
- setTime();
-});
-</script>