/* global $, APP */ let $overlay; /** * Internal function that constructs overlay with guidance how to proceed with * gUM prompt. * @param {string} browser - name of browser for which to construct the * guidance overlay. */ function buildOverlayHtml(browser) { $overlay = $(`
`); APP.translation.translateElement($overlay); } export default { /** * Checks whether the overlay is currently visible. * @return {boolean} true if the overlay is visible * or false otherwise. */ isVisible () { return $overlay && $overlay.parents('body').length > 0; }, /** * Shows browser-specific overlay with guidance how to proceed with * gUM prompt. * @param {string} browser - name of browser for which to show the * guidance overlay. */ show(browser) { !$overlay && buildOverlayHtml(browser); !this.isVisible() && $overlay.appendTo('body'); }, /** * Hides browser-specific overlay with guidance how to proceed with * gUM prompt. */ hide() { $overlay && $overlay.detach(); } };