/* global browser, window, document */ const CONTAINER_HIDE_SRC = '/img/container-hide.svg'; const CONTAINER_UNHIDE_SRC = '/img/container-unhide.svg'; function hideContainerTabs(containerId) { const tabIdsToRemove = []; const tabUrlsToSave = []; const hideorshowIcon = document.querySelector(`#${containerId}-hideorshow-icon`); browser.tabs.query({cookieStoreId: containerId}).then(tabs=> { tabs.forEach(tab=> { tabIdsToRemove.push(tab.id); tabUrlsToSave.push(tab.url); }); browser.runtime.sendMessage({ method: 'hide', cookieStoreId: containerId, tabUrlsToSave: tabUrlsToSave }).then(()=> { browser.tabs.remove(tabIdsToRemove); hideorshowIcon.src = CONTAINER_UNHIDE_SRC; }); }); } function showContainerTabs(containerId) { const hideorshowIcon = document.querySelector(`#${containerId}-hideorshow-icon`); browser.runtime.sendMessage({ method: 'show', cookieStoreId: containerId }).then(hiddenTabUrls=> { hiddenTabUrls.forEach(url=> { browser.tabs.create({ url: url, cookieStoreId: containerId }); }); }); hideorshowIcon.src = CONTAINER_HIDE_SRC; } browser.runtime.sendMessage({method: 'query'}).then(identities=> { const identitiesListElement = document.querySelector('.identities-list'); identities.forEach(identity=> { let hideOrShowIconSrc = CONTAINER_HIDE_SRC; if (identity.hiddenTabUrls.length) { hideOrShowIconSrc = CONTAINER_UNHIDE_SRC; } const identityRow = `