mirror of
https://github.com/Jonnyan404/memos-bber.git
synced 2026-04-25 03:58:37 +09:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user