Skip to content

Commit

Permalink
Migrate to MV3 (#144)
Browse files Browse the repository at this point in the history
Fixes #128 for Gecko
  • Loading branch information
asamuzaK authored Apr 5, 2023
1 parent e3b780c commit b72479c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"background": {
"page": "html/background.html",
"persistent": false
},
"browser_action": {
"action": {
"browser_style": true,
"default_icon": "img/icon.svg#current",
"default_popup": "html/popup.html",
"default_title": "__MSG_extensionName__"
},
"background": {
"scripts": ["mjs/background.js"],
"type": "module"
},
"browser_specific_settings": {
"gecko": {
"id": "[email protected]",
"strict_min_version": "102.0"
"strict_min_version": "112.0"
}
},
"commands": {
"_execute_browser_action": {
"_execute_action": {
"suggested_key": {
"default": "Alt+Shift+C"
}
Expand Down Expand Up @@ -75,7 +75,7 @@
"32": "img/icon.svg#current",
"64": "img/icon.svg"
},
"manifest_version": 2,
"manifest_version": 3,
"name": "__MSG_extensionName__",
"optional_permissions": [
"notifications"
Expand Down
3 changes: 1 addition & 2 deletions src/mjs/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import { ICON } from './constant.js';

/* api */
const { runtime } = browser;
const action = browser.action ?? browser.browserAction;
const { action, runtime } = browser;

/* variables */
export const icon = new Map();
Expand Down
4 changes: 2 additions & 2 deletions src/mjs/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const { WINDOW_ID_CURRENT } = windows;
export const menuItems = {
[OPTIONS_OPEN]: {
id: OPTIONS_OPEN,
contexts: ['browser_action'],
contexts: ['action'],
key: '(&T)'
},
[COPY_PAGE]: {
Expand Down Expand Up @@ -84,7 +84,7 @@ export const createMenuItem = async (id, title, data = {}) => {
if (parentId) {
opt.parentId = parentId;
}
if (contexts.includes('browser_action') || contexts.includes('tab')) {
if (contexts.includes('action') || contexts.includes('tab')) {
if (runtime.id === WEBEXT_ID) {
menus.create(opt);
}
Expand Down

0 comments on commit b72479c

Please sign in to comment.