Fixed reverse tab for context menu for chromium

This commit is contained in:
ManeraKai 2023-03-05 20:07:11 +03:00
parent c5cd80da59
commit 10b4fd9601
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
2 changed files with 9 additions and 5 deletions

View File

@ -7,9 +7,9 @@ window.browser = window.browser || window.chrome
let exceptions let exceptions
function isException(url) { function isException(url) {
if (url !== undefined) { if (exceptions && url) {
for (const item of exceptions.url) if (item == url.href) return true if (exceptions.url) for (const item of exceptions.url) if (item == url.href) return true
for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true if (exceptions.regex) for (const item of exceptions.regex) if (new RegExp(item).test(url.href)) return true
} }
return false return false
} }

View File

@ -176,8 +176,12 @@ browser.contextMenus.onClicked.addListener(async (info) => {
return return
} }
case 'copyReverseTab': { case 'copyReverseTab': {
const url = new URL(info.pageUrl) browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
servicesHelper.copyRaw(url) if (tabs[0].url) {
const url = new URL(tabs[0].url)
servicesHelper.copyRaw(url)
}
})
return return
} }
case 'reverseTab': { case 'reverseTab': {