blob: ac742abdf2d5eb0d209127708b897dad9ffc8e68 (
plain)
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
|
/* global browser */
browser.contextMenus.create(
{
id: 'map-inline-add',
title: 'Add Links and Maps by content',
contexts: ['page'],
},
)
browser.contextMenus.create(
{
id: 'map-inline-open',
title: 'Open in DumbyMap',
contexts: ['page', 'selection'],
},
() => browser.runtime.lastError,
)
browser.contextMenus.onClicked.addListener((info, tab) => {
const id = info.menuItemId
if (!id.match(/^map-inline/)) return
browser.tabs.sendMessage(tab.id, id)
})
browser.browserAction.onClicked.addListener((info) => {
browser.tabs.sendMessage(info.id, 'map-inline-add')
})
|