Upload files to "/"

master
Giteadmin 2023-09-10 18:10:49 +02:00
parent 567787b6d4
commit ae41f4b661
5 changed files with 45 additions and 0 deletions

20
background.js Normal file
View File

@ -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 });
}
});

BIN
icon-128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
icon-16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1002 B

BIN
icon-48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

25
manifest.json Normal file
View File

@ -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"
}
}
}