Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

functions.web.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // @flow
  2. declare var interfaceConfig: Object;
  3. /**
  4. * Helper for getting the height of the toolbox.
  5. *
  6. * @returns {number} The height of the toolbox.
  7. */
  8. export function getToolboxHeight() {
  9. const toolbox = document.getElementById('new-toolbox');
  10. return (toolbox && toolbox.clientHeight) || 0;
  11. }
  12. /**
  13. * Indicates if a toolbar button is enabled.
  14. *
  15. * @param {string} name - The name of the setting section as defined in
  16. * interface_config.js.
  17. * @returns {boolean} - True to indicate that the given toolbar button
  18. * is enabled, false - otherwise.
  19. */
  20. export function isButtonEnabled(name: string) {
  21. return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1;
  22. }
  23. /**
  24. * Indicates if the toolbox is visible or not.
  25. *
  26. * @param {string} state - The state from the Redux store.
  27. * @returns {boolean} - True to indicate that the toolbox is visible, false -
  28. * otherwise.
  29. */
  30. export function isToolboxVisible(state: Object) {
  31. const { iAmSipGateway } = state['features/base/config'];
  32. const {
  33. alwaysVisible,
  34. timeoutID,
  35. visible
  36. } = state['features/toolbox'];
  37. return Boolean(!iAmSipGateway && (timeoutID || visible || alwaysVisible));
  38. }