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.

UserMediaPermissionsGuidanceOverlay.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* global $, APP */
  2. let $overlay;
  3. /**
  4. * Internal function that constructs overlay with guidance how to proceed with
  5. * gUM prompt.
  6. * @param {string} browser - name of browser for which to construct the
  7. * guidance overlay.
  8. */
  9. function buildOverlayHtml(browser) {
  10. $overlay = $(`
  11. <div class='overlay_container'>
  12. <div class='overlay overlay_transparent' />
  13. <div class='overlay_content'>
  14. <span class="overlay_icon icon-microphone"></span>
  15. <span class="overlay_icon icon-camera"></span>
  16. <span data-i18n='[html]userMedia.${browser}GrantPermissions'
  17. class='overlay_text overlay_text_small'></span>
  18. </div>
  19. </div>`);
  20. APP.translation.translateElement($overlay);
  21. }
  22. export default {
  23. /**
  24. * Shows browser-specific overlay with guidance how to proceed with
  25. * gUM prompt.
  26. * @param {string} browser - name of browser for which to show the
  27. * guidance overlay.
  28. */
  29. show(browser) {
  30. !$overlay && buildOverlayHtml(browser);
  31. !$overlay.parents('body').length && $overlay.appendTo('body');
  32. },
  33. /**
  34. * Hides browser-specific overlay with guidance how to proceed with
  35. * gUM prompt.
  36. */
  37. hide() {
  38. $overlay && $overlay.detach();
  39. }
  40. };