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

ToolbarToggler.js 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /* global APP, config, $, interfaceConfig */
  2. import UIUtil from '../util/UIUtil';
  3. import BottomToolbar from './BottomToolbar';
  4. import Toolbar from './Toolbar';
  5. import FilmStrip from '../videolayout/FilmStrip.js';
  6. let toolbarTimeoutObject;
  7. let toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
  8. /**
  9. * If true the toolbar will be always displayed
  10. */
  11. let alwaysVisibleToolbar = (config.alwaysVisibleToolbar === true);
  12. function showDesktopSharingButton() {
  13. if (APP.conference.isDesktopSharingEnabled &&
  14. UIUtil.isButtonEnabled('desktop')) {
  15. $('#toolbar_button_desktopsharing').css({display: "inline-block"});
  16. } else {
  17. $('#toolbar_button_desktopsharing').css({display: "none"});
  18. }
  19. }
  20. /**
  21. * Hides the toolbar.
  22. */
  23. function hideToolbar() {
  24. if (alwaysVisibleToolbar) {
  25. return;
  26. }
  27. clearTimeout(toolbarTimeoutObject);
  28. toolbarTimeoutObject = null;
  29. if (Toolbar.isHovered()) {
  30. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  31. } else {
  32. Toolbar.hide();
  33. $('#subject').animate({top: "-=40"}, 300);
  34. if (!FilmStrip.isFilmStripVisible()) {
  35. BottomToolbar.hide(true);
  36. }
  37. }
  38. }
  39. const ToolbarToggler = {
  40. /**
  41. * Sets the value of alwaysVisibleToolbar variable.
  42. * @param value {boolean} the new value of alwaysVisibleToolbar variable
  43. */
  44. setAlwaysVisibleToolbar(value) {
  45. alwaysVisibleToolbar = value;
  46. },
  47. /**
  48. * Resets the value of alwaysVisibleToolbar variable to the default one.
  49. */
  50. resetAlwaysVisibleToolbar() {
  51. alwaysVisibleToolbar = (config.alwaysVisibleToolbar === true);
  52. },
  53. /**
  54. * Shows the main toolbar.
  55. */
  56. showToolbar () {
  57. if (interfaceConfig.filmStripOnly) {
  58. return;
  59. }
  60. var updateTimeout = false;
  61. if (Toolbar.isEnabled() && !Toolbar.isVisible()) {
  62. Toolbar.show();
  63. $('#subject').animate({top: "+=40"}, 300);
  64. updateTimeout = true;
  65. }
  66. if (BottomToolbar.isEnabled() && !BottomToolbar.isVisible()) {
  67. BottomToolbar.show(true);
  68. updateTimeout = true;
  69. }
  70. if (updateTimeout) {
  71. if (toolbarTimeoutObject) {
  72. clearTimeout(toolbarTimeoutObject);
  73. toolbarTimeoutObject = null;
  74. }
  75. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  76. toolbarTimeout = interfaceConfig.TOOLBAR_TIMEOUT;
  77. }
  78. // Show/hide desktop sharing button
  79. showDesktopSharingButton();
  80. },
  81. /**
  82. * Docks/undocks the toolbar.
  83. *
  84. * @param isDock indicates what operation to perform
  85. */
  86. dockToolbar (isDock) {
  87. if (interfaceConfig.filmStripOnly || !Toolbar.isEnabled()) {
  88. return;
  89. }
  90. if (isDock) {
  91. // First make sure the toolbar is shown.
  92. if (!Toolbar.isVisible()) {
  93. this.showToolbar();
  94. }
  95. // Then clear the time out, to dock the toolbar.
  96. clearTimeout(toolbarTimeoutObject);
  97. toolbarTimeoutObject = null;
  98. } else {
  99. if (Toolbar.isVisible()) {
  100. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  101. } else {
  102. this.showToolbar();
  103. }
  104. }
  105. }
  106. };
  107. module.exports = ToolbarToggler;