Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

ToolbarToggler.js 3.3KB

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