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

ToolbarToggler.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* global APP, config, $, interfaceConfig */
  2. import UIUtil from '../util/UIUtil';
  3. let toolbarTimeoutObject;
  4. let toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
  5. function showDesktopSharingButton() {
  6. if (APP.desktopsharing.isDesktopSharingEnabled() &&
  7. UIUtil.isButtonEnabled('desktop')) {
  8. $('#toolbar_button_desktopsharing').css({display: "inline-block"});
  9. } else {
  10. $('#toolbar_button_desktopsharing').css({display: "none"});
  11. }
  12. }
  13. function isToolbarVisible () {
  14. return $('#header').is(':visible');
  15. }
  16. /**
  17. * Hides the toolbar.
  18. */
  19. function hideToolbar() {
  20. if (config.alwaysVisibleToolbar) {
  21. return;
  22. }
  23. let header = $("#header");
  24. let bottomToolbar = $("#bottomToolbar");
  25. let isToolbarHover = false;
  26. header.find('*').each(function () {
  27. let id = $(this).attr('id');
  28. if ($(`#${id}:hover`).length > 0) {
  29. isToolbarHover = true;
  30. }
  31. });
  32. if ($("#bottomToolbar:hover").length > 0) {
  33. isToolbarHover = true;
  34. }
  35. clearTimeout(toolbarTimeoutObject);
  36. toolbarTimeoutObject = null;
  37. if (isToolbarHover) {
  38. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  39. } else {
  40. header.hide("slide", { direction: "up", duration: 300});
  41. $('#subject').animate({top: "-=40"}, 300);
  42. if ($("#remoteVideos").hasClass("hidden")) {
  43. bottomToolbar.hide(
  44. "slide", {direction: "right", duration: 300}
  45. );
  46. }
  47. }
  48. }
  49. const ToolbarToggler = {
  50. /**
  51. * Shows the main toolbar.
  52. */
  53. showToolbar () {
  54. if (interfaceConfig.filmStripOnly) {
  55. return;
  56. }
  57. let header = $("#header");
  58. let bottomToolbar = $("#bottomToolbar");
  59. if (!header.is(':visible') || !bottomToolbar.is(":visible")) {
  60. header.show("slide", { direction: "up", duration: 300});
  61. $('#subject').animate({top: "+=40"}, 300);
  62. if (!bottomToolbar.is(":visible")) {
  63. bottomToolbar.show(
  64. "slide", {direction: "right", duration: 300}
  65. );
  66. }
  67. if (toolbarTimeoutObject) {
  68. clearTimeout(toolbarTimeoutObject);
  69. toolbarTimeoutObject = null;
  70. }
  71. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  72. toolbarTimeout = interfaceConfig.TOOLBAR_TIMEOUT;
  73. }
  74. // Show/hide desktop sharing button
  75. showDesktopSharingButton();
  76. },
  77. /**
  78. * Docks/undocks the toolbar.
  79. *
  80. * @param isDock indicates what operation to perform
  81. */
  82. dockToolbar (isDock) {
  83. if (interfaceConfig.filmStripOnly) {
  84. return;
  85. }
  86. if (isDock) {
  87. // First make sure the toolbar is shown.
  88. if (!isToolbarVisible()) {
  89. this.showToolbar();
  90. }
  91. // Then clear the time out, to dock the toolbar.
  92. clearTimeout(toolbarTimeoutObject);
  93. toolbarTimeoutObject = null;
  94. } else {
  95. if (isToolbarVisible()) {
  96. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  97. } else {
  98. this.showToolbar();
  99. }
  100. }
  101. }
  102. };
  103. module.exports = ToolbarToggler;