feat: add Firefox support with cross-browser compatibility

Add manifest.firefox.json for Firefox MV3 (gecko ID, background
scripts instead of service_worker, options_ui). Introduce
browser-polyfill.js shim so all modules use whichever API is
available (browser.* or chrome.*). Add build.sh to target
chrome, firefox, or both.

https://claude.ai/code/session_01Dvgwe7XMoSxnWXkih8p1Cw
This commit is contained in:
Claude
2026-03-25 23:36:59 +00:00
parent 4576597e64
commit 3ef5df7efb
8 changed files with 191 additions and 36 deletions
+4 -3
View File
@@ -1,5 +1,6 @@
import SubstitutionEngine from '../lib/substitution-engine.js';
import Storage from '../lib/storage.js';
import api from '../lib/browser-polyfill.js';
// --- State ---
let mappings = [];
@@ -37,7 +38,7 @@ document.addEventListener('DOMContentLoaded', async () => {
settings.enabled = e.target.checked;
await Storage.saveSettings(settings);
updateStatusDot();
chrome.runtime.sendMessage({
api.runtime.sendMessage({
type: 'update:settings',
settings,
});
@@ -48,7 +49,7 @@ document.addEventListener('DOMContentLoaded', async () => {
settings.revealMode = !settings.revealMode;
await Storage.saveSettings(settings);
$('#btnReveal').classList.toggle('active', settings.revealMode);
chrome.runtime.sendMessage({
api.runtime.sendMessage({
type: 'update:settings',
settings,
});
@@ -74,7 +75,7 @@ document.addEventListener('DOMContentLoaded', async () => {
// Options link
$('#btnOptions').addEventListener('click', (e) => {
e.preventDefault();
chrome.runtime.openOptionsPage();
api.runtime.openOptionsPage();
});
});