From 9053327486f624509309cbc785707bdcff8f100d Mon Sep 17 00:00:00 2001 From: Oliver Herb Date: Tue, 24 Nov 2026 09:27:49 +0100 Subject: [PATCH] Inline Comment 0.2.0 - initial public release Thunderbird/Betterbird add-on (Manifest V3): typing inside a quote splits the quote and inserts your own text with a marker such as [OH]:. - English and German user interface - Licensed under the Mozilla Public License 2.0 - English documentation, JSDoc lint gate, 87 tests (node:test + jsdom) --- .docs/architecture/overview.md | 102 + .docs/architecture/system-design.md | 107 + .docs/components/background.md | 40 + .docs/components/compose-script.md | 29 + .docs/components/i18n.md | 97 + .docs/components/options.md | 61 + .docs/decisions/0001-manifest-v3.md | 26 + .../decisions/0002-split-quote-via-editor.md | 27 + .docs/decisions/0003-keydown-as-trigger.md | 24 + .docs/decisions/0004-licence-mpl-2.0.md | 59 + .docs/decisions/0005-no-markup-sinks.md | 53 + .docs/guides/development.md | 142 ++ .docs/guides/testplan.md | 55 + .gitattributes | 2 + .gitignore | 4 + .plan/daily/2026-11-24.md | 53 + .plan/roadmap.md | 31 + .plan/sprints/.gitkeep | 0 .prettierignore | 3 + .prettierrc.json | 1 + CHANGELOG.md | 50 + CONTRIBUTING.md | 87 + LICENSE | 373 ++++ README.de.md | 245 +++ README.md | 239 +++ eslint.config.mjs | 109 + listing/README.md | 69 + listing/description.de.md | 51 + listing/description.en.md | 51 + listing/notes-to-reviewers.md | 33 + listing/privacy-policy.de.md | 22 + listing/privacy-policy.en.md | 22 + package-lock.json | 1910 +++++++++++++++++ package.json | 33 + scripts/build.sh | 32 + src/_locales/de/messages.json | 224 ++ src/_locales/en/messages.json | 224 ++ src/background.js | 432 ++++ src/compose/compose.js | 446 ++++ src/icons/icon.svg | 17 + src/lib/i18n.js | 147 ++ src/lib/marker.js | 321 +++ src/lib/quote.js | 534 +++++ src/lib/settings.js | 261 +++ src/manifest.json | 31 + src/options/options.css | 183 ++ src/options/options.html | 189 ++ src/options/options.js | 480 +++++ test/compose.test.js | 457 ++++ test/dom-sinks.test.js | 92 + test/helpers/dom.js | 100 + test/i18n.test.js | 519 +++++ test/license.test.js | 164 ++ test/manifest.test.js | 108 + test/marker.test.js | 211 ++ test/quote.test.js | 366 ++++ test/settings.test.js | 101 + 57 files changed, 9849 insertions(+) create mode 100644 .docs/architecture/overview.md create mode 100644 .docs/architecture/system-design.md create mode 100644 .docs/components/background.md create mode 100644 .docs/components/compose-script.md create mode 100644 .docs/components/i18n.md create mode 100644 .docs/components/options.md create mode 100644 .docs/decisions/0001-manifest-v3.md create mode 100644 .docs/decisions/0002-split-quote-via-editor.md create mode 100644 .docs/decisions/0003-keydown-as-trigger.md create mode 100644 .docs/decisions/0004-licence-mpl-2.0.md create mode 100644 .docs/decisions/0005-no-markup-sinks.md create mode 100644 .docs/guides/development.md create mode 100644 .docs/guides/testplan.md create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .plan/daily/2026-11-24.md create mode 100644 .plan/roadmap.md create mode 100644 .plan/sprints/.gitkeep create mode 100644 .prettierignore create mode 100644 .prettierrc.json create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.de.md create mode 100644 README.md create mode 100644 eslint.config.mjs create mode 100644 listing/README.md create mode 100644 listing/description.de.md create mode 100644 listing/description.en.md create mode 100644 listing/notes-to-reviewers.md create mode 100644 listing/privacy-policy.de.md create mode 100644 listing/privacy-policy.en.md create mode 100644 package-lock.json create mode 100644 package.json create mode 100755 scripts/build.sh create mode 100644 src/_locales/de/messages.json create mode 100644 src/_locales/en/messages.json create mode 100644 src/background.js create mode 100644 src/compose/compose.js create mode 100644 src/icons/icon.svg create mode 100644 src/lib/i18n.js create mode 100644 src/lib/marker.js create mode 100644 src/lib/quote.js create mode 100644 src/lib/settings.js create mode 100644 src/manifest.json create mode 100644 src/options/options.css create mode 100644 src/options/options.html create mode 100644 src/options/options.js create mode 100644 test/compose.test.js create mode 100644 test/dom-sinks.test.js create mode 100644 test/helpers/dom.js create mode 100644 test/i18n.test.js create mode 100644 test/license.test.js create mode 100644 test/manifest.test.js create mode 100644 test/marker.test.js create mode 100644 test/quote.test.js create mode 100644 test/settings.test.js diff --git a/.docs/architecture/overview.md b/.docs/architecture/overview.md new file mode 100644 index 0000000..194bcb4 --- /dev/null +++ b/.docs/architecture/overview.md @@ -0,0 +1,102 @@ +# Architecture – Overview + +## Building blocks + +```text +Thunderbird / Betterbird +├── Background script (src/background.js) event page, Manifest V3 +│ ├── registers the compose script (scripting.compose) +│ ├── keeps the on/off state per compose window (storage.session, else in memory) +│ ├── "Inline Comment" toolbar button (composeAction, badge "on"/"off") +│ └── delivers the configuration: settings + identity + on/off + plain text? +│ +├── Compose script (src/compose/compose.js) in the editor document of every compose window +│ ├── intercepts typed characters inside a quote (keydown, fallback: beforeinput) +│ ├── splits the quote (editor command insertParagraph, fallback: manual split) +│ └── inserts the comment with its marker (insertHTML or insertText) +│ +├── Options page (src/options/) settings in storage.local, localized texts +│ +├── Translations (src/_locales/{en,de}/messages.json) default locale: en +│ +└── Shared library (src/lib/) classic UMD scripts, testable under Node + ├── settings.js defaults, validation, profiles per identity, compose script file list + ├── marker.js placeholders, initials, comment as DOM node or plain text + ├── quote.js quote and gap detection, manual split, caret placement + └── i18n.js localizeDocument() for data-i18n attributes (options page) +``` + +The library files attach their functions to `globalThis.InlineComment` and also export them through +`module.exports`, so the same file runs in the add-on and in the Node tests. They are classic scripts +rather than ES modules because compose scripts cannot load modules. + +## What runs where + +| Context | Scripts, in load order | Defined in | +| -------------- | ------------------------------------------------------------------------ | ------------------------------------------- | +| Background | `lib/settings.js`, `lib/marker.js`, `background.js` | `manifest.json` → `background` | +| Compose window | `lib/settings.js`, `lib/marker.js`, `lib/quote.js`, `compose/compose.js` | `COMPOSE_SCRIPT_FILES` in `lib/settings.js` | +| Options page | `lib/settings.js`, `lib/marker.js`, `lib/i18n.js`, `options/options.js` | ` + + + + + diff --git a/src/options/options.js b/src/options/options.js new file mode 100644 index 0000000..3de9828 --- /dev/null +++ b/src/options/options.js @@ -0,0 +1,480 @@ +/* + * Copyright 2026 Oliver Herb + * SPDX-License-Identifier: MPL-2.0 + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +/* + * Options page script: edits the settings for all sender identities (the + * global profile) and optional own profiles per sender identity, shows a live + * preview of the comment and resets a profile to the defaults. There is no + * save button: changes are saved automatically 300 ms after the last edit. + * + * Runs on the options page only (manifest "options_ui", options.html). The + * Node tests (test/i18n.test.js) also run it in jsdom with a fake WebExtension + * API. It is not loaded in the background or in the compose editor. + * + * Needs these scripts loaded first (options.html does this): lib/settings.js, + * lib/marker.js and lib/i18n.js, which attach their functions to + * globalThis.InlineComment. Its