From 2199067a36ddd26602af9d076c7c05caabe9e847 Mon Sep 17 00:00:00 2001 From: igorlogius <67047467+igorlogius@users.noreply.github.com> Date: Wed, 31 Jul 2024 16:41:01 +0200 Subject: [PATCH] feat: add separator in context menus --- background.js | 17 +++++++++++++++++ manifest.json | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/background.js b/background.js index 990f636..b8e8829 100644 --- a/background.js +++ b/background.js @@ -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, @@ -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, diff --git a/manifest.json b/manifest.json index d154936..6c17362 100644 --- a/manifest.json +++ b/manifest.json @@ -54,5 +54,5 @@ "description": "__MSG_addonDesc__", "permissions": ["clipboardWrite", "storage", "menus", "tabs"], "optional_permissions": ["notifications"], - "version": "1.16.50" + "version": "1.16.51" }