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

ToolbarToggler.js 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /* global APP, config, $, interfaceConfig, Moderator,
  2. DesktopStreaming.showDesktopSharingButton */
  3. var toolbarTimeoutObject,
  4. toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT,
  5. UIUtil = require("../util/UIUtil");
  6. function showDesktopSharingButton() {
  7. if (APP.desktopsharing.isDesktopSharingEnabled() && 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. if (APP.xmpp.isModerator())
  69. {
  70. // TODO: Enable settings functionality.
  71. // Need to uncomment the settings button in index.html.
  72. // $('#settingsButton').css({visibility:"visible"});
  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: function (isDock) {
  83. if (interfaceConfig.filmStripOnly)
  84. return;
  85. if (isDock) {
  86. // First make sure the toolbar is shown.
  87. if (!$('#header').is(':visible')) {
  88. this.showToolbar();
  89. }
  90. // Then clear the time out, to dock the toolbar.
  91. if (toolbarTimeoutObject) {
  92. clearTimeout(toolbarTimeoutObject);
  93. toolbarTimeoutObject = null;
  94. }
  95. }
  96. else {
  97. if (!$('#header').is(':visible')) {
  98. this.showToolbar();
  99. }
  100. else {
  101. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  102. }
  103. }
  104. },
  105. showDesktopSharingButton: showDesktopSharingButton
  106. };
  107. module.exports = ToolbarToggler;