aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl/regate_pre.tpl
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2021-04-17 23:46:40 +0200
committerMax Kostikov <max@kostikov.co>2021-04-17 23:46:40 +0200
commit200d3577fa32bb5107e0376dfd5ee9b3bc8b8721 (patch)
tree29be82bc3b5e67986d503ec2c37d05eb38b32db2 /view/tpl/regate_pre.tpl
parentb5620cb79443fcbf1820341bce05fadbb0b124be (diff)
parent8ab99747f55e60448d4468e99d97ae6c0fa566c0 (diff)
downloadvolse-hubzilla-200d3577fa32bb5107e0376dfd5ee9b3bc8b8721.tar.gz
volse-hubzilla-200d3577fa32bb5107e0376dfd5ee9b3bc8b8721.tar.bz2
volse-hubzilla-200d3577fa32bb5107e0376dfd5ee9b3bc8b8721.zip
Merge branch 'dev' of https://framagit.org/kostikov/core into dev
Diffstat (limited to 'view/tpl/regate_pre.tpl')
-rw-r--r--view/tpl/regate_pre.tpl64
1 files changed, 64 insertions, 0 deletions
diff --git a/view/tpl/regate_pre.tpl b/view/tpl/regate_pre.tpl
new file mode 100644
index 000000000..7596f6846
--- /dev/null
+++ b/view/tpl/regate_pre.tpl
@@ -0,0 +1,64 @@
+<div class="generic-content-wrapper">
+ <div class="section-title-wrapper">
+ <h2>{{$title}}</h2>
+ </div>
+ <div class="section-content-wrapper">
+ {{if $now}}
+ <div class="section-content-danger-wrapper">
+ <div class="h3">{{$now}}</div>
+ </div>
+ {{else}}
+ <div class="section-content-warning-wrapper">
+ {{$strings.0}}
+ <div id="countdown" class="h3"></div>
+ </div>
+ <div class="section-content-info-wrapper">
+ {{$strings.1}} {{$id}}
+ <div class="h3">{{$pin}}</div>
+ </div>
+ <div class="d-none">
+ {{$strings.2}}<br>
+ <span id="register_start" data-utc="{{$regdelay}}" class="register_date">
+ {{$regdelay}}
+ </span>
+ &nbsp;&dash;&nbsp;
+ <span data-utc="{{$regexpire}}" class="register_date">
+ {{$regexpire}}
+ </span>
+ </div>
+ {{/if}}
+ </div>
+</div>
+
+<script>
+ $('.register_date').each( function () {
+ var date = new Date($(this).data('utc'));
+ $(this).html(date.toLocaleString(undefined, {weekday: 'short', hour: 'numeric', minute: 'numeric'}));
+ });
+
+ var date = '{{$countdown}}';
+ date = date !== '' ? date : $('#register_start').data('utc');
+
+ if(date) {
+ doCountDown(date, 'countdown');
+ var x = setInterval(doCountDown, 1000, date, 'countdown');
+ }
+
+ function doCountDown(date, id) {
+ var countDownDate = new Date(date).getTime();
+ var now = new Date().getTime();
+ var distance = countDownDate - now;
+ var days = Math.floor(distance / (1000 * 60 * 60 * 24));
+ var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
+ var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
+ var seconds = Math.floor((distance % (1000 * 60)) / 1000);
+
+ document.getElementById(id).innerHTML = days + "d " + hours + "h "+ minutes + "m " + seconds + "s ";
+
+ if (distance < 0) {
+ clearInterval(x);
+ document.getElementById(id).innerHTML = 'Reloading...';
+ window.location.reload();
+ }
+ }
+</script>