diff options
author | Mario <mario@mariovavti.com> | 2021-03-26 20:54:48 +0100 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-03-26 20:54:48 +0100 |
commit | 725e57a27a41c8780c08fe598ec6c7b24a633cf4 (patch) | |
tree | 4839ee3a5f5102caeab6da4bb811d7fde2d5107f /view | |
parent | b50f1657c3e5772dd6235ce98c55e71630b0c626 (diff) | |
download | volse-hubzilla-725e57a27a41c8780c08fe598ec6c7b24a633cf4.tar.gz volse-hubzilla-725e57a27a41c8780c08fe598ec6c7b24a633cf4.tar.bz2 volse-hubzilla-725e57a27a41c8780c08fe598ec6c7b24a633cf4.zip |
air: more work on UX during register
Diffstat (limited to 'view')
-rw-r--r-- | view/tpl/plain.tpl | 28 | ||||
-rw-r--r-- | view/tpl/regate.tpl | 7 | ||||
-rw-r--r-- | view/tpl/register.tpl | 13 |
3 files changed, 41 insertions, 7 deletions
diff --git a/view/tpl/plain.tpl b/view/tpl/plain.tpl index b0c7b3081..e7aa9c63c 100644 --- a/view/tpl/plain.tpl +++ b/view/tpl/plain.tpl @@ -1,9 +1,37 @@ <h2>{{$title}}</h2> {{if $now}}<div>{{$now}}</div>{{/if}} <div style="font-weight: normal; font-family: monospace;">{{$infos}}</div> +<div id="countdown" class="h3"></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> diff --git a/view/tpl/regate.tpl b/view/tpl/regate.tpl index bae0884dc..04a9df1de 100644 --- a/view/tpl/regate.tpl +++ b/view/tpl/regate.tpl @@ -20,3 +20,10 @@ </form> <div class="clear"></div> +<script> + var week_days = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']; + $('.register_date').each( function () { + var date = new Date($(this).data('utc')); + $(this).html(date.toLocaleString(undefined, {weekday: 'short', hour: 'numeric', minute: 'numeric'})); + }); +</script> diff --git a/view/tpl/register.tpl b/view/tpl/register.tpl index 8033d0a76..b38507f92 100644 --- a/view/tpl/register.tpl +++ b/view/tpl/register.tpl @@ -5,14 +5,13 @@ <div class="section-content-wrapper"> <form action="register" method="post" id="register-form"> <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> + {{if $reg_is || $other_sites || $now}} <div class="section-content-warning-wrapper"> - {{if $reg_is}} + <h3>{{$now}}</h3> <div id="register-desc" class="descriptive-paragraph">{{$reg_is}}</div> - {{/if}} <div id="register-sites" class="descriptive-paragraph">{{$other_sites}}</div> - <h2>{{$now}}</h2> </div> - + {{/if}} {{if $registertext}} <div class="section-content-info-wrapper"> <div id="register-text" class="descriptive-paragraph">{{$registertext}}</div> @@ -27,12 +26,12 @@ </div> {{/if}} - {{include file="field_input.tpl" field=[$email.0,$email.1,"",$email.3,"",""]}} + {{include file="field_input.tpl" field=$email}} </div> - {{include file="field_password.tpl" field=[$pass1.0,$pass1.1,"","","",$atform]}} + {{include file="field_password.tpl" field=$pass1}} - {{include file="field_password.tpl" field=[$pass2.0,$pass2.1,"","","",$atform]}} + {{include file="field_password.tpl" field=$pass2}} {{if $auto_create}} {{if $default_role}} |