mirror of
https://github.com/lifegpc/bookdownload.git
synced 2026-06-25 21:27:36 +08:00
Add context menus
This commit is contained in:
@@ -69,7 +69,8 @@
|
||||
"page": "dist/settings.html"
|
||||
},
|
||||
"permissions": [
|
||||
"storage"
|
||||
"storage",
|
||||
"contextMenus"
|
||||
],
|
||||
"background": {
|
||||
"service_worker": "dist/background.js",
|
||||
|
||||
@@ -41,3 +41,19 @@ chrome.runtime.onMessage.addListener((message: SendMessage, sender, sendResponse
|
||||
return true; // Indicates that the response will be sent asynchronously
|
||||
}
|
||||
});
|
||||
|
||||
chrome.runtime.onInstalled.addListener(() => {
|
||||
chrome.contextMenus.create({
|
||||
id: 'manage',
|
||||
title: '管理数据库',
|
||||
contexts: ['action'],
|
||||
});
|
||||
});
|
||||
|
||||
chrome.contextMenus.onClicked.addListener((info, tab) => {
|
||||
if (info.menuItemId === 'manage') {
|
||||
chrome.tabs.create({
|
||||
url: chrome.runtime.getURL('dist/manage.html'),
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user