WebExtension module: Browser-action context menu to request permission for the current tab.
npm install webext-domain-permission-toggle{
"browser_action": { /* Firefox support */
"default_icon": "icon.png"
},
"permissions": [
"contextMenus",
"activeTab"
],
"optional_permissions": [
"http://*/*",
"https://*/*"
],
"background": {
"scripts": [
"webext-domain-permission-toggle.js",
"background.js"
]
}
}// background.js
import DPT from 'webext-domain-permission-toggle';DPT.addContextMenu();Adds an item to the browser action icon's context menu (as shown in the screenshot).
The user can access this menu by right clicking the icon. If your extension doesn't have any action or popup assigned to the icon, it will also appear with a left click.
Type: string
Default: 'Enable ${extensionName} on this domain'
The title of the action in the context menu.
Type: boolean string
Default: Do you want to reload this page to apply ${extensionName}?
If the user accepts the new permission, they will be asked to reload the current tab. Set a string to customize the message and false to avoid the reload and its request.
webext-dynamic-content-scripts: Automatically inject yourcontent_scriptson custom domains.webext-content-script-ping: One-file interface to detect whether your content scripts have loaded.webext-options-sync: Helps you manage and autosave your extension's options.webext-inject-on-install: Automatically add content scripts to existing tabs when your extension is installed.Awesome WebExtensions: A curated list of awesome resources for Web Extensions development.
MIT © Federico Brigante — Twitter

