-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbackground.js
More file actions
32 lines (28 loc) · 772 Bytes
/
background.js
File metadata and controls
32 lines (28 loc) · 772 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
31
32
// ===== initialize settings on installation
async function handleInstalled() {
await browser.storage.local.set({
extensionEnabled: true,
imagesEnabled: true,
type: "Deuteranopia" // default
})
// open extension page on installation
// browser.tabs.create({
// url: "/index.html"
// })
}
browser.runtime.onInstalled.addListener(handleInstalled)
// ===== initialize context menu for single image adjustment on right click
browser.menus.create(
{
id: "colorcue-adjust-single-image",
title: "Adjust Single Image",
contexts: ["image"],
enabled: true
}
)
browser.menus.onClicked.addListener((info, tab) => {
browser.tabs.sendMessage(tab.id, {
action: 'adjustSingleImage',
targetElementId: info.targetElementId
})
})