-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
2,583 additions
and
1,450 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
import chromeP from 'webext-polyfill-kinda'; | ||
import addDomainPermissionToggle from '..'; | ||
|
||
console.log('Extension ready. Reload any tab to see the logs.'); | ||
|
||
addDomainPermissionToggle(); | ||
|
||
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { | ||
chrome.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => { | ||
if (!tab.url) { | ||
console.log('No access to tab', tabId); | ||
return; | ||
} | ||
|
||
console.log('Access to tab', tabId, tab.url); | ||
chrome.scripting.executeScript({ | ||
target: {tabId}, | ||
function() { | ||
document.body.style.backgroundColor = 'yellow'; | ||
console.log('chrome.tabs.onUpdated was fired'); | ||
}, | ||
}); | ||
const why = await chromeP.permissions.contains({origins: [tab.url]}) ? 'granted' : 'just because of activeTab'; | ||
console.log('Access to tab', tabId, tab.url, why); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "webext-domain-permission-toggle", | ||
"version": "0.0.0", | ||
"manifest_version": 2, | ||
"permissions": [ | ||
"https://*.github.com/*", | ||
"activeTab", | ||
"contextMenus" | ||
], | ||
"browser_action": {}, | ||
"optional_permissions": [ | ||
"*://*/*" | ||
], | ||
"background": { | ||
"scripts": [ | ||
"../background.js" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.