-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
30 lines (30 loc) · 762 Bytes
/
Copy pathbackground.js
File metadata and controls
30 lines (30 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
chrome.contextMenus.removeAll(); // Just for good measure
chrome.contextMenus.create({
id: "popup",
title: "Popup",
contexts: ["action"],
});
chrome.contextMenus.create({
id: "settings",
title: "Settings Page",
contexts: ["action"],
});
chrome.contextMenus.create({
id: "about",
title: "Licenses",
contexts: ["action"],
});
chrome.contextMenus.onClicked.addListener((onClickData) => {
switch (onClickData.menuItemId) {
case "popup":
chrome.action.openPopup();
break;
case "settings":
chrome.tabs.create({ url: "ui/settings-pages.html" });
break;
case "about":
chrome.tabs.create({ url: "ui/about.html" });
break;
default: console.error("Unrecognized menu item:", onClickData.menuItemId);
}
});