Upload files to "MantisHelperPlugin"
parent
271bd06a28
commit
2ac87511f9
|
|
@ -0,0 +1,20 @@
|
|||
browser.runtime.onInstalled.addListener(() => {
|
||||
browser.contextMenus.create({
|
||||
id: 'openInMantis',
|
||||
title: 'Open in Mantis',
|
||||
contexts: ['selection']
|
||||
});
|
||||
});
|
||||
|
||||
browser.contextMenus.onClicked.addListener(async (info) => {
|
||||
if (info.menuItemId === 'openInMantis') {
|
||||
let selectedText = info.selectionText;
|
||||
if (selectedText.startsWith('#')) {
|
||||
selectedText = selectedText.substring(1);
|
||||
}
|
||||
const result = await browser.storage.sync.get(['customUrl']);
|
||||
const fixedUrl = result.customUrl || 'https://example.com/view.php?id=';
|
||||
const completeUrl = `${fixedUrl}${selectedText}`;
|
||||
await browser.tabs.create({ url: completeUrl });
|
||||
}
|
||||
});
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1002 B |
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Mantis Helper",
|
||||
"version": "1.0.0.0",
|
||||
"permissions": ["contextMenus", "storage"],
|
||||
"background": {
|
||||
"scripts": ["background.js"]
|
||||
},
|
||||
"description": "Select a number on a website and open it in Mantis from the context menu",
|
||||
"options_ui": {
|
||||
"page": "options.html",
|
||||
"open_in_tab": true
|
||||
},
|
||||
"icons": {
|
||||
"16": "icon-16.png",
|
||||
"48": "icon-48.png",
|
||||
"128": "icon-128.png"
|
||||
},
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "mantis-helper@example.com",
|
||||
"strict_min_version": "57.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue