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.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* global $, interfaceConfig, Moderator, showDesktopSharingButton */
  2. var toolbarTimeoutObject,
  3. toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
  4. /**
  5. * Hides the toolbar.
  6. */
  7. function hideToolbar() {
  8. var header = $("#header"),
  9. bottomToolbar = $("#bottomToolbar");
  10. var isToolbarHover = false;
  11. header.find('*').each(function () {
  12. var id = $(this).attr('id');
  13. if ($("#" + id + ":hover").length > 0) {
  14. isToolbarHover = true;
  15. }
  16. });
  17. if ($("#bottomToolbar:hover").length > 0) {
  18. isToolbarHover = true;
  19. }
  20. clearTimeout(toolbarTimeoutObject);
  21. toolbarTimeoutObject = null;
  22. if (!isToolbarHover) {
  23. header.hide("slide", { direction: "up", duration: 300});
  24. $('#subject').animate({top: "-=40"}, 300);
  25. if ($("#remoteVideos").hasClass("hidden")) {
  26. bottomToolbar.hide(
  27. "slide", {direction: "right", duration: 300});
  28. }
  29. }
  30. else {
  31. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  32. }
  33. }
  34. var ToolbarToggler = {
  35. /**
  36. * Shows the main toolbar.
  37. */
  38. showToolbar: function () {
  39. var header = $("#header"),
  40. bottomToolbar = $("#bottomToolbar");
  41. if (!header.is(':visible') || !bottomToolbar.is(":visible")) {
  42. header.show("slide", { direction: "up", duration: 300});
  43. $('#subject').animate({top: "+=40"}, 300);
  44. if (!bottomToolbar.is(":visible")) {
  45. bottomToolbar.show(
  46. "slide", {direction: "right", duration: 300});
  47. }
  48. if (toolbarTimeoutObject) {
  49. clearTimeout(toolbarTimeoutObject);
  50. toolbarTimeoutObject = null;
  51. }
  52. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  53. toolbarTimeout = interfaceConfig.TOOLBAR_TIMEOUT;
  54. }
  55. if (Moderator.isModerator())
  56. {
  57. // TODO: Enable settings functionality.
  58. // Need to uncomment the settings button in index.html.
  59. // $('#settingsButton').css({visibility:"visible"});
  60. }
  61. // Show/hide desktop sharing button
  62. showDesktopSharingButton();
  63. },
  64. /**
  65. * Docks/undocks the toolbar.
  66. *
  67. * @param isDock indicates what operation to perform
  68. */
  69. dockToolbar: function (isDock) {
  70. if (isDock) {
  71. // First make sure the toolbar is shown.
  72. if (!$('#header').is(':visible')) {
  73. this.showToolbar();
  74. }
  75. // Then clear the time out, to dock the toolbar.
  76. if (toolbarTimeoutObject) {
  77. clearTimeout(toolbarTimeoutObject);
  78. toolbarTimeoutObject = null;
  79. }
  80. }
  81. else {
  82. if (!$('#header').is(':visible')) {
  83. this.showToolbar();
  84. }
  85. else {
  86. toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
  87. }
  88. }
  89. }
  90. };
  91. module.exports = ToolbarToggler;