Safari compatibility improvements

main
Elbert Alias 4 years ago
parent da8506cadb
commit 4e55bc08d3

@ -189,7 +189,7 @@ a:hover {
.terms { .terms {
align-items: center; align-items: center;
display: none; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
padding: 1.5rem 1.5rem 1rem 1.5rem; padding: 1.5rem 1.5rem 1rem 1.5rem;

@ -55,9 +55,7 @@ const Driver = {
ads: await getOption('ads', []) ads: await getOption('ads', [])
} }
await promisify(chrome.browserAction, 'setBadgeBackgroundColor', { chrome.browserAction.setBadgeBackgroundColor({ color: '#6B39BD' }, () => {})
color: '#6B39BD'
})
chrome.webRequest.onCompleted.addListener( chrome.webRequest.onCompleted.addListener(
Driver.onWebRequestComplete, Driver.onWebRequestComplete,
@ -380,16 +378,18 @@ const Driver = {
;({ icon } = pinned || technologies[0] || { icon }) ;({ icon } = pinned || technologies[0] || { icon })
} }
const tabs = await promisify(chrome.tabs, 'query', { url }) ;(await promisify(chrome.tabs, 'query', { url })).forEach(
({ id: tabId }) => {
await Promise.all( chrome.browserAction.setBadgeText(
tabs.map(({ id: tabId }) => {
Promise.all([
promisify(chrome.browserAction, 'setBadgeText', {
tabId, tabId,
text: technologies.length.toString().toString() text: technologies.length.toString()
}), },
promisify(chrome.browserAction, 'setIcon', { () => {}
)
chrome.browserAction.setIcon(
{
tabId, tabId,
path: chrome.extension.getURL( path: chrome.extension.getURL(
`../images/icons/${ `../images/icons/${
@ -398,9 +398,10 @@ const Driver = {
: icon : icon
}` }`
) )
}) },
]) () => {}
) )
}
) )
}, },

@ -1,6 +1,6 @@
'use strict' 'use strict'
/* eslint-env browser */ /* eslint-env browser */
/* globals chrome, Utils */ /* globals Utils */
const { i18n, getOption, setOption } = Utils const { i18n, getOption, setOption } = Utils

@ -52,22 +52,22 @@ const Popup = {
document.querySelector('.terms').addEventListener('click', async () => { document.querySelector('.terms').addEventListener('click', async () => {
await setOption('termsAccepted', true) await setOption('termsAccepted', true)
document.querySelector('.terms').classList.remove('terms--hidden') document.querySelector('.terms').classList.add('terms--hidden')
document document.querySelector('.empty').classList.remove('empty--hidden')
.querySelector('.detections')
.classList.add('.detections--hidden')
document.querySelector('.empty').classList.add('empty--hidden')
chrome.runtime.sendMessage('getDetections', Popup.onGetDetections) chrome.runtime.sendMessage('getDetections', Popup.onGetDetections)
}) })
} }
// Alert // Alert
const [{ url }] = await promisify(chrome.tabs, 'query', { const tabs = await promisify(chrome.tabs, 'query', {
active: true, active: true,
currentWindow: true currentWindow: true
}) })
if (tabs && tabs.length) {
const [{ url }] = tabs
if (url.startsWith('http')) { if (url.startsWith('http')) {
document.querySelector('.alerts').classList.remove('alerts--hidden') document.querySelector('.alerts').classList.remove('alerts--hidden')
@ -79,6 +79,7 @@ const Popup = {
} else { } else {
document.querySelector('.alerts').classList.add('alerts--hidden') document.querySelector('.alerts').classList.add('alerts--hidden')
} }
}
document document
.querySelector('.footer__settings') .querySelector('.footer__settings')
@ -131,6 +132,7 @@ const Popup = {
} }
document.querySelector('.empty').classList.add('empty--hidden') document.querySelector('.empty').classList.add('empty--hidden')
document.querySelector('.detections').classList.remove('empty--hidden')
const pinnedCategory = await getOption('pinnedCategory') const pinnedCategory = await getOption('pinnedCategory')

Loading…
Cancel
Save