You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

toolbar_toggler.js 3.0KB

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