您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

BottomToolbar.js 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* global $, APP, interfaceConfig, JitsiMeetJS */
  2. import UIUtil from '../util/UIUtil';
  3. import UIEvents from '../../../service/UI/UIEvents';
  4. const defaultBottomToolbarButtons = {
  5. 'chat': '#bottom_toolbar_chat',
  6. 'contacts': '#bottom_toolbar_contact_list',
  7. 'filmstrip': '#bottom_toolbar_film_strip'
  8. };
  9. const BottomToolbar = {
  10. init () {
  11. this.toolbar = $('#bottomToolbar');
  12. // The bottom toolbar is enabled by default.
  13. this.enabled = true;
  14. },
  15. /**
  16. * Enables / disables the bottom toolbar.
  17. * @param {e} set to {true} to enable the bottom toolbar or {false}
  18. * to disable it
  19. */
  20. enable (e) {
  21. this.enabled = e;
  22. if (!e && this.isVisible())
  23. this.hide(false);
  24. },
  25. /**
  26. * Indicates if the bottom toolbar is currently enabled.
  27. * @return {this.enabled}
  28. */
  29. isEnabled() {
  30. return this.enabled;
  31. },
  32. setupListeners (emitter) {
  33. UIUtil.hideDisabledButtons(defaultBottomToolbarButtons);
  34. const buttonHandlers = {
  35. "bottom_toolbar_contact_list": function () {
  36. JitsiMeetJS.analytics.sendEvent(
  37. 'bottomtoolbar.contacts.toggled');
  38. emitter.emit(UIEvents.TOGGLE_CONTACT_LIST);
  39. },
  40. "bottom_toolbar_film_strip": function () {
  41. JitsiMeetJS.analytics.sendEvent(
  42. 'bottomtoolbar.filmstrip.toggled');
  43. emitter.emit(UIEvents.TOGGLE_FILM_STRIP);
  44. },
  45. "bottom_toolbar_chat": function () {
  46. JitsiMeetJS.analytics.sendEvent('bottomtoolbar.chat.toggled');
  47. emitter.emit(UIEvents.TOGGLE_CHAT);
  48. }
  49. };
  50. Object.keys(buttonHandlers).forEach(
  51. buttonId => $(`#${buttonId}`).click(buttonHandlers[buttonId])
  52. );
  53. },
  54. resizeToolbar (thumbWidth, thumbHeight) {
  55. let bottom = (thumbHeight - this.toolbar.outerHeight())/2 + 18;
  56. this.toolbar.css({bottom});
  57. },
  58. /**
  59. * Returns true if this toolbar is currently visible, or false otherwise.
  60. * @return <tt>true</tt> if currently visible, <tt>false</tt> - otherwise
  61. */
  62. isVisible() {
  63. return this.toolbar.is(":visible");
  64. },
  65. /**
  66. * Hides the bottom toolbar with animation or not depending on the animate
  67. * parameter.
  68. * @param animate <tt>true</tt> to hide the bottom toolbar with animation,
  69. * <tt>false</tt> or nothing to hide it without animation.
  70. */
  71. hide(animate) {
  72. if (animate)
  73. this.toolbar.hide("slide", {direction: "right", duration: 300});
  74. else
  75. this.toolbar.css("display", "none");
  76. },
  77. /**
  78. * Shows the bottom toolbar with animation or not depending on the animate
  79. * parameter.
  80. * @param animate <tt>true</tt> to show the bottom toolbar with animation,
  81. * <tt>false</tt> or nothing to show it without animation.
  82. */
  83. show(animate) {
  84. if (animate)
  85. this.toolbar.show("slide", {direction: "right", duration: 300});
  86. else
  87. this.toolbar.css("display", "block");
  88. }
  89. };
  90. export default BottomToolbar;