From be68dcda2a9e9238db80c4f11733425d62400448 Mon Sep 17 00:00:00 2001 From: Kepi Date: Mon, 22 Mar 2021 16:01:36 +0100 Subject: [PATCH] Fix Can't pick colors from web. Fixes #166 Not sure how I missed this when testing, but should be ok now. --- src/popup.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/popup.js b/src/popup.js index fbbcd1b..f7864a7 100644 --- a/src/popup.js +++ b/src/popup.js @@ -179,7 +179,7 @@ function bgPageReady() { * */ -function pickButton(enabled, message = '') { +function pickButton(tab, enabled, message = '') { let pick_el = document.getElementById('pick') if (enabled) { pick_el.onclick = () => { @@ -211,21 +211,23 @@ function initPickButton(tab) { // special chrome pages if (tab.url === undefined || tab.url.indexOf('chrome') == 0) { pickButton( + tab, false, "Chrome doesn't allow extensions to play with special Chrome pages like this one.
chrome://...
", ) } // chrome gallery else if (tab.url.indexOf('https://chrome.google.com/webstore') == 0) { - pickButton(false, "Chrome doesn't allow its extensions to play on Web Store.") + pickButton(tab, false, "Chrome doesn't allow its extensions to play on Web Store.") } // local pages else if (tab.url.indexOf('file') === 0) { chrome.extension.isAllowedFileSchemeAccess((isAllowedAccess) => { if (isAllowedAccess) { - pickButton(true) + pickButton(tab, true) } else { pickButton( + tab, false, 'Eye Dropper can\'t access local pages unless you grant it the permission. Check the instructions how to allow it.', ) @@ -233,7 +235,7 @@ function initPickButton(tab) { } }) } else { - pickButton(true) + pickButton(tab, true) } }