Firefox: add icons, rewrite viewer, update manifest

Add Firefox icon assets and update manifest to use the new icon files and opt-out data_collection_permissions. Replace minified view-image.js with a modern, readable implementation (style injection, accessible controls, keyboard navigation, and better DOM handling). Simplify background popup logic to call chrome.browserAction.openPopup directly. Remove the packaging section from README to clean up docs.
This commit is contained in:
jonny
2026-04-22 19:15:49 +08:00
parent cf75f087a7
commit 8f4b64a13f
7 changed files with 182 additions and 36 deletions
+3 -10
View File
@@ -99,24 +99,17 @@ function getSelectionTextFromTab(tabId, fallbackText) {
})
}
function getActionApi() {
if (chrome.action && typeof chrome.action.openPopup === 'function') return chrome.action
if (chrome.browserAction && typeof chrome.browserAction.openPopup === 'function') return chrome.browserAction
return null
}
function tryOpenActionPopup(tab) {
try {
const actionApi = getActionApi()
if (!actionApi) return
if (!chrome.browserAction || typeof chrome.browserAction.openPopup !== 'function') return
const windowId = tab && typeof tab.windowId === 'number' ? tab.windowId : undefined
const open = () => {
try {
if (typeof windowId === 'number') {
actionApi.openPopup({ windowId }, () => void chrome.runtime.lastError)
chrome.browserAction.openPopup({ windowId }, () => void chrome.runtime.lastError)
} else {
actionApi.openPopup({}, () => void chrome.runtime.lastError)
chrome.browserAction.openPopup({}, () => void chrome.runtime.lastError)
}
} catch (_) {
// best-effort only