aboutsummaryrefslogtreecommitdiffhomepage
path: root/addon/background.js
blob: 42e0c8d40b43fa94347e68d005cd43bd710c1c5c (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
console.log('background')

browser.contextMenus.create(
  {
    id: 'map-inline-add',
    title: 'Add Links and Maps by content',
    contexts: ['page'],
  },
  () => void browser.runtime.lastError,
)

browser.contextMenus.create(
  {
    id: 'map-inline-open',
    title: 'Open in DumbyMap',
    contexts: ['page', 'selection'],
  },
  () => void 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)
})