Skip to content

Commit

Permalink
feat: add separator in context menus
Browse files Browse the repository at this point in the history
  • Loading branch information
igorlogius committed Jul 31, 2024
1 parent a1ee7a1 commit 2199067
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,15 @@ function onMessage(req) {
});

// add the 4 context entries
lastCmdgrp = "";
for (const cmd of Object.keys(manifest.commands)) {
if (cmd.slice(3, 6) !== lastCmdgrp) {
browser.menus.create({
contexts: ["tab"],
type: "separator",
});
lastCmdgrp = cmd.slice(3, 6);
}
browser.menus.create({
id: "" + cmd,
title: manifest.commands[cmd].description,
Expand All @@ -365,7 +373,16 @@ function onMessage(req) {
});

// add the 4 context entries
lastCmdgrp = "all";
for (const cmd of Object.keys(manifest.commands)) {
if (cmd.slice(3, 6) !== lastCmdgrp) {
browser.menus.create({
contexts: ["browser_action"],
parentId: "basela",
type: "separator",
});
lastCmdgrp = cmd.slice(3, 6);
}
browser.menus.create({
parentId: "basela",
title: manifest.commands[cmd].description,
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@
"description": "__MSG_addonDesc__",
"permissions": ["clipboardWrite", "storage", "menus", "tabs"],
"optional_permissions": ["notifications"],
"version": "1.16.50"
"version": "1.16.51"
}

0 comments on commit 2199067

Please sign in to comment.