diff --git a/src/drivers/webextension/css/styles.css b/src/drivers/webextension/css/styles.css index 9ebe6a132..700dc92fb 100644 --- a/src/drivers/webextension/css/styles.css +++ b/src/drivers/webextension/css/styles.css @@ -189,7 +189,7 @@ a:hover { .terms { align-items: center; - display: none; + display: flex; flex-direction: column; justify-content: center; padding: 1.5rem 1.5rem 1rem 1.5rem; diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index 4195fa04f..a79725e5a 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -55,9 +55,7 @@ const Driver = { ads: await getOption('ads', []) } - await promisify(chrome.browserAction, 'setBadgeBackgroundColor', { - color: '#6B39BD' - }) + chrome.browserAction.setBadgeBackgroundColor({ color: '#6B39BD' }, () => {}) chrome.webRequest.onCompleted.addListener( Driver.onWebRequestComplete, @@ -380,16 +378,18 @@ const Driver = { ;({ icon } = pinned || technologies[0] || { icon }) } - const tabs = await promisify(chrome.tabs, 'query', { url }) - - await Promise.all( - tabs.map(({ id: tabId }) => - Promise.all([ - promisify(chrome.browserAction, 'setBadgeText', { + ;(await promisify(chrome.tabs, 'query', { url })).forEach( + ({ id: tabId }) => { + chrome.browserAction.setBadgeText( + { tabId, - text: technologies.length.toString().toString() - }), - promisify(chrome.browserAction, 'setIcon', { + text: technologies.length.toString() + }, + () => {} + ) + + chrome.browserAction.setIcon( + { tabId, path: chrome.extension.getURL( `../images/icons/${ @@ -398,9 +398,10 @@ const Driver = { : icon }` ) - }) - ]) - ) + }, + () => {} + ) + } ) }, diff --git a/src/drivers/webextension/js/options.js b/src/drivers/webextension/js/options.js index fd378a27c..b0ae6127c 100644 --- a/src/drivers/webextension/js/options.js +++ b/src/drivers/webextension/js/options.js @@ -1,6 +1,6 @@ 'use strict' /* eslint-env browser */ -/* globals chrome, Utils */ +/* globals Utils */ const { i18n, getOption, setOption } = Utils diff --git a/src/drivers/webextension/js/popup.js b/src/drivers/webextension/js/popup.js index 119bdcc80..1ffb2a172 100644 --- a/src/drivers/webextension/js/popup.js +++ b/src/drivers/webextension/js/popup.js @@ -52,32 +52,33 @@ const Popup = { document.querySelector('.terms').addEventListener('click', async () => { await setOption('termsAccepted', true) - document.querySelector('.terms').classList.remove('terms--hidden') - document - .querySelector('.detections') - .classList.add('.detections--hidden') - document.querySelector('.empty').classList.add('empty--hidden') + document.querySelector('.terms').classList.add('terms--hidden') + document.querySelector('.empty').classList.remove('empty--hidden') chrome.runtime.sendMessage('getDetections', Popup.onGetDetections) }) } // Alert - const [{ url }] = await promisify(chrome.tabs, 'query', { + const tabs = await promisify(chrome.tabs, 'query', { active: true, currentWindow: true }) - if (url.startsWith('http')) { - document.querySelector('.alerts').classList.remove('alerts--hidden') + if (tabs && tabs.length) { + const [{ url }] = tabs - document.querySelector( - '.alerts__link' - ).href = `https://www.wappalyzer.com/alerts/manage?url=${encodeURIComponent( - `${url}` - )}` - } else { - document.querySelector('.alerts').classList.add('alerts--hidden') + if (url.startsWith('http')) { + document.querySelector('.alerts').classList.remove('alerts--hidden') + + document.querySelector( + '.alerts__link' + ).href = `https://www.wappalyzer.com/alerts/manage?url=${encodeURIComponent( + `${url}` + )}` + } else { + document.querySelector('.alerts').classList.add('alerts--hidden') + } } document @@ -131,6 +132,7 @@ const Popup = { } document.querySelector('.empty').classList.add('empty--hidden') + document.querySelector('.detections').classList.remove('empty--hidden') const pinnedCategory = await getOption('pinnedCategory')