From f83d8b648455a5c094cbf25308c7f47beefd14b3 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 24 Nov 2016 23:54:22 -0500 Subject: [PATCH] define top-level (root) context menu item. --- src/background.js | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/src/background.js b/src/background.js index ab764c12f9..7df5ed583a 100644 --- a/src/background.js +++ b/src/background.js @@ -92,35 +92,47 @@ function buildContextMenu(callback) { chrome.contextMenus.removeAll(function () { chrome.contextMenus.create({ type: 'normal', - id: 'autofill', + id: 'root', contexts: ['all'], - title: i18nService.autoFill + title: 'bitwarden' }, function () { chrome.contextMenus.create({ type: 'normal', - id: 'copy-username', + id: 'autofill', + parentId: 'root', contexts: ['all'], - title: i18nService.copyUsername + title: i18nService.autoFill }, function () { chrome.contextMenus.create({ type: 'normal', - id: 'copy-password', + id: 'copy-username', + parentId: 'root', contexts: ['all'], - title: i18nService.copyPassword + title: i18nService.copyUsername }, function () { - chrome.contextMenus.create({ - type: 'separator' - }); - chrome.contextMenus.create({ type: 'normal', - id: 'generate-password', + id: 'copy-password', + parentId: 'root', contexts: ['all'], - title: i18nService.generatePasswordCopied + title: i18nService.copyPassword }, function () { - if (callback) { - callback(); - } + chrome.contextMenus.create({ + type: 'separator', + parentId: 'root' + }); + + chrome.contextMenus.create({ + type: 'normal', + id: 'generate-password', + parentId: 'root', + contexts: ['all'], + title: i18nService.generatePasswordCopied + }, function () { + if (callback) { + callback(); + } + }); }); }); });