published version in webstore

This commit is contained in:
dwindown
2025-09-06 23:58:42 +07:00
parent a21f9927e4
commit 6b1efab615
11 changed files with 619 additions and 136 deletions

View File

@@ -1,6 +1,9 @@
// Let Chrome open the panel when the toolbar icon is clicked
// Guard: some Chromium variants may not expose sidePanel
const hasSidePanel = !!chrome.sidePanel?.setOptions;
chrome.runtime.onInstalled.addListener(() => {
chrome.sidePanel?.setPanelBehavior?.({ openPanelOnActionClick: true });
if (hasSidePanel) chrome.sidePanel.setPanelBehavior?.({ openPanelOnActionClick: true });
});
// If you still want to ensure the correct path on click, setOptions ONLY:
@@ -19,7 +22,8 @@ chrome.action.onClicked.addListener(async () => {
try { await chrome.scripting.executeScript({ target: { tabId: tab.id }, files: ['content.js'] }); } catch {}
}
await chrome.sidePanel.setOptions({ tabId: tab.id, path: "panel.html" }); // Chrome opens it
await chrome.sidePanel.setOptions({ tabId: tab.id, path: "panel.html" });
try { await chrome.sidePanel.open({ tabId: tab.id }); } catch {}
});
// Keyboard shortcut: we do open() here (this is a user gesture)