Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions how-to-add-github-enterprise-support-to-web-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@

You can implement the feature effortlessly by using these 2 modules:

[webext-domain-permission-toggle](https://github.com/fregante/webext-domain-permission-toggle) will add a toggle in the Browser Action icon that will let the user requestion permission to any domain.
[webext-permission-toggle](https://github.com/fregante/webext-permission-toggle) will add a toggle in the Browser Action icon that will let the user requestion permission to any domain.

[webext-dynamic-content-scripts](https://github.com/fregante/webext-dynamic-content-scripts) will use this permission to inject the content scripts you declared in `manifest.json`, but instead of injecting just on the default domain (github.com) they'll be injected on all the new domains that the user added.

## background.js

```js
addDomainPermissionToggle();
addPermissionToggle();
```

or if you use a bundler:

```js
import 'webext-dynamic-content-scripts';
import addDomainPermissionToggle from 'webext-domain-permission-toggle';
import addPermissionToggle from 'webext-permission-toggle';

addDomainPermissionToggle();
addPermissionToggle();
```

## manifest.json v3 example
Expand All @@ -33,9 +33,9 @@ addDomainPermissionToggle();
"permissions": [
"scripting",
"contextMenus",
"activeTab" // Required for Firefox support (webext-domain-permission-toggle)
"activeTab" // Required for Firefox support (webext-permission-toggle)
],
"action": { // Required for Firefox support (webext-domain-permission-toggle)
"action": { // Required for Firefox support (webext-permission-toggle)
"default_icon": "icon.png"
},
"optional_host_permissions": [
Expand All @@ -62,17 +62,17 @@ addDomainPermissionToggle();
"permissions": [
"https://github.com/*",
"contextMenus",
"activeTab" // Required for Firefox support (webext-domain-permission-toggle)
"activeTab" // Required for Firefox support (webext-permission-toggle)
],
"browser_action": { // Required for Firefox support (webext-domain-permission-toggle)
"browser_action": { // Required for Firefox support (webext-permission-toggle)
"default_icon": "icon.png"
},
"optional_permissions": [
"*://*/*"
],
"background": {
"scripts": [
"webext-domain-permission-toggle.js",
"webext-permission-toggle.js",
"webext-dynamic-content-scripts.js",
"background.js"
]
Expand Down
Loading