diff options
author | Mario <mario@mariovavti.com> | 2021-04-10 10:53:27 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-04-10 10:53:27 +0000 |
commit | ea721d380be15d06a9f0974dc98487523fcdfb58 (patch) | |
tree | d8e16e595f24302e74343119b155df683beca66d /view/tpl/regate_pre.tpl | |
parent | e193b6d870482da0d499e886f6add31bdc7c9d5a (diff) | |
download | volse-hubzilla-ea721d380be15d06a9f0974dc98487523fcdfb58.tar.gz volse-hubzilla-ea721d380be15d06a9f0974dc98487523fcdfb58.tar.bz2 volse-hubzilla-ea721d380be15d06a9f0974dc98487523fcdfb58.zip |
register: move some html out of the code and provide a basic template
Diffstat (limited to 'view/tpl/regate_pre.tpl')
-rw-r--r-- | view/tpl/regate_pre.tpl | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/view/tpl/regate_pre.tpl b/view/tpl/regate_pre.tpl new file mode 100644 index 000000000..adc63b181 --- /dev/null +++ b/view/tpl/regate_pre.tpl @@ -0,0 +1,56 @@ +<h2>{{$title}}</h2> + +{{$delay_desc.0}} +<div id="countdown" class="h3"></div> + +{{$desc.0}}<br> +<br> +{{$desc.1}}<br> +{{$id}}<br> +<br> +{{$desc.2}}<br> +{{$pin}}<br> +<br> +<div class=""> + {{$delay_desc.1}}<br> + <span id="register_start" data-utc="{{$regdelay}}" class="register_date"> + {{$regdelay}} + </span> + ‐ + <span data-utc="{{$regexpire}}" class="register_date"> + {{$regexpire}} + </span> +</div> +<script> + $('.register_date').each( function () { + var date = new Date($(this).data('utc')); + $(this).html(date.toLocaleString()); + }); + + + 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> |