Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

ToolbarToggler.js 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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() &&
  8. UIUtil.isButtonEnabled('desktop')) {
  9. $('#toolbar_button_desktopsharing').css({display: "inline-block"});
  10. } else {
  11. $('#toolbar_button_desktopsharing').css({display: "none"});
  12. }
  13. }
  14. /**
  15. * Hides the toolbar.
  16. */
  17. function hideToolbar() {
  18. if(config.alwaysVisibleToolbar)
  19. return;
  20. var header = $("#header"),
  21. bottomToolbar = $("#bottomToolbar");
  22. var isToolbarHover = false;
  23. header.find('*').each(function () {
  24. var id = $(this).attr('id');
  25. if ($("#" + id + ":hover").length > 0) {
  26. isToolbarHover = true;
  27. }
  28. });
  29. if ($("#bottomToolbar:hover").length > 0) {
  30. isToolbarHover = true;
  31. }
  32. clearTimeout(toolbarTimeoutObject);
  33. toolbarTimeoutObject = null;
  34. if (!isToolbarHover) {
  35. header.hide("slide", { direction: "up", duration: 300});
  36. $('#subject').animate({top: "-=40"}, 300);
  37. if ($("#remoteVideos").hasClass("hidden")) {
  38. bottomToolbar.hide(
  39. "slide", {direction: "right", duration: 300});
  40. }
  41. }
  42. else {
  43. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  44. }
  45. }
  46. var ToolbarToggler = {
  47. /**
  48. * Shows the main toolbar.
  49. */
  50. showToolbar: function () {
  51. if (interfaceConfig.filmStripOnly)
  52. return;
  53. var header = $("#header"),
  54. bottomToolbar = $("#bottomToolbar");
  55. if (!header.is(':visible') || !bottomToolbar.is(":visible")) {
  56. header.show("slide", { direction: "up", duration: 300});
  57. $('#subject').animate({top: "+=40"}, 300);
  58. if (!bottomToolbar.is(":visible")) {
  59. bottomToolbar.show(
  60. "slide", {direction: "right", duration: 300});
  61. }
  62. if (toolbarTimeoutObject) {
  63. clearTimeout(toolbarTimeoutObject);
  64. toolbarTimeoutObject = null;
  65. }
  66. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  67. toolbarTimeout = interfaceConfig.TOOLBAR_TIMEOUT;
  68. }
  69. if (APP.xmpp.isModerator())
  70. {
  71. // TODO: Enable settings functionality.
  72. // Need to uncomment the settings button in index.html.
  73. // $('#settingsButton').css({visibility:"visible"});
  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: function (isDock) {
  84. if (interfaceConfig.filmStripOnly)
  85. return;
  86. if (isDock) {
  87. // First make sure the toolbar is shown.
  88. if (!$('#header').is(':visible')) {
  89. this.showToolbar();
  90. }
  91. // Then clear the time out, to dock the toolbar.
  92. if (toolbarTimeoutObject) {
  93. clearTimeout(toolbarTimeoutObject);
  94. toolbarTimeoutObject = null;
  95. }
  96. }
  97. else {
  98. if (!$('#header').is(':visible')) {
  99. this.showToolbar();
  100. }
  101. else {
  102. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  103. }
  104. }
  105. },
  106. showDesktopSharingButton: showDesktopSharingButton
  107. };
  108. module.exports = ToolbarToggler;