aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features/user-settings.js
blob: d49bf3927548c2dfc47f62df67448009151b247c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import $ from 'jquery';
import {hideElem, showElem} from '../utils/dom.js';

export function initUserSettings() {
  if ($('.user.settings.profile').length > 0) {
    $('#username').on('keyup', function () {
      const $prompt = $('#name-change-prompt');
      const $prompt_redirect = $('#name-change-redirect-prompt');
      if ($(this).val().toString().toLowerCase() !== $(this).data('name').toString().toLowerCase()) {
        showElem($prompt);
        showElem($prompt_redirect);
      } else {
        hideElem($prompt);
        hideElem($prompt_redirect);
      }
    });
  }
}