From a9da370c0bf5777a0345744667240ef0c615dcaa Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 8 Apr 2021 14:57:16 +0000 Subject: register: cleanup template --- Zotlabs/Module/Register.php | 7 ------- include/js_strings.php | 6 +++++- view/js/mod_register.js | 22 +++++++++++++++------- view/tpl/js_strings.tpl | 4 +++- view/tpl/register.tpl | 12 ------------ 5 files changed, 23 insertions(+), 28 deletions(-) diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index d076d9ccf..4ed3fd5fe 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -560,13 +560,6 @@ class Register extends Controller { require_once('include/bbcode.php'); $o = replace_macros(get_markup_template('register.tpl'), array( - - '$tao' => "typeof(window.tao) == 'undefined' ? window.tao = {} : '';\n" - . "tao.zar = { vsn: '2.0.0', form: {}, msg: {} };\n" - . "tao.zar.patano = /^d[0-9]{5,10}$/;\n" - . "tao.zar.patema = /^[a-z0-9.-]{1,64}@[a-z0-9.-]{2,32}\.[a-z]{2,12}$/;\n" - . "tao.zar.msg.ZAR0239E = '" . t('Email address not valid') . "';\n", - '$form_security_token' => get_form_security_token("register"), '$title' => t('Registration'), '$reg_is' => $registration_is, diff --git a/include/js_strings.php b/include/js_strings.php index e06e105fd..25b73d71e 100644 --- a/include/js_strings.php +++ b/include/js_strings.php @@ -116,6 +116,10 @@ function js_strings() { '$allday' => t('All day','calendar'), // mod cloud - '$download_info' => t('Please stand by while your download is being prepared.') + '$download_info' => t('Please stand by while your download is being prepared.'), + + // mod register + '$email_not_valid' => t('Email address not valid') + )); } diff --git a/view/js/mod_register.js b/view/js/mod_register.js index 1b61e2b3d..3f8f50898 100644 --- a/view/js/mod_register.js +++ b/view/js/mod_register.js @@ -1,10 +1,14 @@ $(document).ready(function() { - // set in Module - //typeof(window.tao) == 'undefined' ? window.tao = {} : ''; - //tao.zar = { vsn: '2.0.0', form: {}, msg: {} }; - //tao.zar.patano = /^d[0-9]{6}$/; - //tao.zar.patema = /^[a-z0-9.-]{2,64}@[a-z0-9.-]{4,32}\.[a-z]{2,12}$/; + typeof(window.tao) == 'undefined' ? window.tao = {} : ''; + tao.zar = { vsn: '2.0.0', form: {}, msg: {} }; + tao.zar.patano = /^d[0-9]{5,10}$/; + tao.zar.patema = /^[a-z0-9.-]{1,64}@[a-z0-9.-]{2,32}\.[a-z]{2,12}$/; + + $('.register_date').each( function () { + var date = new Date($(this).data('utc')); + $(this).html(date.toLocaleString(undefined, {weekday: 'short', hour: 'numeric', minute: 'numeric'})); + }); $('#zar014').click( function () { $('#zar015').toggle(); }); @@ -14,7 +18,7 @@ $(document).ready(function() { //ano } else { if (tao.zar.patema.test(tao.zar.form.email) == false ) { - $('#help_email').removeClass('text-muted').addClass('text-danger').html(tao.zar.msg.ZAR0239E); + $('#help_email').removeClass('text-muted').addClass('text-danger').html(aStr['email_not_valid']); zFormError('#help_email',true); } else { $.get('register/email_check.json?f=&email=' + encodeURIComponent(tao.zar.form.email), function(data) { @@ -40,6 +44,7 @@ $(document).ready(function() { $('#id_password2').val().length > 0 ? $('#id_password2').trigger('change') : ''; } }); + $('#id_password2').change(function() { if($('#id_password').val() != $('#id_password2').val()) { $('#help_password2').removeClass('text-muted').addClass('text-danger').html(aStr.pwnomatch); @@ -64,7 +69,11 @@ $(document).ready(function() { $('#name-spinner').hide(); }); }); + $('#id_nickname').blur(function() { + if($('#id_name').val() === '') + return; + $('#nick-spinner').show(); var zreg_nick = $('#id_nickname').val(); $.get('new_channel/checkaddr.json?f=&nick=' + encodeURIComponent(zreg_nick),function(data) { @@ -77,7 +86,6 @@ $(document).ready(function() { }); }); - //$("buttom[name='submit']").submit((function() { $('#register-form').submit(function(e) { if ( $('.zform-error').length > 0 ) { e.preventDefault(); diff --git a/view/tpl/js_strings.tpl b/view/tpl/js_strings.tpl index 291d78fb2..c0d8d104e 100644 --- a/view/tpl/js_strings.tpl +++ b/view/tpl/js_strings.tpl @@ -69,8 +69,10 @@ 'allday' : "{{$allday}}", // mod cloud + 'download_info' : "{{$download_info}}", - 'download_info' : "{{$download_info}}" + // mod register + 'email_not_valid' : "{{$email_not_valid}}" }; diff --git a/view/tpl/register.tpl b/view/tpl/register.tpl index d6f70d118..06e58721a 100644 --- a/view/tpl/register.tpl +++ b/view/tpl/register.tpl @@ -71,17 +71,5 @@ hilmar, 2020.02 *}} -- cgit v1.2.3