diff --git a/extension/manifest.json b/extension/manifest.json index dee320f..74e1e6b 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Leo Translate", - "version": "1.8.6", + "version": "1.8.7", "description": "Translate words on the internet pages using LinguaLeo API and add words to the LinguaLeo Dictionary.", diff --git a/src/entry/background.js b/src/entry/background.js index 4f81827..2d1012b 100644 --- a/src/entry/background.js +++ b/src/entry/background.js @@ -10,21 +10,23 @@ import { import { removeHtmlTags } from '../helpers'; // Create context item -chrome.contextMenus.create({ - id: 'leo-translate', - title: 'Translate with Leo', - contexts: ['selection'], - onclick: (info, tab) => { - chrome.tabs.sendMessage(tab.id, { - id: CONTENT_OPEN_POPUP, - text: info.selectionText, - context: '' - }); - }, - icons: { - '16': '../icons/icon.svg' - } -}); +if (chrome.contextMenus !== undefined) { + chrome.contextMenus.create({ + id: 'leo-translate', + title: 'Translate with Leo', + contexts: ['selection'], + onclick: (info, tab) => { + chrome.tabs.sendMessage(tab.id, { + id: CONTENT_OPEN_POPUP, + text: info.selectionText, + context: '' + }); + }, + icons: { + '16': '../icons/icon.svg' + } + }); +} // Listen for message to show in system notification chrome.runtime.onMessage.addListener((message, sender) => {