Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

ToolbarToggler.js 3.3KB

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