Delete background.js

master
Giteadmin 2023-09-10 18:11:07 +02:00
parent ae41f4b661
commit 1cdd76d8fc
1 changed files with 0 additions and 20 deletions

View File

@ -1,20 +0,0 @@
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 });
}
});