diff --git a/public/javascripts/signup.js b/public/javascripts/signup.js index 7476130c15..d517e21d8e 100644 --- a/public/javascripts/signup.js +++ b/public/javascripts/signup.js @@ -2,7 +2,7 @@ $(function() { const $form = $('#signup_form'); const $exists = $form.find('.username-exists'); - const usernameCheck = lichess.debounce(function() { + const usernameCheck = lichess.debounce(() => { const name = $username.val(); if (name.length >= 3) $.ajax({ method: 'GET', @@ -11,27 +11,27 @@ $(function() { term: name, exists: 1 }, - success: function(res) { + success(res) { $exists.toggle(res); } }); }, 300); $username = $form.find('input[name="username"]') - .on('change keyup paste', function() { + .on('change keyup paste', () => { $exists.hide(); usernameCheck(); }); - $form.on('submit', function() { + $form.on('submit', () => $form.find('button.submit') - .attr('disabled', true) - .removeAttr('data-icon') - .addClass('frameless') - .html(lichess.spinnerHtml); - }); + .attr('disabled', true) + .removeAttr('data-icon') + .addClass('frameless') + .html(lichess.spinnerHtml) + ); }); -window.signupSubmit = function(token) { +window.signupSubmit = () => { const form = document.getElementById('signup_form'); if (form.reportValidity()) form.submit(); } diff --git a/ui/site/src/main.js b/ui/site/src/main.js index d121689b86..6b9a6f667e 100644 --- a/ui/site/src/main.js +++ b/ui/site/src/main.js @@ -129,7 +129,7 @@ }, { hint: true, highlight: false, - source: function(query, _, runAsync) { + source(query, _, runAsync) { query = query.trim(); if (!query.match(/^[a-z0-9][\w-]{2,29}$/i)) return; else if (cache[query]) setTimeout(() => runAsync(cache[query]), 50); @@ -164,8 +164,8 @@ templates: { empty: '
No player found
', pending: lichess.spinnerHtml, - suggestion: function(o) { - var tag = opts.tag || 'a'; + suggestion(o) { + const tag = opts.tag || 'a'; return '<' + tag + ' class="ulpt user-link' + (o.online ? ' online' : '') + '" ' + (tag === 'a' ? '' : 'data-') + 'href="/@/' + o.name + '">' + '' + (o.title ? '' + o.title + ' ' : '') + o.name + '';