diff options
Diffstat (limited to 'view')
-rw-r--r-- | view/tpl/regate.tpl | 2 | ||||
-rw-r--r-- | view/tpl/regate_pre.tpl | 56 |
2 files changed, 56 insertions, 2 deletions
diff --git a/view/tpl/regate.tpl b/view/tpl/regate.tpl index 04a9df1de..6eaac1478 100644 --- a/view/tpl/regate.tpl +++ b/view/tpl/regate.tpl @@ -1,7 +1,5 @@ <h2>{{$title}}</h2> -<h3>{{$now}}</h3> - <div class="descriptive-paragraph" style="font-size: 1.2em;"><p>{{$desc}}</p></div> <form action="regate/{{$did2}}" method="post"> 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> |