You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Profile.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* global APP, $, JitsiMeetJS */
  2. import UIUtil from "../../util/UIUtil";
  3. import UIEvents from "../../../../service/UI/UIEvents";
  4. import languages from "../../../../service/translation/languages";
  5. import Settings from '../../../settings/Settings';
  6. export default {
  7. init (emitter) {
  8. // DISPLAY NAME
  9. function updateDisplayName () {
  10. emitter.emit(UIEvents.NICKNAME_CHANGED, $('#setDisplayName').val());
  11. }
  12. $('#setDisplayName')
  13. .val(Settings.getDisplayName())
  14. .keyup(function (event) {
  15. if (event.keyCode === 13) { // enter
  16. updateDisplayName();
  17. }
  18. })
  19. .focusout(updateDisplayName);
  20. // EMAIL
  21. function updateEmail () {
  22. emitter.emit(UIEvents.EMAIL_CHANGED, $('#setEmail').val());
  23. }
  24. $('#setEmail')
  25. .val(Settings.getEmail())
  26. .keyup(function (event) {
  27. if (event.keyCode === 13) { // enter
  28. updateEmail();
  29. }
  30. }).focusout(updateEmail);
  31. },
  32. /**
  33. * Check if settings menu is visible or not.
  34. * @returns {boolean}
  35. */
  36. isVisible () {
  37. return UIUtil.isVisible(document.getElementById("profile_container"));
  38. },
  39. /**
  40. * Change user display name in the settings menu.
  41. * @param {string} newDisplayName
  42. */
  43. changeDisplayName (newDisplayName) {
  44. $('#setDisplayName').val(newDisplayName);
  45. },
  46. /**
  47. * Change user avatar in the settings menu.
  48. * @param {string} avatarUrl url of the new avatar
  49. */
  50. changeAvatar (avatarUrl) {
  51. $('#avatar').attr('src', avatarUrl);
  52. }
  53. };