Upload files to "MantisHelperPlugin"

master
Giteadmin 2023-09-08 22:17:31 +02:00
parent 0919e823c2
commit 939718f0c2
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,19 @@
chrome.runtime.onInstalled.addListener(() => {
chrome.contextMenus.create({
id: 'openInMantis',
title: 'Open in Mantis',
contexts: ['selection']
});
});
chrome.contextMenus.onClicked.addListener((info) => {
if (info.menuItemId === 'openInMantis') {
let selectedText = info.selectionText;
if (selectedText.startsWith('#')) {
selectedText = selectedText.substring(1);
}
const fixedUrl = 'https://ot.syncore.at/view.php?id=';
const completeUrl = `${fixedUrl}${selectedText}`;
chrome.tabs.create({ url: completeUrl });
}
});

View File

@ -0,0 +1,10 @@
{
"manifest_version": 3,
"name": "Open in Mantis",
"version": "1.0",
"permissions": ["contextMenus"],
"background": {
"service_worker": "background.js"
},
"description": "Open selected number in Mantis"
}