Version in base suite: 8.1.5-1 Base version: allow-html-temp_8.1.5-1 Target version: allow-html-temp_10.0.4-1~deb12u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/a/allow-html-temp/allow-html-temp_8.1.5-1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/a/allow-html-temp/allow-html-temp_10.0.4-1~deb12u1.dsc .gitignore | 12 README.md | 102 +- _locales/de/messages.json | 308 ++++----- _locales/dsb/messages.json | 308 ++++----- _locales/en/messages.json | 308 ++++----- _locales/fr/messages.json | 155 ++++ _locales/hsb/messages.json | 308 ++++----- _locales/ja/messages.json | 308 ++++----- api/LegacyPrefs/README.md | 103 +-- api/LegacyPrefs/implementation.js | 419 ++++++------ api/LegacyPrefs/schema.json | 266 +++---- api/allowHtmlTemp/implementation.js | 484 +++++++------- api/allowHtmlTemp/schema.json | 181 +++-- api/messageContentPolicy/implementation.js | 613 ++++++++---------- api/messageContentPolicy/schema.json | 153 ++-- api/remoteContent/implementation.js | 82 ++ api/remoteContent/schema.json | 35 + debian/changelog | 36 + debian/control | 5 debian/copyright | 2 debian/upstream/metadata | 1 debian/watch | 2 icons/aht_addon_icon.svg | 22 icons/aht_button_supernova_color.svg | 10 icons/aht_button_supernova_color_plus.svg | 12 icons/aht_button_supernova_plaintext.svg | 10 icons/aht_button_supernova_plaintext_lightdarkcss.svg | 17 icons/aht_button_supernova_sanitized.svg | 8 icons/aht_button_supernova_sanitized_lightdarkcss.svg | 16 icons/aht_icon.svg | 14 icons/aht_statusbar_color.svg | 18 icons/aht_statusbar_feed.svg | 8 icons/aht_statusbar_plaintext.svg | 26 icons/aht_statusbar_plaintext_contextcolor.svg | 26 icons/aht_statusbar_plaintext_inverted.svg | 26 icons/aht_statusbar_sanitized.svg | 10 icons/aht_statusbar_sanitized_contextcolor.svg | 10 icons/aht_statusbar_sanitized_inverted.svg | 10 manifest.json | 187 ++--- options/options_ui.css | 346 +++++----- options/options_ui.html | 348 +++++----- options/options_ui.js | 68 - options/options_ui_listeners.js | 328 ++++----- options/options_ui_save-restore.js | 391 +++++------ scripts/aht_functions.js | 330 +++------ scripts/background.js | 238 ++++++ scripts/debug.js | 18 scripts/i18n.js | 98 +- scripts/options.js | 208 +++--- scripts/options_defaults.js | 36 - scripts/update_ui.js | 340 +++------ 51 files changed, 3858 insertions(+), 3512 deletions(-) diff -Nru allow-html-temp-8.1.5/.gitignore allow-html-temp-10.0.4/.gitignore --- allow-html-temp-8.1.5/.gitignore 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/.gitignore 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -# Windows -# thumbnails -Thumbs.db - -# Mac OS X -# metadata -.DS_Store -# thumbnails -._* - -# Visual Studio Code -.vscode/ diff -Nru allow-html-temp-8.1.5/README.md allow-html-temp-10.0.4/README.md --- allow-html-temp-8.1.5/README.md 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/README.md 2024-06-18 15:43:06.000000000 +0000 @@ -1,50 +1,54 @@ -***Allow HTML Temp*** - --------- - -### Features - -* Allows to have HTML temporarily allowed in the currently displayed message by only one click. When switching to another message, it'll be shown automatically again in plain text or sanitized html mode (according to your default mode). - -### Version series - -* Version 8.* - Thunderbird 102.* - Migrated to a MailExtension using own experiment APIs -* Version 7.* - Thunderbird 91.* -* Version 6.* - Thunderbird 78.* -* Version 5.* - Thunderbird 68.* - -### Known issues - -* It's not possible to use the provided functions to easily print, forward or answer with HTML temporarily allowed. It seems there is no possibility to implement these repeatedly requested features by an addon. It would be necessary to change Thunderbird core functions, to get these things working. If you are interested in getting the whole functionality build in Thunderbirds core, then contribute to the RFE [Bug 1598857](https://bugzilla.mozilla.org/show_bug.cgi?id=1598857). - -### Installation - -1. [Download Allow HTML Temp from the official Thunderbird add-on page](https://addons.thunderbird.net/addon/allow-html-temp/) -2. [Installing an Add-on in Thunderbird](https://support.mozilla.org/kb/installing-addon-thunderbird) - - -### Contribution - -You are welcomed to contribute to this project by: -* adding or improving the localizations of AttachmentExtractor Continued via email to me or a post in german Thunderbird forums [Thunderbird Mail DE](https://www.thunderbird-mail.de/forum/board/81-hilfe-und-fehlermeldungen-zu-thunders-add-ons/) or just create an [issue](https://gitlab.com/ThunderbirdMailDE/allow-html-temp/issues/) here on GitLab -* creating [issues](https://gitlab.com/ThunderbirdMailDE/allow-html-temp/issues/) about problems -* creating [issues](https://gitlab.com/ThunderbirdMailDE/allow-html-temp/issues/) about possible improvements - - -### Coders - -* Alexander Ihrig (Original Author and Maintainer) -* John Bieling (Addon developer support) - -### Translators - -* de - Alexander Ihrig -* dsb - milupo -* en - Alexander Ihrig -* hsb - milupo -* ja - ysdev1 - - -### License - +***Allow HTML Temp*** + +-------- + +### Features + +* Allows to have HTML temporarily allowed in the currently displayed message by only one click. When switching to another message, it'll be shown automatically again in plain text or sanitized html mode (according to your default mode). + +### Version series + +* Version 10.* - Thunderbird 128.* - ESMification +* Version 9.* - Thunderbird 115.* Supernova - Partially rewritten including conceptual changes to fit for Thunderbird Supernova UI and internal code changes +* Version 8.* - Thunderbird 102.* - Migrated to a MailExtension using own experiment APIs +* Version 7.* - Thunderbird 91.* +* Version 6.* - Thunderbird 78.* +* Version 5.* - Thunderbird 68.* + +### Known issues + +* It's not possible to use the provided functions to easily print, forward or answer with HTML temporarily allowed. It seems there is no possibility to implement these repeatedly requested features by an addon. It would be necessary to change Thunderbird core functions, to get these things working. If you are interested in getting the whole functionality build in Thunderbirds core, then contribute to the RFE [Bug 1598857](https://bugzilla.mozilla.org/show_bug.cgi?id=1598857). + +### Installation + +1. [Download Allow HTML Temp from the official Thunderbird add-on page](https://addons.thunderbird.net/addon/allow-html-temp/) +2. [Installing an Add-on in Thunderbird](https://support.mozilla.org/kb/installing-addon-thunderbird) + + +### Contribution + +You are welcomed to contribute to this project by: +* adding or improving the localizations of AttachmentExtractor Continued via email to me or a post in german Thunderbird forums [Thunderbird Mail DE](https://www.thunderbird-mail.de/forum/board/81-hilfe-und-fehlermeldungen-zu-thunders-add-ons/) or just create an [issue](https://gitlab.com/ThunderbirdMailDE/allow-html-temp/issues/) here on GitLab +* creating [issues](https://gitlab.com/ThunderbirdMailDE/allow-html-temp/issues/) about problems +* creating [issues](https://gitlab.com/ThunderbirdMailDE/allow-html-temp/issues/) about possible improvements + + +### Coders + +* Alexander Ihrig (Original Author and Maintainer) +* John Bieling (Addon developer support) +* Jonathan Kamens (RemoteContent policy API based on his work) + +### Translators + +* de - Alexander Ihrig +* dsb - milupo +* en - Alexander Ihrig +* fr - DenB10 +* hsb - milupo +* ja - ysdev1 + + +### License + [Mozilla Public License version 2.0](https://gitlab.com/ThunderbirdMailDE/allow-html-temp/LICENSE) \ No newline at end of file diff -Nru allow-html-temp-8.1.5/_locales/de/messages.json allow-html-temp-10.0.4/_locales/de/messages.json --- allow-html-temp-8.1.5/_locales/de/messages.json 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/_locales/de/messages.json 2022-05-27 15:10:56.000000000 +0000 @@ -1,155 +1,155 @@ -{ - "extensionName": { - "message": "Allow HTML Temp" - }, - "extensionDescription": { - "message": "Erlaubt HTML per Klick temporär für die aktuelle Nachricht" - }, - - "button_label": { - "message": "HTML zeigen" - }, - "button_tooltip": { - "message": "Text oder HTML temporär anzeigen" - }, - "button_label_html": { - "message": "HTML zeigen" - }, - "button_label_sanitized": { - "message": "HTML zeigen" - }, - "button_label_plaintext": { - "message": "Reiner Text" - }, - - "optionPageTitle_label": { - "message": "Allow HTML Temp - Einstellungen" - }, - "optionGeneralDescription_label": { - "message": "Um Schad-Software wie \"Locky\" und \"Tesla\" vorzubeugen, sollten HTML und JavaScript für E-Mail deaktiviert bzw. eingeschränkt werden und E-Mail-Anhänge nicht eingebunden angezeigt werden. JavaScript wird durch Thunderbird sowieso immer eingeschränkt." - }, - - "optionHTML_label": { - "message": "HTML in E-Mail" - }, - "optionHTMLDescription_label": { - "message": "Hier sollte als Standard eine eingeschränkte Darstellung gewählt werden." - }, - "optionHTMLDescriptionWarning_label": { - "message": "Es handelt sich hier um eine Einstellung von Thunderbird selbst, die Sie in Thunderbird im Menü \"Ansicht\" → \"Nachrichteninhalt\" finden. Wenn Sie dieses Add-on deinstallieren, bleibt die gewählte Option erhalten, aber Sie können die Option in Thunderbird auch ohne dieses Add-on ändern.", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionAppHTML_label": { - "message": "Standard-Einstellung:" - }, - "optionButtonHTML_label": { - "message": "Klick auf \"HTML zeigen\":" - }, - "optionNotRecommended_label": { - "message": "(nicht empfohlen)" - }, - "optionOriginalHTML_label": { - "message": "Original HTML" - }, - "optionSanitizedHTML_label": { - "message": "Vereinfachtes HTML" - }, - "optionPlaintext_label": { - "message": "Reiner Text" - }, - "optionAllBodyParts_label": { - "message": "Alle Teile des Inhalts" - }, - - "optionAdditionalOptions_label": { - "message": "Weitere Optionen" - }, - "optionAllwaysVersusClickDescription_label": { - "message": "Bei der Anzeige von Original HTML können weitere, optionale Inhalte aktiviert werden. Diese Optionen für Original HTML können Sie mit den folgenden Einstellungen global zulassen oder nur jeweils für die temporäre Funktion \"HTML zeigen\" erlauben." - }, - "optionRemoteContent_label": { - "message": "Externe Inhalte (Grafiken, Stylesheets, etc.)" - }, - "optionAllwaysRemoteContent_label": { - "message": "Externe Inhalte in Nachrichten global erlauben" - }, - "optionAllwaysRemoteContentWarning_label": { - "message": "Es handelt sich hier um eine Einstellung von Thunderbird selbst, die Sie in Thunderbird in den Einstellungen im Bereich \"Datenschutz & Sicherheit\" → \"Externe Inhalte in Nachrichten erlauben\" finden. Wenn Sie dieses Add-on deinstallieren, bleibt die gewählte Option erhalten, aber Sie können die Option in Thunderbird auch ohne dieses Add-on ändern.", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionTempRemoteContent_label": { - "message": "Bei Klick auf \"HTML zeigen\" für die eine Nachricht erlauben" - }, - "optionAttachments_label": { - "message": "Anhänge" - }, - "optionAttachmentsAllwaysInline_label": { - "message": "Anhänge immer eingebunden anzeigen (nicht empfohlen)" - }, - "optionAttachmentsTempInlineWarning_label": { - "message": "Es handelt sich hier um eine Einstellung von Thunderbird selbst, die Sie in Thunderbird im Menü \"Ansicht\" → \"Anhänge eingebunden anzeigen\" finden. Wenn Sie dieses Add-on deinstallieren, bleibt die gewählte Option erhalten, aber Sie können die Option in Thunderbird auch ohne dieses Add-on ändern.", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionAttachmentsTempInline_label": { - "message": "Bei Klick auf \"HTML zeigen\" temporär eingebunden anzeigen" - }, - - "optionCommandKeyHeader_label": { - "message": "Kurzbefehl" - }, - "optionCommandKeyDescription_label": { - "message": "Die hier in den Optionen festgelegte Funktion der Schaltfläche kann auch per Kurzbefehl ausgeführt werden. Sie können den Kurzbefehl bei Bedarf anpassen. Der Kurzbefehl wird als Zeichenfolge angegeben, die aus 2 oder 3 Tasten bestehen muss, die durch \"+\" verbunden sind. Beispiel: \"Ctrl+Alt+F5\" (3 Tasten - dies ist der Standard-Kurzbefehl) oder \"Ctrl+F5\" (2 Tasten).", - "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." - }, - "optionCommandKeyRulesText_label": { - "message": "Die auf MDN beschriebenen Regeln für Kurzbefehle müssen beachtet werden." - }, - "optionCommandKey_label": { - "message": "Kurzbefehl für \"HTML zeigen\":" - }, - "optionCommandKeyWarning_label": { - "message": "Der gewählte Kurzbefehl ist nicht gültig. Deshalb wird der Standard \"Ctrl+Alt+F5\" verwendet.", - "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." - }, - - "optionDebugHeader_label": { - "message": "Debug-Modus" - }, - "optionDebugDescription_label": { - "message": "Meldungen werden in der Fehlerkonsole protokolliert." - }, - "optionDebug_label": { - "message": "Debug-Modus aktivieren" - }, - - "optionResetAllOptionsHeader_label": { - "message": "Alle Optionen zurücksetzen" - }, - "optionResetAllOptionsDescription_label": { - "message": "Klicken, um alle Optionen auf die Standardwerte zurückzusetzen." - }, - "optionResetAllOptionsDescription2_label": { - "message": "Klicken, um alle Optionen auf Thunderbirds Standardwerte oder auf empfohlene Werte zurückzusetzen." - }, - "optionButtonResetToDefault_label": { - "message": "Thunderbird Standard" - }, - "optionButtonResetToRecommended_label": { - "message": "Empfohlen" - }, - "optionButtonReset_label": { - "message": "Zurücksetzen" - }, - - "uninstallResetDialog_label": { - "message": "Allow HTML Temp wird deaktiviert oder deinstalliert.\n\n Sollen Thunderbirds Einstellungen zu \"Nachrichteninhalt\" (HTML-Modus), \"Anhänge eingebunden anzeigen\" und \"Externe Inhalte in Nachrichten erlauben\" auf Thunderbirds Standard zurückgesetzt werden?", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "uninstallResetToDefault_label": { - "message": "Zurücksetzen" - }, - "uninstallResetNotToDefault_label": { - "message": "Einstellungen behalten" - } - +{ + "extensionName": { + "message": "Allow HTML Temp" + }, + "extensionDescription": { + "message": "Erlaubt HTML per Klick temporär für die aktuelle Nachricht" + }, + + "button_label": { + "message": "HTML zeigen" + }, + "button_tooltip": { + "message": "Text oder HTML temporär anzeigen" + }, + "button_label_html": { + "message": "HTML zeigen" + }, + "button_label_sanitized": { + "message": "HTML zeigen" + }, + "button_label_plaintext": { + "message": "Reiner Text" + }, + + "optionPageTitle_label": { + "message": "Allow HTML Temp - Einstellungen" + }, + "optionGeneralDescription_label": { + "message": "Um Schad-Software wie \"Locky\" und \"Tesla\" vorzubeugen, sollten HTML und JavaScript für E-Mail deaktiviert bzw. eingeschränkt werden und E-Mail-Anhänge nicht eingebunden angezeigt werden. JavaScript wird durch Thunderbird sowieso immer eingeschränkt." + }, + + "optionHTML_label": { + "message": "HTML in E-Mail" + }, + "optionHTMLDescription_label": { + "message": "Hier sollte als Standard eine eingeschränkte Darstellung gewählt werden." + }, + "optionHTMLDescriptionWarning_label": { + "message": "Es handelt sich hier um eine Einstellung von Thunderbird selbst, die Sie in Thunderbird im Menü \"Ansicht\" → \"Nachrichteninhalt\" finden. Wenn Sie dieses Add-on deinstallieren, bleibt die gewählte Option erhalten, aber Sie können die Option in Thunderbird auch ohne dieses Add-on ändern.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionAppHTML_label": { + "message": "Standard-Einstellung:" + }, + "optionButtonHTML_label": { + "message": "Klick auf \"HTML zeigen\":" + }, + "optionNotRecommended_label": { + "message": "(nicht empfohlen)" + }, + "optionOriginalHTML_label": { + "message": "Original HTML" + }, + "optionSanitizedHTML_label": { + "message": "Vereinfachtes HTML" + }, + "optionPlaintext_label": { + "message": "Reiner Text" + }, + "optionAllBodyParts_label": { + "message": "Alle Teile des Inhalts" + }, + + "optionAdditionalOptions_label": { + "message": "Weitere Optionen" + }, + "optionAllwaysVersusClickDescription_label": { + "message": "Bei der Anzeige von Original HTML können weitere, optionale Inhalte aktiviert werden. Diese Optionen für Original HTML können Sie mit den folgenden Einstellungen global zulassen oder nur jeweils für die temporäre Funktion \"HTML zeigen\" erlauben." + }, + "optionRemoteContent_label": { + "message": "Externe Inhalte (Grafiken, Stylesheets, etc.)" + }, + "optionAllwaysRemoteContent_label": { + "message": "Externe Inhalte in Nachrichten global erlauben" + }, + "optionAllwaysRemoteContentWarning_label": { + "message": "Es handelt sich hier um eine Einstellung von Thunderbird selbst, die Sie in Thunderbird in den Einstellungen im Bereich \"Datenschutz & Sicherheit\" → \"Externe Inhalte in Nachrichten erlauben\" finden. Wenn Sie dieses Add-on deinstallieren, bleibt die gewählte Option erhalten, aber Sie können die Option in Thunderbird auch ohne dieses Add-on ändern.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionTempRemoteContent_label": { + "message": "Bei Klick auf \"HTML zeigen\" für die eine Nachricht erlauben" + }, + "optionAttachments_label": { + "message": "Anhänge" + }, + "optionAttachmentsAllwaysInline_label": { + "message": "Anhänge immer eingebunden anzeigen (nicht empfohlen)" + }, + "optionAttachmentsTempInlineWarning_label": { + "message": "Es handelt sich hier um eine Einstellung von Thunderbird selbst, die Sie in Thunderbird im Menü \"Ansicht\" → \"Anhänge eingebunden anzeigen\" finden. Wenn Sie dieses Add-on deinstallieren, bleibt die gewählte Option erhalten, aber Sie können die Option in Thunderbird auch ohne dieses Add-on ändern.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionAttachmentsTempInline_label": { + "message": "Bei Klick auf \"HTML zeigen\" temporär eingebunden anzeigen" + }, + + "optionCommandKeyHeader_label": { + "message": "Kurzbefehl" + }, + "optionCommandKeyDescription_label": { + "message": "Die hier in den Optionen festgelegte Funktion der Schaltfläche kann auch per Kurzbefehl ausgeführt werden. Sie können den Kurzbefehl bei Bedarf anpassen. Der Kurzbefehl wird als Zeichenfolge angegeben, die aus 2 oder 3 Tasten bestehen muss, die durch \"+\" verbunden sind. Beispiel: \"Ctrl+Alt+F5\" (3 Tasten - dies ist der Standard-Kurzbefehl) oder \"Ctrl+F5\" (2 Tasten).", + "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." + }, + "optionCommandKeyRulesText_label": { + "message": "Die auf MDN beschriebenen Regeln für Kurzbefehle müssen beachtet werden." + }, + "optionCommandKey_label": { + "message": "Kurzbefehl für \"HTML zeigen\":" + }, + "optionCommandKeyWarning_label": { + "message": "Der gewählte Kurzbefehl ist nicht gültig. Deshalb wird der Standard \"Ctrl+Alt+F5\" verwendet.", + "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." + }, + + "optionDebugHeader_label": { + "message": "Debug-Modus" + }, + "optionDebugDescription_label": { + "message": "Meldungen werden in der Fehlerkonsole protokolliert." + }, + "optionDebug_label": { + "message": "Debug-Modus aktivieren" + }, + + "optionResetAllOptionsHeader_label": { + "message": "Alle Optionen zurücksetzen" + }, + "optionResetAllOptionsDescription_label": { + "message": "Klicken, um alle Optionen auf die Standardwerte zurückzusetzen." + }, + "optionResetAllOptionsDescription2_label": { + "message": "Klicken, um alle Optionen auf Thunderbirds Standardwerte oder auf empfohlene Werte zurückzusetzen." + }, + "optionButtonResetToDefault_label": { + "message": "Thunderbird Standard" + }, + "optionButtonResetToRecommended_label": { + "message": "Empfohlen" + }, + "optionButtonReset_label": { + "message": "Zurücksetzen" + }, + + "uninstallResetDialog_label": { + "message": "Allow HTML Temp wird deaktiviert oder deinstalliert.\n\n Sollen Thunderbirds Einstellungen zu \"Nachrichteninhalt\" (HTML-Modus), \"Anhänge eingebunden anzeigen\" und \"Externe Inhalte in Nachrichten erlauben\" auf Thunderbirds Standard zurückgesetzt werden?", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "uninstallResetToDefault_label": { + "message": "Zurücksetzen" + }, + "uninstallResetNotToDefault_label": { + "message": "Einstellungen behalten" + } + } \ No newline at end of file diff -Nru allow-html-temp-8.1.5/_locales/dsb/messages.json allow-html-temp-10.0.4/_locales/dsb/messages.json --- allow-html-temp-8.1.5/_locales/dsb/messages.json 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/_locales/dsb/messages.json 2022-05-27 15:10:56.000000000 +0000 @@ -1,155 +1,155 @@ -{ - "extensionName": { - "message": "Allow HTML Temp" - }, - "extensionDescription": { - "message": "HTML we wubranej powěsći nachylu zmóžniś" - }, - - "button_label": { - "message": "HTML pokazaś" - }, - "button_tooltip": { - "message": "Tekst abo HTML nachylu za toś tu powěsć pokazaś" - }, - "button_label_html": { - "message": "HTML pokazaś" - }, - "button_label_sanitized": { - "message": "HTML pokazaś" - }, - "button_label_plaintext": { - "message": "Lutny tekst" - }, - - "optionPageTitle_label": { - "message": "Allow HTML Temp - Nastajenja" - }, - "optionGeneralDescription_label": { - "message": "Aby wuwjedowanjeju złosnego koda zajźował (na pś. \"Locky\" a \"Tesla\"), HTML a JavaScript měłej se za e-mail znjemóžniś abo wobgranicowaś a e-mailowe pśidanki njeměli se ako zawězane pokazaś. JavaScript se tak a tak pśecej pśez Thunderbird wobgranicujo." - }, - - "optionHTML_label": { - "message": "HTML w e-maili" - }, - "optionHTMLDescription_label": { - "message": "Wobgranicowane nastajenje měło se how pó standarźe wubraś." - }, - "optionHTMLDescriptionWarning_label": { - "message": "To jo jadno z nastajenjow Thunderbird, kótarež móžośo w meniju \"Naglěd\" → \"Powěsćowe śěleso ako\" namakaś. Jolic toś ten dodank wótinstalěrujośo, toś to nastajenje zmóžnjone wóstawa, ale móžośo teke toś to nastajenje w Thunderbird bźez toś togo dodanka změniś.", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionAppHTML_label": { - "message": "Standardne nastajenje:" - }, - "optionButtonHTML_label": { - "message": "Klikniśo na \"HTML pokazaś\":" - }, - "optionNotRecommended_label": { - "message": "(njepśiraźijo se)" - }, - "optionOriginalHTML_label": { - "message": "Originalny HTML" - }, - "optionSanitizedHTML_label": { - "message": "Zjadnorjony HTML" - }, - "optionPlaintext_label": { - "message": "Lutny tekst" - }, - "optionAllBodyParts_label": { - "message": "Wšykne źěle wopśimjeśa" - }, - - "optionAdditionalOptions_label": { - "message": "Rozšyrjone nastajenja" - }, - "optionAllwaysVersusClickDescription_label": { - "message": "Pśi pokazowanju originalnego HTML dajo se dalšne, opcionalne wopśimjeśe zmóžniś. Móžośo toś te pśidatne nastajenja za modus originalnego HTML globalnje dowóliś abo jano za nachylnu funkciju \"HTML pokazaś\"." - }, - "optionRemoteContent_label": { - "message": "Daloke wopśimjeśe (wobraze, stilowe pśedłogi ...)" - }, - "optionAllwaysRemoteContent_label": { - "message": "Daloke wopśimjeśe generelnje dowóliś (njepśiraźijo se)" - }, - "optionAllwaysRemoteContentWarning_label": { - "message": "To jo jadno z nastajenjow Thunderbird, kótarež móžośo w nastajenjach pód \"Priwatnosć a wěstota\" → \"Daloke wopśimjeśe w powěsćach dowóliś\" namakaś. Jolic toś ten dodank wótinstalěrujośo, toś to nastajenje zmóžnjone wóstawa, ale móžośo teke toś to nastajenje w Thunderbird bźez toś togo dodanka změniś.", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionTempRemoteContent_label": { - "message": "Daloke wopśimjeśe za wubranu powěsć z kliknjenim na \"HTML pokazaś\" dowóliś" - }, - "optionAttachments_label": { - "message": "Pśidanki" - }, - "optionAttachmentsAllwaysInline_label": { - "message": "Pśidanki pśecej zawězane pokazaś (njepśiraźijo se)" - }, - "optionAttachmentsTempInlineWarning_label": { - "message": "To jo jadno z nastajenjow Thunderbird, kótarež móžośo w nastajenjach pód \"Naglěd\" → \"Pśidanki zasajźone zwobrazniś\" namakaś. Jolic toś ten dodank wótinstalěrujośo, toś to nastajenje zmóžnjone wóstawa, ale móžośo teke toś to nastajenje w Thunderbird bźez toś togo dodanka změniś.", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionAttachmentsTempInline_label": { - "message": "Z kliknjenim na \"HTML pokazaś\" pśidanki nachylu zawězane pokazaś" - }, - - "optionCommandKeyHeader_label": { - "message": "Tastowa skrotconka" - }, - "optionCommandKeyDescription_label": { - "message": "How pódana funkcija tłocaška dajo se teke z pomocu tastoweje skrotconki wuwjasć. Móžośo tastowu skrotconku pśiměriś, jolic trjeba. Tastowa skrotconka se pón ako znamuškowy rjeśazk pokažo, kótaryž z dweju tastowu abo tśich tastow wobstoj, źělóne pśez \"+\". Na pśikład \"Ctrl+Alt+F5\" (3 tasty - to jo standardna tastowa skrotconka) abo \"Ctrl+F5\" (2 tasće).", - "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." - }, - "optionCommandKeyRulesText_label": { - "message": "Musyśo na pšawidła źiwaś, kótarež se na MDN wopisuju." - }, - "optionCommandKey_label": { - "message": "Tastowa skrotconka za \"HTML pokazaś\":" - }, - "optionCommandKeyWarning_label": { - "message": "Waša wubrana pśikazowa tasta njejo płaśiwa. Togodla se \"Ctrl+Alt+F5\" wužywa.", - "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." - }, - - "optionDebugHeader_label": { - "message": "Modus pytanja zmólkow" - }, - "optionDebugDescription_label": { - "message": "Informacije wó pytanju zmólkow se w zmólkowej konsoli protokolěruju." - }, - "optionDebug_label": { - "message": "Modus pytanja zmólkow aktiwěrowaś" - }, - - "optionResetAllOptionsHeader_label": { - "message": "Wšykne nastajenja slědk stajiś" - }, - "optionResetAllOptionsDescription_label": { - "message": "Klikniśo, aby wšykne nastajenja na jich standardne gódnoty slědk stajił." - }, - "optionResetAllOptionsDescription2_label": { - "message": "Klikniśo, aby wšykne nastajenja na standard Thunderbird abo dopórucone gódnoty slědk stajił." - }, - "optionButtonResetToDefault_label": { - "message": "Thunderbird standard" - }, - "optionButtonResetToRecommended_label": { - "message": "Dopórucone" - }, - "optionButtonReset_label": { - "message": "Slědk stajiś" - }, - - "uninstallResetDialog_label": { - "message": "Allow HTML Temp se znjemóžnijo abo wótinstalěrujo.\n\nCośo pśi nastajenjach Thunderbird za \"Powěsćowe śěleso ako\" (HTML-modus), \"Pśidanki zasajźone zwobrazniś\" a \"Daloke wopśimjeśe w powěsćach dowóliś\" wóstaś abo cośo je slědk stajiś?", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "uninstallResetToDefault_label": { - "message": "Slědk stajiś" - }, - "uninstallResetNotToDefault_label": { - "message": "Pśi nastajenjach wóstaś" - } - +{ + "extensionName": { + "message": "Allow HTML Temp" + }, + "extensionDescription": { + "message": "HTML we wubranej powěsći nachylu zmóžniś" + }, + + "button_label": { + "message": "HTML pokazaś" + }, + "button_tooltip": { + "message": "Tekst abo HTML nachylu za toś tu powěsć pokazaś" + }, + "button_label_html": { + "message": "HTML pokazaś" + }, + "button_label_sanitized": { + "message": "HTML pokazaś" + }, + "button_label_plaintext": { + "message": "Lutny tekst" + }, + + "optionPageTitle_label": { + "message": "Allow HTML Temp - Nastajenja" + }, + "optionGeneralDescription_label": { + "message": "Aby wuwjedowanjeju złosnego koda zajźował (na pś. \"Locky\" a \"Tesla\"), HTML a JavaScript měłej se za e-mail znjemóžniś abo wobgranicowaś a e-mailowe pśidanki njeměli se ako zawězane pokazaś. JavaScript se tak a tak pśecej pśez Thunderbird wobgranicujo." + }, + + "optionHTML_label": { + "message": "HTML w e-maili" + }, + "optionHTMLDescription_label": { + "message": "Wobgranicowane nastajenje měło se how pó standarźe wubraś." + }, + "optionHTMLDescriptionWarning_label": { + "message": "To jo jadno z nastajenjow Thunderbird, kótarež móžośo w meniju \"Naglěd\" → \"Powěsćowe śěleso ako\" namakaś. Jolic toś ten dodank wótinstalěrujośo, toś to nastajenje zmóžnjone wóstawa, ale móžośo teke toś to nastajenje w Thunderbird bźez toś togo dodanka změniś.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionAppHTML_label": { + "message": "Standardne nastajenje:" + }, + "optionButtonHTML_label": { + "message": "Klikniśo na \"HTML pokazaś\":" + }, + "optionNotRecommended_label": { + "message": "(njepśiraźijo se)" + }, + "optionOriginalHTML_label": { + "message": "Originalny HTML" + }, + "optionSanitizedHTML_label": { + "message": "Zjadnorjony HTML" + }, + "optionPlaintext_label": { + "message": "Lutny tekst" + }, + "optionAllBodyParts_label": { + "message": "Wšykne źěle wopśimjeśa" + }, + + "optionAdditionalOptions_label": { + "message": "Rozšyrjone nastajenja" + }, + "optionAllwaysVersusClickDescription_label": { + "message": "Pśi pokazowanju originalnego HTML dajo se dalšne, opcionalne wopśimjeśe zmóžniś. Móžośo toś te pśidatne nastajenja za modus originalnego HTML globalnje dowóliś abo jano za nachylnu funkciju \"HTML pokazaś\"." + }, + "optionRemoteContent_label": { + "message": "Daloke wopśimjeśe (wobraze, stilowe pśedłogi ...)" + }, + "optionAllwaysRemoteContent_label": { + "message": "Daloke wopśimjeśe generelnje dowóliś (njepśiraźijo se)" + }, + "optionAllwaysRemoteContentWarning_label": { + "message": "To jo jadno z nastajenjow Thunderbird, kótarež móžośo w nastajenjach pód \"Priwatnosć a wěstota\" → \"Daloke wopśimjeśe w powěsćach dowóliś\" namakaś. Jolic toś ten dodank wótinstalěrujośo, toś to nastajenje zmóžnjone wóstawa, ale móžośo teke toś to nastajenje w Thunderbird bźez toś togo dodanka změniś.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionTempRemoteContent_label": { + "message": "Daloke wopśimjeśe za wubranu powěsć z kliknjenim na \"HTML pokazaś\" dowóliś" + }, + "optionAttachments_label": { + "message": "Pśidanki" + }, + "optionAttachmentsAllwaysInline_label": { + "message": "Pśidanki pśecej zawězane pokazaś (njepśiraźijo se)" + }, + "optionAttachmentsTempInlineWarning_label": { + "message": "To jo jadno z nastajenjow Thunderbird, kótarež móžośo w nastajenjach pód \"Naglěd\" → \"Pśidanki zasajźone zwobrazniś\" namakaś. Jolic toś ten dodank wótinstalěrujośo, toś to nastajenje zmóžnjone wóstawa, ale móžośo teke toś to nastajenje w Thunderbird bźez toś togo dodanka změniś.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionAttachmentsTempInline_label": { + "message": "Z kliknjenim na \"HTML pokazaś\" pśidanki nachylu zawězane pokazaś" + }, + + "optionCommandKeyHeader_label": { + "message": "Tastowa skrotconka" + }, + "optionCommandKeyDescription_label": { + "message": "How pódana funkcija tłocaška dajo se teke z pomocu tastoweje skrotconki wuwjasć. Móžośo tastowu skrotconku pśiměriś, jolic trjeba. Tastowa skrotconka se pón ako znamuškowy rjeśazk pokažo, kótaryž z dweju tastowu abo tśich tastow wobstoj, źělóne pśez \"+\". Na pśikład \"Ctrl+Alt+F5\" (3 tasty - to jo standardna tastowa skrotconka) abo \"Ctrl+F5\" (2 tasće).", + "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." + }, + "optionCommandKeyRulesText_label": { + "message": "Musyśo na pšawidła źiwaś, kótarež se na MDN wopisuju." + }, + "optionCommandKey_label": { + "message": "Tastowa skrotconka za \"HTML pokazaś\":" + }, + "optionCommandKeyWarning_label": { + "message": "Waša wubrana pśikazowa tasta njejo płaśiwa. Togodla se \"Ctrl+Alt+F5\" wužywa.", + "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." + }, + + "optionDebugHeader_label": { + "message": "Modus pytanja zmólkow" + }, + "optionDebugDescription_label": { + "message": "Informacije wó pytanju zmólkow se w zmólkowej konsoli protokolěruju." + }, + "optionDebug_label": { + "message": "Modus pytanja zmólkow aktiwěrowaś" + }, + + "optionResetAllOptionsHeader_label": { + "message": "Wšykne nastajenja slědk stajiś" + }, + "optionResetAllOptionsDescription_label": { + "message": "Klikniśo, aby wšykne nastajenja na jich standardne gódnoty slědk stajił." + }, + "optionResetAllOptionsDescription2_label": { + "message": "Klikniśo, aby wšykne nastajenja na standard Thunderbird abo dopórucone gódnoty slědk stajił." + }, + "optionButtonResetToDefault_label": { + "message": "Thunderbird standard" + }, + "optionButtonResetToRecommended_label": { + "message": "Dopórucone" + }, + "optionButtonReset_label": { + "message": "Slědk stajiś" + }, + + "uninstallResetDialog_label": { + "message": "Allow HTML Temp se znjemóžnijo abo wótinstalěrujo.\n\nCośo pśi nastajenjach Thunderbird za \"Powěsćowe śěleso ako\" (HTML-modus), \"Pśidanki zasajźone zwobrazniś\" a \"Daloke wopśimjeśe w powěsćach dowóliś\" wóstaś abo cośo je slědk stajiś?", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "uninstallResetToDefault_label": { + "message": "Slědk stajiś" + }, + "uninstallResetNotToDefault_label": { + "message": "Pśi nastajenjach wóstaś" + } + } \ No newline at end of file diff -Nru allow-html-temp-8.1.5/_locales/en/messages.json allow-html-temp-10.0.4/_locales/en/messages.json --- allow-html-temp-8.1.5/_locales/en/messages.json 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/_locales/en/messages.json 2022-05-27 15:10:56.000000000 +0000 @@ -1,155 +1,155 @@ -{ - "extensionName": { - "message": "Allow HTML Temp" - }, - "extensionDescription": { - "message": "Allow temporarily HTML in a selected message" - }, - - "button_label": { - "message": "Show HTML" - }, - "button_tooltip": { - "message": "Temporarily display text or HTML for this message" - }, - "button_label_html": { - "message": "Show HTML" - }, - "button_label_sanitized": { - "message": "Show HTML" - }, - "button_label_plaintext": { - "message": "Plaintext" - }, - - "optionPageTitle_label": { - "message": "Allow HTML Temp - Preferences" - }, - "optionGeneralDescription_label": { - "message": "To prevent malicious code execution (e.g. \"Locky\" and \"Tesla\"), HTML and JavaScript for email should be deactivated or restricted and email attachments should not be displayed as inline. JavaScript is always restricted by Thunderbird anyway." - }, - - "optionHTML_label": { - "message": "HTML in email" - }, - "optionHTMLDescription_label": { - "message": "A restricted option should be chosen here for default." - }, - "optionHTMLDescriptionWarning_label": { - "message": "This is one of Thunderbirds own options, which you can find in menu \"Display\" → \"Message Body as\". If you uninstall this Addon, the option will remain as chosen, but you can also change this option in Thunderbird without this add-on.", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionAppHTML_label": { - "message": "Default setting:" - }, - "optionButtonHTML_label": { - "message": "Click on \"Show HTML\":" - }, - "optionNotRecommended_label": { - "message": "(not recommended)" - }, - "optionOriginalHTML_label": { - "message": "Original HTML" - }, - "optionSanitizedHTML_label": { - "message": "Sanitized HTML" - }, - "optionPlaintext_label": { - "message": "Plaintext" - }, - "optionAllBodyParts_label": { - "message": "All Body Parts" - }, - - "optionAdditionalOptions_label": { - "message": "Advanced options" - }, - "optionAllwaysVersusClickDescription_label": { - "message": "Additional, optional content can be activated when displaying original HTML. You can activate these additional options in general for original HTML mode or only for the temporary \"Show HTML\" feature." - }, - "optionRemoteContent_label": { - "message": "Remote content (images, stylesheets ...)" - }, - "optionAllwaysRemoteContent_label": { - "message": "Allow remote content in general (not recommended)" - }, - "optionAllwaysRemoteContentWarning_label": { - "message": "This is one of Thunderbirds own options, which you can find in Thunderbirds Preferences under \"Privacy & Security\" → \"Allow remote content in messages\". If you uninstall this Addon, the option will remain as chosen, but you can also change this option in Thunderbird without this add-on.", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionTempRemoteContent_label": { - "message": "Temporarily allow remote content for the selected message by click on \"Show HTML\"" - }, - "optionAttachments_label": { - "message": "Attachments" - }, - "optionAttachmentsAllwaysInline_label": { - "message": "Always show attachments inline (not recommended)" - }, - "optionAttachmentsTempInlineWarning_label": { - "message": "This is one of Thunderbirds own options, which you can find in menu \"View\" → \"Display Attachments Inline\". If you uninstall this Addon, the option will remain as chosen, but you can also change this option in Thunderbird without this add-on.", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionAttachmentsTempInline_label": { - "message": "Temporarily show attachments inline by click on \"Show HTML\"" - }, - - "optionCommandKeyHeader_label": { - "message": "Shortcut" - }, - "optionCommandKeyDescription_label": { - "message": "The buttons function specified here in the options can also be executed using a shortcut. You can customize the shortcut if needed. The resulting command key is then given as a string containing a set of 2 or 3 key values, separated by \"+\". For example, \"Ctrl+Alt+F5\" (3 key values - this is the default shortcut) or \"Ctrl+F5\" (2 key values).", - "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." - }, - "optionCommandKeyRulesText_label": { - "message": "The rules described on MDN have to be considered." - }, - "optionCommandKey_label": { - "message": "Shortcut for \"Show HTML\":" - }, - "optionCommandKeyWarning_label": { - "message": "Your chosen commandkey isn't valid. Therefore the default \"Ctrl+Alt+F5\" will be used.", - "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." - }, - - "optionDebugHeader_label": { - "message": "Debug mode" - }, - "optionDebugDescription_label": { - "message": "Debug information will be logged in the error console." - }, - "optionDebug_label": { - "message": "Activate debug mode" - }, - - "optionResetAllOptionsHeader_label": { - "message": "Reset all options" - }, - "optionResetAllOptionsDescription_label": { - "message": "Click to reset all options to their default values." - }, - "optionResetAllOptionsDescription2_label": { - "message": "Click to reset all options to Thunderbird default or to recommended values." - }, - "optionButtonResetToDefault_label": { - "message": "Thunderbird default" - }, - "optionButtonResetToRecommended_label": { - "message": "Recommended" - }, - "optionButtonReset_label": { - "message": "Reset" - }, - - "uninstallResetDialog_label": { - "message": "Allow HTML Temp will be disabled or uninstalled.\n\nDo you want to keep or reset Thunderbird settings for \"Message Body as\" (HTML Mode), \"Display Attachments Inline\" and \"Allow remote content in messages\"?", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "uninstallResetToDefault_label": { - "message": "Reset" - }, - "uninstallResetNotToDefault_label": { - "message": "Keep Settings" - } - +{ + "extensionName": { + "message": "Allow HTML Temp" + }, + "extensionDescription": { + "message": "Allow temporarily HTML in a selected message" + }, + + "button_label": { + "message": "Show HTML" + }, + "button_tooltip": { + "message": "Temporarily display text or HTML for this message" + }, + "button_label_html": { + "message": "Show HTML" + }, + "button_label_sanitized": { + "message": "Show HTML" + }, + "button_label_plaintext": { + "message": "Plaintext" + }, + + "optionPageTitle_label": { + "message": "Allow HTML Temp - Preferences" + }, + "optionGeneralDescription_label": { + "message": "To prevent malicious code execution (e.g. \"Locky\" and \"Tesla\"), HTML and JavaScript for email should be deactivated or restricted and email attachments should not be displayed as inline. JavaScript is always restricted by Thunderbird anyway." + }, + + "optionHTML_label": { + "message": "HTML in email" + }, + "optionHTMLDescription_label": { + "message": "A restricted option should be chosen here for default." + }, + "optionHTMLDescriptionWarning_label": { + "message": "This is one of Thunderbirds own options, which you can find in menu \"Display\" → \"Message Body as\". If you uninstall this Addon, the option will remain as chosen, but you can also change this option in Thunderbird without this add-on.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionAppHTML_label": { + "message": "Default setting:" + }, + "optionButtonHTML_label": { + "message": "Click on \"Show HTML\":" + }, + "optionNotRecommended_label": { + "message": "(not recommended)" + }, + "optionOriginalHTML_label": { + "message": "Original HTML" + }, + "optionSanitizedHTML_label": { + "message": "Sanitized HTML" + }, + "optionPlaintext_label": { + "message": "Plaintext" + }, + "optionAllBodyParts_label": { + "message": "All Body Parts" + }, + + "optionAdditionalOptions_label": { + "message": "Advanced options" + }, + "optionAllwaysVersusClickDescription_label": { + "message": "Additional, optional content can be activated when displaying original HTML. You can activate these additional options in general for original HTML mode or only for the temporary \"Show HTML\" feature." + }, + "optionRemoteContent_label": { + "message": "Remote content (images, stylesheets ...)" + }, + "optionAllwaysRemoteContent_label": { + "message": "Allow remote content in general (not recommended)" + }, + "optionAllwaysRemoteContentWarning_label": { + "message": "This is one of Thunderbirds own options, which you can find in Thunderbirds Preferences under \"Privacy & Security\" → \"Allow remote content in messages\". If you uninstall this Addon, the option will remain as chosen, but you can also change this option in Thunderbird without this add-on.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionTempRemoteContent_label": { + "message": "Temporarily allow remote content for the selected message by click on \"Show HTML\"" + }, + "optionAttachments_label": { + "message": "Attachments" + }, + "optionAttachmentsAllwaysInline_label": { + "message": "Always show attachments inline (not recommended)" + }, + "optionAttachmentsTempInlineWarning_label": { + "message": "This is one of Thunderbirds own options, which you can find in menu \"View\" → \"Display Attachments Inline\". If you uninstall this Addon, the option will remain as chosen, but you can also change this option in Thunderbird without this add-on.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionAttachmentsTempInline_label": { + "message": "Temporarily show attachments inline by click on \"Show HTML\"" + }, + + "optionCommandKeyHeader_label": { + "message": "Shortcut" + }, + "optionCommandKeyDescription_label": { + "message": "The buttons function specified here in the options can also be executed using a shortcut. You can customize the shortcut if needed. The resulting command key is then given as a string containing a set of 2 or 3 key values, separated by \"+\". For example, \"Ctrl+Alt+F5\" (3 key values - this is the default shortcut) or \"Ctrl+F5\" (2 key values).", + "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." + }, + "optionCommandKeyRulesText_label": { + "message": "The rules described on MDN have to be considered." + }, + "optionCommandKey_label": { + "message": "Shortcut for \"Show HTML\":" + }, + "optionCommandKeyWarning_label": { + "message": "Your chosen commandkey isn't valid. Therefore the default \"Ctrl+Alt+F5\" will be used.", + "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." + }, + + "optionDebugHeader_label": { + "message": "Debug mode" + }, + "optionDebugDescription_label": { + "message": "Debug information will be logged in the error console." + }, + "optionDebug_label": { + "message": "Activate debug mode" + }, + + "optionResetAllOptionsHeader_label": { + "message": "Reset all options" + }, + "optionResetAllOptionsDescription_label": { + "message": "Click to reset all options to their default values." + }, + "optionResetAllOptionsDescription2_label": { + "message": "Click to reset all options to Thunderbird default or to recommended values." + }, + "optionButtonResetToDefault_label": { + "message": "Thunderbird default" + }, + "optionButtonResetToRecommended_label": { + "message": "Recommended" + }, + "optionButtonReset_label": { + "message": "Reset" + }, + + "uninstallResetDialog_label": { + "message": "Allow HTML Temp will be disabled or uninstalled.\n\nDo you want to keep or reset Thunderbird settings for \"Message Body as\" (HTML Mode), \"Display Attachments Inline\" and \"Allow remote content in messages\"?", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "uninstallResetToDefault_label": { + "message": "Reset" + }, + "uninstallResetNotToDefault_label": { + "message": "Keep Settings" + } + } \ No newline at end of file diff -Nru allow-html-temp-8.1.5/_locales/fr/messages.json allow-html-temp-10.0.4/_locales/fr/messages.json --- allow-html-temp-8.1.5/_locales/fr/messages.json 1970-01-01 00:00:00.000000000 +0000 +++ allow-html-temp-10.0.4/_locales/fr/messages.json 2024-06-16 17:50:06.000000000 +0000 @@ -0,0 +1,155 @@ +{ + "extensionName": { + "message": "Allow HTML Temp" + }, + "extensionDescription": { + "message": "Autoriser temporairement HTML dans le message sélectionné." + }, + + "button_label": { + "message": "Affichage HTML" + }, + "button_tooltip": { + "message": "Afficher temporairement le message au format texte ou HTML" + }, + "button_label_html": { + "message": "HTML original" + }, + "button_label_sanitized": { + "message": "HTML simple" + }, + "button_label_plaintext": { + "message": "Texte seul" + }, + + "optionPageTitle_label": { + "message": "Allow HTML Temp - Préférences" + }, + "optionGeneralDescription_label": { + "message": "Pour prévenir l’exécution de codes malveillants (par exemple « Locky » ou « Tesla »), il est conseillé de désactiver ou de restreindre HTML et JavaScript et de ne pas afficher les pièces jointes dans les messages. De toute façon, Thunderbird limite déjà l’utilisation de JavaScript." + }, + + "optionHTML_label": { + "message": "HTML dans les messages" + }, + "optionHTMLDescription_label": { + "message": "Une option restrictive doit être choisie par défaut." + }, + "optionHTMLDescriptionWarning_label": { + "message": "Il s’agit d’une option interne de Thunderbird (menu Affichage → Corps du message en). Elle conservera cette valeur après la désinstallation de l’extension mais pourra être modifiée par la suite.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionAppHTML_label": { + "message": "Par défaut :" + }, + "optionButtonHTML_label": { + "message": "En cliquant sur le bouton :" + }, + "optionNotRecommended_label": { + "message": "(déconseillé)" + }, + "optionOriginalHTML_label": { + "message": "HTML original" + }, + "optionSanitizedHTML_label": { + "message": "HTML simple" + }, + "optionPlaintext_label": { + "message": "Texte seul" + }, + "optionAllBodyParts_label": { + "message": "Tous les éléments" + }, + + "optionAdditionalOptions_label": { + "message": "Options avancées" + }, + "optionAllwaysVersusClickDescription_label": { + "message": "Ces options permettent d’afficher un éventuel contenu supplémentaire dans les messages en HTML original. Elles peuvent être activées globalement (si HTML original par défaut) ou temporairement (si HTML original en cliquant sur le bouton)." + }, + "optionRemoteContent_label": { + "message": "Contenu distant (images, feuilles de style, …)" + }, + "optionAllwaysRemoteContent_label": { + "message": "Autoriser globalement le contenu distant dans les messages (déconseillé)" + }, + "optionAllwaysRemoteContentWarning_label": { + "message": "Il s’agit d’une option interne de Thunderbird (Paramètres → Vie privée et sécurité → Autoriser le contenu distant dans les messages). Elle conservera cette valeur après la désinstallation de l’extension mais pourra être modifiée par la suite.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionTempRemoteContent_label": { + "message": "Autoriser temporairement le contenu distant dans le message sélectionné" + }, + "optionAttachments_label": { + "message": "Pièces jointes" + }, + "optionAttachmentsAllwaysInline_label": { + "message": "Toujours afficher les pièces jointes dans les messages (déconseillé)" + }, + "optionAttachmentsTempInlineWarning_label": { + "message": "Il s’agit d’une option interne de Thunderbird (menu Affichage → Afficher les pièces jointes dans les messages). Elle conservera cette valeur après la désinstallation de l’extension mais pourra être modifiée par la suite.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionAttachmentsTempInline_label": { + "message": "Afficher temporairement les pièces jointes dans les messages" + }, + + "optionCommandKeyHeader_label": { + "message": "Raccourci" + }, + "optionCommandKeyDescription_label": { + "message": "La fonction du bouton peut également être exécutée en utilisant un raccourci clavier. Ce raccourci est modifiable en indiquant une combinaison de 2 ou 3 touches séparées par « + », par exemple [Ctrl+Alt+F5] (raccourci par défaut en 3 touches) ou [Ctrl+F5] (2 touches).", + "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." + }, + "optionCommandKeyRulesText_label": { + "message": "Les règles décrites sur MDN doivent être prises en compte." + }, + "optionCommandKey_label": { + "message": "Raccourci pour la fonction du bouton :" + }, + "optionCommandKeyWarning_label": { + "message": "La combinaison choisie n’est pas valide, la valeur par défaut (Ctrl+Alt+F5) sera utilisée.", + "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." + }, + + "optionDebugHeader_label": { + "message": "Débogage" + }, + "optionDebugDescription_label": { + "message": "Les informations de débogage seront enregistrées dans la console d’erreurs." + }, + "optionDebug_label": { + "message": "Activer le mode débogage" + }, + + "optionResetAllOptionsHeader_label": { + "message": "Réinitialisation des options" + }, + "optionResetAllOptionsDescription_label": { + "message": "Le bouton ci-dessous permet de rétablir les valeurs par défaut de toutes les options." + }, + "optionResetAllOptionsDescription2_label": { + "message": "Les boutons ci-dessous permettent de réinitialiser toutes les options aux valeurs par défaut de Thunderbird ou aux valeurs recommandées." + }, + "optionButtonResetToDefault_label": { + "message": "Valeurs par défaut de Thunderbird" + }, + "optionButtonResetToRecommended_label": { + "message": "Valeurs recommandées" + }, + "optionButtonReset_label": { + "message": "Réinitialiser" + }, + + "uninstallResetDialog_label": { + "message": "Allow HTML Temp va être désactivé ou désinstallé.\n\nVoulez-vous conserver ou réinitialiser les paramètres de Thunderbird pour « Corps du message en » (mode HTML), « Afficher les pièces jointes dans les messages » et « Autoriser le contenu distant dans les messages » ?", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "uninstallResetToDefault_label": { + "message": "Réinitialiser" + }, + "uninstallResetNotToDefault_label": { + "message": "Conserver les paramètres" + } + +} \ No newline at end of file diff -Nru allow-html-temp-8.1.5/_locales/hsb/messages.json allow-html-temp-10.0.4/_locales/hsb/messages.json --- allow-html-temp-8.1.5/_locales/hsb/messages.json 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/_locales/hsb/messages.json 2022-05-27 15:10:56.000000000 +0000 @@ -1,155 +1,155 @@ -{ - "extensionName": { - "message": "Allow HTML Temp" - }, - "extensionDescription": { - "message": "HTML we wubranej powěsći nachwilu zmóžnić" - }, - - "button_label": { - "message": "HTML pokazać" - }, - "button_tooltip": { - "message": "Tekst abo HTML nachwilu za tutu powěsć pokazać" - }, - "button_label_html": { - "message": "HTML pokazać" - }, - "button_label_sanitized": { - "message": "HTML pokazać" - }, - "button_label_plaintext": { - "message": "Luty tekst" - }, - - "optionPageTitle_label": { - "message": "Allow HTML Temp - Nastajenja" - }, - "optionGeneralDescription_label": { - "message": "Zo byšće wuwjedźenju złósćiweho koda zadźěwał (na př. \"Locky\" a \"Tesla\"), HTML a JavaScript měłoj so za e-mejl znjemóžnić abo wobmjezować a e-mejlowe přiwěški njeměli so jako zawjazane pokazać. JavaScript so tak a tak přeco přez Thunderbird wobmjezuje." - }, - - "optionHTML_label": { - "message": "HTML w e-mejli" - }, - "optionHTMLDescription_label": { - "message": "Wobmjezowane nastajenje měło so tu po standardźe wubrać." - }, - "optionHTMLDescriptionWarning_label": { - "message": "To je jedne z nastajenjow Thunderbird, kotrež móžeće w meniju \"Napohlad\" → \"Tekst powěsće jako\" namakać. Jeli tutón přidatk wotinstalujeće, tute nastajenje zmóžnjene wostawa, ale móžeće tež tute nastajenje w Thunderbird bjez tutoho přidatka změnić.", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionAppHTML_label": { - "message": "Standardne nastajenje:" - }, - "optionButtonHTML_label": { - "message": "Klikńće na \"HTML pokazać\":" - }, - "optionNotRecommended_label": { - "message": "(njeporučuje so)" - }, - "optionOriginalHTML_label": { - "message": "Originalny HTML" - }, - "optionSanitizedHTML_label": { - "message": "Zjednorjeny HTML" - }, - "optionPlaintext_label": { - "message": "Luty tekst" - }, - "optionAllBodyParts_label": { - "message": "Wšě dźěle wobsaha" - }, - - "optionAdditionalOptions_label": { - "message": "Rozšěrjene nastajenja" - }, - "optionAllwaysVersusClickDescription_label": { - "message": "Při pokazowanju originalneho HTML hodźi so dalši, opcionalny wobsah zmóžnić. Móžeće tute přidatne nastajenja za modus originalneho HTML globalnje dowolić abo jenož za nachwilnu funkciju \"HTML pokazać\"." - }, - "optionRemoteContent_label": { - "message": "Zdaleny wobsah (wobrazy, stilowe předłohi ...)" - }, - "optionAllwaysRemoteContent_label": { - "message": "Zdaleny wobsah generelnje dowolić (njeporuča so)" - }, - "optionAllwaysRemoteContentWarning_label": { - "message": "To je jedne z nastajenjow Thunderbird, kotrež móžeće w nastajenjach pod \"Priwatnosć a wěstota\" → \"Zdaleny wobsah w powěsćach dowolić\" namakać. Jeli tutón přidatk wotinstalujeće, tute nastajenje zmóžnjene wostawa, ale móžeće tež tute nastajenje w Thunderbird bjez tutoho přidatka změnić.", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionTempRemoteContent_label": { - "message": "Zdaleny wobsah za wubranu powěsć z kliknjenjom na \"HTML pokazać\" dowolić" - }, - "optionAttachments_label": { - "message": "Přiwěški" - }, - "optionAttachmentsAllwaysInline_label": { - "message": "Přiwěški přeco zawjazene pokazać (njeporuča so)" - }, - "optionAttachmentsTempInlineWarning_label": { - "message": "To je jedne z nastajenjow Thunderbird, kotrež móžeće w nastajenjach pod \"Napohlad\" → \"Přiwěški zasadźene zwobraznić\" namakać. Jeli tutón přidatk wotinstalujeće, tute nastajenje zmóžnjene wostawa, ale móžeće tež tute nastajenje w Thunderbird bjez tutoho přidatka změnić.", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionAttachmentsTempInline_label": { - "message": "Z kliknjenjom na \"HTML pokazać\" přiwěški nachwilu zawjazane pokazać" - }, - - "optionCommandKeyHeader_label": { - "message": "Tastowa skrótšenka" - }, - "optionCommandKeyDescription_label": { - "message": "Tu podata funkcija tłóčatka da so tež z pomocu tastoweje skrótšenki wuwjesć. Móžeće tastowu skrótšenku přiměrić, je-li trjeba. Tastowa skrótšenka so potom jako znamješkowy rjećazk pokaza, kotryž z dweju abo třoch tastow wobsteji, dźělene přez \"+\". Na přikład \"Ctrl+Alt+F5\" (3 tasty - to je standardna tastowa skrótšenka) abo \"Ctrl+F5\" (2 tasće).", - "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." - }, - "optionCommandKeyRulesText_label": { - "message": "Dyrbiće prawidła wobkedźbować, kotrež so na MDN wopisuja." - }, - "optionCommandKey_label": { - "message": "Tastowa skrótšenka za \"HTML pokazać\":" - }, - "optionCommandKeyWarning_label": { - "message": "Waša wubrana přikazowa tasta płaćiwa njeje. Tohodla so \"Ctrl+Alt+F5\" wužiwa.", - "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." - }, - - "optionDebugHeader_label": { - "message": "Modus pytanja zmylkow" - }, - "optionDebugDescription_label": { - "message": "Informacije wo pytanju zmylkow so w zmylkowej konsoli protokoluja." - }, - "optionDebug_label": { - "message": "Modus pytanja zmylkow aktiwizować" - }, - - "optionResetAllOptionsHeader_label": { - "message": "Nastajenja wróćo stajić" - }, - "optionResetAllOptionsDescription_label": { - "message": "Klikńće, zo byšće wšě nastajenja na jich standardne hódnoty wróćo stajił." - }, - "optionResetAllOptionsDescription2_label": { - "message": "Klikńće, zo byšće wšě nastajenja na standard Thunderbird abo doporučene hódnoty wróćo stajił." - }, - "optionButtonResetToDefault_label": { - "message": "Thunderbird standard" - }, - "optionButtonResetToRecommended_label": { - "message": "Doporučene" - }, - "optionButtonReset_label": { - "message": "Wróćo stajić" - }, - - "uninstallResetDialog_label": { - "message": "Allow HTML Temp so znjemóžni abo wotinstaluje.\n\nChceće nastajenja Thunderbird za \"Tekst powěsće jako\" (HTML-modus), \"Přiwěški zasadźene zwobraznić\" a \"Zdaleny wobsah w powěsćach dowolić\" wobchować abo wróćo stajić?", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "uninstallResetToDefault_label": { - "message": "Wróćo stajić" - }, - "uninstallResetNotToDefault_label": { - "message": "Nastajenja wobchować" - } - +{ + "extensionName": { + "message": "Allow HTML Temp" + }, + "extensionDescription": { + "message": "HTML we wubranej powěsći nachwilu zmóžnić" + }, + + "button_label": { + "message": "HTML pokazać" + }, + "button_tooltip": { + "message": "Tekst abo HTML nachwilu za tutu powěsć pokazać" + }, + "button_label_html": { + "message": "HTML pokazać" + }, + "button_label_sanitized": { + "message": "HTML pokazać" + }, + "button_label_plaintext": { + "message": "Luty tekst" + }, + + "optionPageTitle_label": { + "message": "Allow HTML Temp - Nastajenja" + }, + "optionGeneralDescription_label": { + "message": "Zo byšće wuwjedźenju złósćiweho koda zadźěwał (na př. \"Locky\" a \"Tesla\"), HTML a JavaScript měłoj so za e-mejl znjemóžnić abo wobmjezować a e-mejlowe přiwěški njeměli so jako zawjazane pokazać. JavaScript so tak a tak přeco přez Thunderbird wobmjezuje." + }, + + "optionHTML_label": { + "message": "HTML w e-mejli" + }, + "optionHTMLDescription_label": { + "message": "Wobmjezowane nastajenje měło so tu po standardźe wubrać." + }, + "optionHTMLDescriptionWarning_label": { + "message": "To je jedne z nastajenjow Thunderbird, kotrež móžeće w meniju \"Napohlad\" → \"Tekst powěsće jako\" namakać. Jeli tutón přidatk wotinstalujeće, tute nastajenje zmóžnjene wostawa, ale móžeće tež tute nastajenje w Thunderbird bjez tutoho přidatka změnić.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionAppHTML_label": { + "message": "Standardne nastajenje:" + }, + "optionButtonHTML_label": { + "message": "Klikńće na \"HTML pokazać\":" + }, + "optionNotRecommended_label": { + "message": "(njeporučuje so)" + }, + "optionOriginalHTML_label": { + "message": "Originalny HTML" + }, + "optionSanitizedHTML_label": { + "message": "Zjednorjeny HTML" + }, + "optionPlaintext_label": { + "message": "Luty tekst" + }, + "optionAllBodyParts_label": { + "message": "Wšě dźěle wobsaha" + }, + + "optionAdditionalOptions_label": { + "message": "Rozšěrjene nastajenja" + }, + "optionAllwaysVersusClickDescription_label": { + "message": "Při pokazowanju originalneho HTML hodźi so dalši, opcionalny wobsah zmóžnić. Móžeće tute přidatne nastajenja za modus originalneho HTML globalnje dowolić abo jenož za nachwilnu funkciju \"HTML pokazać\"." + }, + "optionRemoteContent_label": { + "message": "Zdaleny wobsah (wobrazy, stilowe předłohi ...)" + }, + "optionAllwaysRemoteContent_label": { + "message": "Zdaleny wobsah generelnje dowolić (njeporuča so)" + }, + "optionAllwaysRemoteContentWarning_label": { + "message": "To je jedne z nastajenjow Thunderbird, kotrež móžeće w nastajenjach pod \"Priwatnosć a wěstota\" → \"Zdaleny wobsah w powěsćach dowolić\" namakać. Jeli tutón přidatk wotinstalujeće, tute nastajenje zmóžnjene wostawa, ale móžeće tež tute nastajenje w Thunderbird bjez tutoho přidatka změnić.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionTempRemoteContent_label": { + "message": "Zdaleny wobsah za wubranu powěsć z kliknjenjom na \"HTML pokazać\" dowolić" + }, + "optionAttachments_label": { + "message": "Přiwěški" + }, + "optionAttachmentsAllwaysInline_label": { + "message": "Přiwěški přeco zawjazene pokazać (njeporuča so)" + }, + "optionAttachmentsTempInlineWarning_label": { + "message": "To je jedne z nastajenjow Thunderbird, kotrež móžeće w nastajenjach pod \"Napohlad\" → \"Přiwěški zasadźene zwobraznić\" namakać. Jeli tutón přidatk wotinstalujeće, tute nastajenje zmóžnjene wostawa, ale móžeće tež tute nastajenje w Thunderbird bjez tutoho přidatka změnić.", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionAttachmentsTempInline_label": { + "message": "Z kliknjenjom na \"HTML pokazać\" přiwěški nachwilu zawjazane pokazać" + }, + + "optionCommandKeyHeader_label": { + "message": "Tastowa skrótšenka" + }, + "optionCommandKeyDescription_label": { + "message": "Tu podata funkcija tłóčatka da so tež z pomocu tastoweje skrótšenki wuwjesć. Móžeće tastowu skrótšenku přiměrić, je-li trjeba. Tastowa skrótšenka so potom jako znamješkowy rjećazk pokaza, kotryž z dweju abo třoch tastow wobsteji, dźělene přez \"+\". Na přikład \"Ctrl+Alt+F5\" (3 tasty - to je standardna tastowa skrótšenka) abo \"Ctrl+F5\" (2 tasće).", + "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." + }, + "optionCommandKeyRulesText_label": { + "message": "Dyrbiće prawidła wobkedźbować, kotrež so na MDN wopisuja." + }, + "optionCommandKey_label": { + "message": "Tastowa skrótšenka za \"HTML pokazać\":" + }, + "optionCommandKeyWarning_label": { + "message": "Waša wubrana přikazowa tasta płaćiwa njeje. Tohodla so \"Ctrl+Alt+F5\" wužiwa.", + "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." + }, + + "optionDebugHeader_label": { + "message": "Modus pytanja zmylkow" + }, + "optionDebugDescription_label": { + "message": "Informacije wo pytanju zmylkow so w zmylkowej konsoli protokoluja." + }, + "optionDebug_label": { + "message": "Modus pytanja zmylkow aktiwizować" + }, + + "optionResetAllOptionsHeader_label": { + "message": "Nastajenja wróćo stajić" + }, + "optionResetAllOptionsDescription_label": { + "message": "Klikńće, zo byšće wšě nastajenja na jich standardne hódnoty wróćo stajił." + }, + "optionResetAllOptionsDescription2_label": { + "message": "Klikńće, zo byšće wšě nastajenja na standard Thunderbird abo doporučene hódnoty wróćo stajił." + }, + "optionButtonResetToDefault_label": { + "message": "Thunderbird standard" + }, + "optionButtonResetToRecommended_label": { + "message": "Doporučene" + }, + "optionButtonReset_label": { + "message": "Wróćo stajić" + }, + + "uninstallResetDialog_label": { + "message": "Allow HTML Temp so znjemóžni abo wotinstaluje.\n\nChceće nastajenja Thunderbird za \"Tekst powěsće jako\" (HTML-modus), \"Přiwěški zasadźene zwobraznić\" a \"Zdaleny wobsah w powěsćach dowolić\" wobchować abo wróćo stajić?", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "uninstallResetToDefault_label": { + "message": "Wróćo stajić" + }, + "uninstallResetNotToDefault_label": { + "message": "Nastajenja wobchować" + } + } \ No newline at end of file diff -Nru allow-html-temp-8.1.5/_locales/ja/messages.json allow-html-temp-10.0.4/_locales/ja/messages.json --- allow-html-temp-8.1.5/_locales/ja/messages.json 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/_locales/ja/messages.json 2022-05-27 15:10:56.000000000 +0000 @@ -1,155 +1,155 @@ -{ - "extensionName": { - "message": "Allow HTML Temp" - }, - "extensionDescription": { - "message": "選択したメッセージを一時的に HTML 形式で表示します。" - }, - - "button_label": { - "message": "HTML 表示" - }, - "button_tooltip": { - "message": "選択したメッセージを一時的に HTML 形式で表示します" - }, - "button_label_html": { - "message": "HTML 表示" - }, - "button_label_sanitized": { - "message": "シンプル HTML 表示" - }, - "button_label_plaintext": { - "message": "プレーンテキスト表示" - }, - - "optionPageTitle_label": { - "message": "Allow HTML Temp - 設定" - }, - "optionGeneralDescription_label": { - "message": "悪意のあるコード (例: 'Locky' や 'Tesla') の実行を防ぐにはメール内の HTML、JavaScript、インラインの添付ファイルのサポートを無効にすることを推奨します。なお、JavaScript は Thunderbird によって既定で制限されます。" - }, - - "optionHTML_label": { - "message": "メール内の HTML" - }, - "optionHTMLDescription_label": { - "message": "既定には制限つきの選択肢(シンプル HTML またはプレーンテキスト)を推奨します。" - }, - "optionHTMLDescriptionWarning_label": { - "message": "この項目は Thunderbird 本体のメニュー '表示' → 'メッセージの表示形式' の設定と共通です。ここで選択した設定は本アドオンを削除してもそのまま残りますが、Thunderbird 本体からも変更できます。", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionAppHTML_label": { - "message": "既定:" - }, - "optionButtonHTML_label": { - "message": "'HTML 表示' クリック:" - }, - "optionNotRecommended_label": { - "message": "(非推奨)" - }, - "optionOriginalHTML_label": { - "message": "オリジナル HTML" - }, - "optionSanitizedHTML_label": { - "message": "シンプル HTML" - }, - "optionPlaintext_label": { - "message": "プレーンテキスト" - }, - "optionAllBodyParts_label": { - "message": "すべての MIME ボディパーツ" - }, - - "optionAdditionalOptions_label": { - "message": "詳細オプション" - }, - "optionAllwaysVersusClickDescription_label": { - "message": "オリジナルの HTML の場合、いくつかのコンテンツオプションを設定することができます。以下のオプションに基づいてリモートコンテンツを許可し、JavaScript を有効にし、インライン添付ファイルの表示を有効にします。" - }, - "optionRemoteContent_label": { - "message": "リモートコンテンツ (画像、スタイルシート、...)" - }, - "optionAllwaysRemoteContent_label": { - "message": "リモートコンテンツを常に許可する(非推奨)" - }, - "optionAllwaysRemoteContentWarning_label": { - "message": "この項目は Thunderbird 本体の設定 'プライバシーとセキュリティ' → 'メッセージ内のリモートコンテンツを許可する' と共通です。ここで選択した設定は本アドオンを削除してもそのまま残りますが、Thunderbird 本体からも変更できます。", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionTempRemoteContent_label": { - "message": "'HTML 表示' をクリックして選択したメッセージのリモートコンテンツを一時的に許可する" - }, - "optionAttachments_label": { - "message": "添付ファイル" - }, - "optionAttachmentsAllwaysInline_label": { - "message": "添付ファイルを常にインラインで表示する(非推奨)" - }, - "optionAttachmentsTempInlineWarning_label": { - "message": "この項目は Thunderbird 本体のメニュー '表示' → '添付をメッセージ本文に表示' の設定と共通です。ここで選択した設定は本アドオンを削除してもそのまま残りますが、Thunderbird 本体からも変更できます。", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "optionAttachmentsTempInline_label": { - "message": "'HTML 表示' をクリックして添付ファイルを一時的にインラインで表示する" - }, - - "optionCommandKeyHeader_label": { - "message": "ショートカット" - }, - "optionCommandKeyDescription_label": { - "message": "以下のボタンの機能はショートカットで起動できます。ショートカットは必要に応じて変更できます。キーは 2 つまたは 3 つのキー名を '+' で区切った文字列で表されます。例: 'Ctrl+Alt+F5' (3 キー - 既定値)、'Ctrl+F5' (2 キー)", - "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." - }, - "optionCommandKeyRulesText_label": { - "message": "変更する場合、MDN に記載された規則も参照してください。" - }, - "optionCommandKey_label": { - "message": "'HTML 表示' のショートカット:" - }, - "optionCommandKeyWarning_label": { - "message": "指定されたキーは規則に従っていません。既定値 'Ctrl+Alt+F5' が使用されます。", - "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." - }, - - "optionDebugHeader_label": { - "message": "デバッグモード" - }, - "optionDebugDescription_label": { - "message": "デバッグ情報がエラーコンソールに出力されます。" - }, - "optionDebug_label": { - "message": "デバッグモードを有効にする" - }, - - "optionResetAllOptionsHeader_label": { - "message": "全設定のリセット" - }, - "optionResetAllOptionsDescription_label": { - "message": "クリックするとすべての設定を既定値にリセットします。" - }, - "optionResetAllOptionsDescription2_label": { - "message": "クリックするとすべての設定を Thunderbird 既定値または推奨値にリセットします。" - }, - "optionButtonResetToDefault_label": { - "message": "Thunderbird 既定値" - }, - "optionButtonResetToRecommended_label": { - "message": "推奨設定" - }, - "optionButtonReset_label": { - "message": "リセット" - }, - - "uninstallResetDialog_label": { - "message": "Allow HTML Temp を無効化または削除しようとしています。\n\n Thunderbird 本体の設定 'メッセージの表示形式'、'メッセージ内のリモートコンテンツを許可する'、'添付をメッセージ本文に表示' の値をリセットしますか? 現在の設定値を保持しますか?", - "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" - }, - "uninstallResetToDefault_label": { - "message": "リセット" - }, - "uninstallResetNotToDefault_label": { - "message": "設定値を保持" - } - +{ + "extensionName": { + "message": "Allow HTML Temp" + }, + "extensionDescription": { + "message": "選択したメッセージを一時的に HTML 形式で表示します。" + }, + + "button_label": { + "message": "HTML 表示" + }, + "button_tooltip": { + "message": "選択したメッセージを一時的に HTML 形式で表示します" + }, + "button_label_html": { + "message": "HTML 表示" + }, + "button_label_sanitized": { + "message": "シンプル HTML 表示" + }, + "button_label_plaintext": { + "message": "プレーンテキスト表示" + }, + + "optionPageTitle_label": { + "message": "Allow HTML Temp - 設定" + }, + "optionGeneralDescription_label": { + "message": "悪意のあるコード (例: 'Locky' や 'Tesla') の実行を防ぐにはメール内の HTML、JavaScript、インラインの添付ファイルのサポートを無効にすることを推奨します。なお、JavaScript は Thunderbird によって既定で制限されます。" + }, + + "optionHTML_label": { + "message": "メール内の HTML" + }, + "optionHTMLDescription_label": { + "message": "既定には制限つきの選択肢(シンプル HTML またはプレーンテキスト)を推奨します。" + }, + "optionHTMLDescriptionWarning_label": { + "message": "この項目は Thunderbird 本体のメニュー '表示' → 'メッセージの表示形式' の設定と共通です。ここで選択した設定は本アドオンを削除してもそのまま残りますが、Thunderbird 本体からも変更できます。", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionAppHTML_label": { + "message": "既定:" + }, + "optionButtonHTML_label": { + "message": "'HTML 表示' クリック:" + }, + "optionNotRecommended_label": { + "message": "(非推奨)" + }, + "optionOriginalHTML_label": { + "message": "オリジナル HTML" + }, + "optionSanitizedHTML_label": { + "message": "シンプル HTML" + }, + "optionPlaintext_label": { + "message": "プレーンテキスト" + }, + "optionAllBodyParts_label": { + "message": "すべての MIME ボディパーツ" + }, + + "optionAdditionalOptions_label": { + "message": "詳細オプション" + }, + "optionAllwaysVersusClickDescription_label": { + "message": "オリジナルの HTML の場合、いくつかのコンテンツオプションを設定することができます。以下のオプションに基づいてリモートコンテンツを許可し、JavaScript を有効にし、インライン添付ファイルの表示を有効にします。" + }, + "optionRemoteContent_label": { + "message": "リモートコンテンツ (画像、スタイルシート、...)" + }, + "optionAllwaysRemoteContent_label": { + "message": "リモートコンテンツを常に許可する(非推奨)" + }, + "optionAllwaysRemoteContentWarning_label": { + "message": "この項目は Thunderbird 本体の設定 'プライバシーとセキュリティ' → 'メッセージ内のリモートコンテンツを許可する' と共通です。ここで選択した設定は本アドオンを削除してもそのまま残りますが、Thunderbird 本体からも変更できます。", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionTempRemoteContent_label": { + "message": "'HTML 表示' をクリックして選択したメッセージのリモートコンテンツを一時的に許可する" + }, + "optionAttachments_label": { + "message": "添付ファイル" + }, + "optionAttachmentsAllwaysInline_label": { + "message": "添付ファイルを常にインラインで表示する(非推奨)" + }, + "optionAttachmentsTempInlineWarning_label": { + "message": "この項目は Thunderbird 本体のメニュー '表示' → '添付をメッセージ本文に表示' の設定と共通です。ここで選択した設定は本アドオンを削除してもそのまま残りますが、Thunderbird 本体からも変更できます。", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "optionAttachmentsTempInline_label": { + "message": "'HTML 表示' をクリックして添付ファイルを一時的にインラインで表示する" + }, + + "optionCommandKeyHeader_label": { + "message": "ショートカット" + }, + "optionCommandKeyDescription_label": { + "message": "以下のボタンの機能はショートカットで起動できます。ショートカットは必要に応じて変更できます。キーは 2 つまたは 3 つのキー名を '+' で区切った文字列で表されます。例: 'Ctrl+Alt+F5' (3 キー - 既定値)、'Ctrl+F5' (2 キー)", + "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." + }, + "optionCommandKeyRulesText_label": { + "message": "変更する場合、MDN に記載された規則も参照してください。" + }, + "optionCommandKey_label": { + "message": "'HTML 表示' のショートカット:" + }, + "optionCommandKeyWarning_label": { + "message": "指定されたキーは規則に従っていません。既定値 'Ctrl+Alt+F5' が使用されます。", + "description": "Do not translate the Keys in the line above. The modifier keys like Ctrl and Alt must remain as given, because of the technical character of the text." + }, + + "optionDebugHeader_label": { + "message": "デバッグモード" + }, + "optionDebugDescription_label": { + "message": "デバッグ情報がエラーコンソールに出力されます。" + }, + "optionDebug_label": { + "message": "デバッグモードを有効にする" + }, + + "optionResetAllOptionsHeader_label": { + "message": "全設定のリセット" + }, + "optionResetAllOptionsDescription_label": { + "message": "クリックするとすべての設定を既定値にリセットします。" + }, + "optionResetAllOptionsDescription2_label": { + "message": "クリックするとすべての設定を Thunderbird 既定値または推奨値にリセットします。" + }, + "optionButtonResetToDefault_label": { + "message": "Thunderbird 既定値" + }, + "optionButtonResetToRecommended_label": { + "message": "推奨設定" + }, + "optionButtonReset_label": { + "message": "リセット" + }, + + "uninstallResetDialog_label": { + "message": "Allow HTML Temp を無効化または削除しようとしています。\n\n Thunderbird 本体の設定 'メッセージの表示形式'、'メッセージ内のリモートコンテンツを許可する'、'添付をメッセージ本文に表示' の値をリセットしますか? 現在の設定値を保持しますか?", + "description": "Please, use the original terms, which are used in Thunderbird menus and options dialog in your language" + }, + "uninstallResetToDefault_label": { + "message": "リセット" + }, + "uninstallResetNotToDefault_label": { + "message": "設定値を保持" + } + } \ No newline at end of file diff -Nru allow-html-temp-8.1.5/api/LegacyPrefs/README.md allow-html-temp-10.0.4/api/LegacyPrefs/README.md --- allow-html-temp-8.1.5/api/LegacyPrefs/README.md 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/api/LegacyPrefs/README.md 2024-03-03 22:15:52.000000000 +0000 @@ -1,45 +1,60 @@ -## Objective - -Use this API to access Thunderbird's system preferences or to migrate your own preferences from the Thunderbird preference system to the local storage of your MailExtension. - -## Usage - -### API Functions - -This API provides the following functions: - -#### async getPref(aName, [aFallback]) - -Returns the value for the ``aName`` preference. If it is not defined or has no default value assigned, ``aFallback`` will be returned (which defaults to ``null``). - -#### async getUserPref(aName) - -Returns the user defined value for the ``aName`` preference. This will ignore any defined default value and will only return an explicitly set value, which differs from the default. Otherwise it will return ``null``. - -#### clearUserPref(aName) - -Clears the user defined value for preference ``aName``. Subsequent calls to ``getUserPref(aName)`` will return ``null``. - -#### async setPref(aName, aValue) - -Set the ``aName`` preference to the given value. Will return false and log an error to the console, if the type of ``aValue`` does not match the type of the preference. - -### API Events - -This API provides the following events: - -#### onChanged.addListener(listener, branch) - -Register a listener which is notified each time a value in the specified branch is changed. The listener returns the name and the new value of the changed preference. - -Example: - -``` -browser.LegacyPrefs.onChanged.addListener(async (name, value) => { - console.log(`Changed value in "mailnews.": ${name} = ${value}`); -}, "mailnews."); -``` - ---- - +## Objective + +Use this API to access Thunderbird's system preferences or to migrate your own preferences from the Thunderbird preference system to the local storage of your MailExtension. + +## Usage + +Add the [LegacyPrefs API](https://github.com/thundernest/addon-developer-support/tree/master/auxiliary-apis/LegacyPrefs) to your add-on. Your `manifest.json` needs an entry like this: + +``` + "experiment_apis": { + "LegacyPrefs": { + "schema": "api/LegacyPrefs/schema.json", + "parent": { + "scopes": ["addon_parent"], + "paths": [["LegacyPrefs"]], + "script": "api/LegacyPrefs/implementation.js" + } + } + }, +``` + +## API Functions + +This API provides the following functions: + +### async getPref(aName, [aFallback]) + +Returns the value for the ``aName`` preference. If it is not defined or has no default value assigned, ``aFallback`` will be returned (which defaults to ``null``). + +### async getUserPref(aName) + +Returns the user defined value for the ``aName`` preference. This will ignore any defined default value and will only return an explicitly set value, which differs from the default. Otherwise it will return ``null``. + +### clearUserPref(aName) + +Clears the user defined value for preference ``aName``. Subsequent calls to ``getUserPref(aName)`` will return ``null``. + +### async setPref(aName, aValue) + +Set the ``aName`` preference to the given value. Will return false and log an error to the console, if the type of ``aValue`` does not match the type of the preference. + +## API Events + +This API provides the following events: + +### onChanged.addListener(listener, branch) + +Register a listener which is notified each time a value in the specified branch is changed. The listener returns the name and the new value of the changed preference. + +Example: + +``` +browser.LegacyPrefs.onChanged.addListener(async (name, value) => { + console.log(`Changed value in "mailnews.": ${name} = ${value}`); +}, "mailnews."); +``` + +--- + A detailed example using the LegacyPref API to migrate add-on preferences to the local storage can be found in [/scripts/preferences/](https://github.com/thundernest/addon-developer-support/tree/master/scripts/preferences). \ No newline at end of file diff -Nru allow-html-temp-8.1.5/api/LegacyPrefs/implementation.js allow-html-temp-10.0.4/api/LegacyPrefs/implementation.js --- allow-html-temp-8.1.5/api/LegacyPrefs/implementation.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/api/LegacyPrefs/implementation.js 2024-06-06 12:32:12.000000000 +0000 @@ -1,208 +1,213 @@ -/* - * This file is provided by the addon-developer-support repository at - * https://github.com/thundernest/addon-developer-support - * - * Version: 1.9 - * fixed fallback issue reported by Axel Grude - * - * Version: 1.8 - * reworked onChanged event to allow registering multiple branches - * - * Version: 1.7 - * add onChanged event - * - * Version: 1.6 - * add setDefaultPref() - * - * Version: 1.5 - * replace set/getCharPref by set/getStringPref to fix encoding issue - * - * Version: 1.4 - * - setPref() function returns true if the value could be set, otherwise false - * - * Version: 1.3 - * - add setPref() function - * - * Version: 1.2 - * - add getPref() function - * - * Author: John Bieling (john@thunderbird.net) - * - * 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 http://mozilla.org/MPL/2.0/. - */ - -var { ExtensionCommon } = ChromeUtils.import( - "resource://gre/modules/ExtensionCommon.jsm" -); -var { ExtensionUtils } = ChromeUtils.import( - "resource://gre/modules/ExtensionUtils.jsm" -); -var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); - -var { ExtensionError } = ExtensionUtils; - -var LegacyPrefs = class extends ExtensionCommon.ExtensionAPI { - getAPI(context) { - - class LegacyPrefsManager { - constructor() { - this.observedBranches = new Map(); - this.QueryInterface = ChromeUtils.generateQI([ - "nsIObserver", - "nsISupportsWeakReference", - ]) - } - - addObservedBranch(branch, fire) { - return this.observedBranches.set(branch, fire); - } - - hasObservedBranch(branch) { - return this.observedBranches.has(branch); - } - - removeObservedBranch(branch) { - return this.observedBranches.delete(branch); - } - - async observe(aSubject, aTopic, aData) { - if (aTopic == "nsPref:changed") { - let branch = [...this.observedBranches.keys()] - .reduce( - (p, c) => aData.startsWith(c) && (!p || c.length > p.length) ? c : p, - null - ); - if (branch) { - let name = aData.substr(branch.length); - let value = await this.getLegacyPref(aData); - let fire = this.observedBranches.get(branch); - fire(name, value); - } - } - } - - async getLegacyPref( - aName, - aFallback = null, - userPrefOnly = true - ) { - let prefType = Services.prefs.getPrefType(aName); - if (prefType == Services.prefs.PREF_INVALID) { - return aFallback; - } - - let value = aFallback; - if (!userPrefOnly || Services.prefs.prefHasUserValue(aName)) { - switch (prefType) { - case Services.prefs.PREF_STRING: - value = Services.prefs.getStringPref(aName, aFallback); - break; - - case Services.prefs.PREF_INT: - value = Services.prefs.getIntPref(aName, aFallback); - break; - - case Services.prefs.PREF_BOOL: - value = Services.prefs.getBoolPref(aName, aFallback); - break; - - default: - console.error( - `Legacy preference <${aName}> has an unknown type of <${prefType}>.` - ); - } - } - return value; - } - } - - let legacyPrefsManager = new LegacyPrefsManager(); - - return { - LegacyPrefs: { - onChanged: new ExtensionCommon.EventManager({ - context, - name: "LegacyPrefs.onChanged", - register: (fire, branch) => { - if (legacyPrefsManager.hasObservedBranch(branch)) { - throw new ExtensionError(`Cannot add more than one listener for branch "${branch}".`) - } - legacyPrefsManager.addObservedBranch(branch, fire.sync); - Services.prefs - .getBranch(null) - .addObserver(branch, legacyPrefsManager); - return () => { - Services.prefs - .getBranch(null) - .removeObserver(branch, legacyPrefsManager); - legacyPrefsManager.removeObservedBranch(branch); - }; - }, - }).api(), - - // only returns something, if a user pref value is set - getUserPref: async function (aName) { - return await legacyPrefsManager.getLegacyPref(aName); - }, - - // returns the default value, if no user defined value exists, - // and returns the fallback value, if the preference does not exist - getPref: async function (aName, aFallback = null) { - return await legacyPrefsManager.getLegacyPref(aName, aFallback, false); - }, - - clearUserPref: function (aName) { - Services.prefs.clearUserPref(aName); - }, - - // sets a pref - setPref: async function (aName, aValue) { - let prefType = Services.prefs.getPrefType(aName); - if (prefType == Services.prefs.PREF_INVALID) { - console.error( - `Unknown legacy preference <${aName}>, forgot to declare a default?.` - ); - return false; - } - - switch (prefType) { - case Services.prefs.PREF_STRING: - Services.prefs.setStringPref(aName, aValue); - return true; - break; - - case Services.prefs.PREF_INT: - Services.prefs.setIntPref(aName, aValue); - return true; - break; - - case Services.prefs.PREF_BOOL: - Services.prefs.setBoolPref(aName, aValue); - return true; - break; - - default: - console.error( - `Legacy preference <${aName}> has an unknown type of <${prefType}>.` - ); - } - return false; - }, - - setDefaultPref: async function (aName, aValue) { - let defaults = Services.prefs.getDefaultBranch(""); - switch (typeof aValue) { - case "string": - return defaults.setStringPref(aName, aValue); - case "number": - return defaults.setIntPref(aName, aValue); - case "boolean": - return defaults.setBoolPref(aName, aValue); - } - }, - }, - }; - } +/* + * This file is provided by the addon-developer-support repository at + * https://github.com/thundernest/addon-developer-support + * + * Version 1.10 + * - adjusted to Thunderbird Supernova (Services is now in globalThis) + * + * Version 1.9 + * - fixed fallback issue reported by Axel Grude + * + * Version 1.8 + * - reworked onChanged event to allow registering multiple branches + * + * Version 1.7 + * - add onChanged event + * + * Version 1.6 + * - add setDefaultPref() + * + * Version 1.5 + * - replace set/getCharPref by set/getStringPref to fix encoding issue + * + * Version 1.4 + * - setPref() function returns true if the value could be set, otherwise false + * + * Version 1.3 + * - add setPref() function + * + * Version 1.2 + * - add getPref() function + * + * Author: John Bieling (john@thunderbird.net) + * + * 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 http://mozilla.org/MPL/2.0/. + */ + +var { ExtensionCommon } = ChromeUtils.importESModule( + "resource://gre/modules/ExtensionCommon.sys.mjs" +); +var { ExtensionUtils } = ChromeUtils.importESModule( + "resource://gre/modules/ExtensionUtils.sys.mjs" +); +var { ExtensionError } = ExtensionUtils; + +var Services = globalThis.Services || + ChromeUtils.importESModule("resource://gre/modules/Services.sys.mjs").Services; + + +var LegacyPrefs = class extends ExtensionCommon.ExtensionAPI { + getAPI(context) { + + class LegacyPrefsManager { + constructor() { + this.observedBranches = new Map(); + this.QueryInterface = ChromeUtils.generateQI([ + "nsIObserver", + "nsISupportsWeakReference", + ]) + } + + addObservedBranch(branch, fire) { + return this.observedBranches.set(branch, fire); + } + + hasObservedBranch(branch) { + return this.observedBranches.has(branch); + } + + removeObservedBranch(branch) { + return this.observedBranches.delete(branch); + } + + async observe(aSubject, aTopic, aData) { + if (aTopic == "nsPref:changed") { + let branch = [...this.observedBranches.keys()] + .reduce( + (p, c) => aData.startsWith(c) && (!p || c.length > p.length) ? c : p, + null + ); + if (branch) { + let name = aData.substr(branch.length); + let value = await this.getLegacyPref(aData); + let fire = this.observedBranches.get(branch); + fire(name, value); + } + } + } + + async getLegacyPref( + aName, + aFallback = null, + userPrefOnly = true + ) { + let prefType = Services.prefs.getPrefType(aName); + if (prefType == Services.prefs.PREF_INVALID) { + return aFallback; + } + + let value = aFallback; + if (!userPrefOnly || Services.prefs.prefHasUserValue(aName)) { + switch (prefType) { + case Services.prefs.PREF_STRING: + value = Services.prefs.getStringPref(aName, aFallback); + break; + + case Services.prefs.PREF_INT: + value = Services.prefs.getIntPref(aName, aFallback); + break; + + case Services.prefs.PREF_BOOL: + value = Services.prefs.getBoolPref(aName, aFallback); + break; + + default: + console.error( + `Legacy preference <${aName}> has an unknown type of <${prefType}>.` + ); + } + } + return value; + } + } + + let legacyPrefsManager = new LegacyPrefsManager(); + + return { + LegacyPrefs: { + onChanged: new ExtensionCommon.EventManager({ + context, + name: "LegacyPrefs.onChanged", + register: (fire, branch) => { + if (legacyPrefsManager.hasObservedBranch(branch)) { + throw new ExtensionError(`Cannot add more than one listener for branch "${branch}".`) + } + legacyPrefsManager.addObservedBranch(branch, fire.sync); + Services.prefs + .getBranch(null) + .addObserver(branch, legacyPrefsManager); + return () => { + Services.prefs + .getBranch(null) + .removeObserver(branch, legacyPrefsManager); + legacyPrefsManager.removeObservedBranch(branch); + }; + }, + }).api(), + + // only returns something, if a user pref value is set + getUserPref: async function (aName) { + return await legacyPrefsManager.getLegacyPref(aName); + }, + + // returns the default value, if no user defined value exists, + // and returns the fallback value, if the preference does not exist + getPref: async function (aName, aFallback = null) { + return await legacyPrefsManager.getLegacyPref(aName, aFallback, false); + }, + + clearUserPref: function (aName) { + Services.prefs.clearUserPref(aName); + }, + + // sets a pref + setPref: async function (aName, aValue) { + let prefType = Services.prefs.getPrefType(aName); + if (prefType == Services.prefs.PREF_INVALID) { + console.error( + `Unknown legacy preference <${aName}>, forgot to declare a default?.` + ); + return false; + } + + switch (prefType) { + case Services.prefs.PREF_STRING: + Services.prefs.setStringPref(aName, aValue); + return true; + break; + + case Services.prefs.PREF_INT: + Services.prefs.setIntPref(aName, aValue); + return true; + break; + + case Services.prefs.PREF_BOOL: + Services.prefs.setBoolPref(aName, aValue); + return true; + break; + + default: + console.error( + `Legacy preference <${aName}> has an unknown type of <${prefType}>.` + ); + } + return false; + }, + + setDefaultPref: async function (aName, aValue) { + let defaults = Services.prefs.getDefaultBranch(""); + switch (typeof aValue) { + case "string": + return defaults.setStringPref(aName, aValue); + case "number": + return defaults.setIntPref(aName, aValue); + case "boolean": + return defaults.setBoolPref(aName, aValue); + } + }, + }, + }; + } }; \ No newline at end of file diff -Nru allow-html-temp-8.1.5/api/LegacyPrefs/schema.json allow-html-temp-10.0.4/api/LegacyPrefs/schema.json --- allow-html-temp-8.1.5/api/LegacyPrefs/schema.json 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/api/LegacyPrefs/schema.json 2024-03-03 11:41:20.000000000 +0000 @@ -1,134 +1,134 @@ -[ - { - "namespace": "LegacyPrefs", - "events": [ - { - "name": "onChanged", - "type": "function", - "description": "Fired when a preference has been changed.", - "parameters": [ - { - "name": "name", - "type": "string", - "description": "Name of the preference." - }, - { - "name": "value", - "type": "any", - "description": "Value of the preference." - } - ], - "extraParameters": [ - { - "name": "branch", - "description": "The branch to observe.", - "type": "string" - } - ] - } - ], - "functions": [ - { - "name": "getUserPref", - "type": "function", - "async": true, - "description": "Gets a user value from the legacy pref system.", - "parameters": [ - { - "name": "aName", - "type": "string", - "description": "Name of the preference." - } - ] - }, - { - "name": "getPref", - "type": "function", - "async": true, - "description": "Gets a value from the legacy pref system.", - "parameters": [ - { - "name": "aName", - "type": "string", - "description": "Name of the preference." - }, - { - "name": "aFallback", - "type": "any", - "description": "Value to be returned, if the requested preference does not exist.", - "optional": true, - "default": null - } - ] - }, - { - "name": "setPref", - "type": "function", - "async": true, - "description": "Sets a value for an existing pref of the legacy pref system.", - "parameters": [ - { - "name": "aName", - "type": "string", - "description": "Name of the preference." - }, - { - "name": "aValue", - "choices": [ - { - "type": "string" - }, - { - "type": "integer" - }, - { - "type": "boolean" - } - ], - "description": "Value to be set." - } - ] - }, - { - "name": "setDefaultPref", - "type": "function", - "async": true, - "description": "Defines the default value for pref of the legacy pref system. This defines the type of a pref and is needed for new prefs.", - "parameters": [ - { - "name": "aName", - "type": "string", - "description": "Name of the preference." - }, - { - "name": "aValue", - "choices": [ - { - "type": "string" - }, - { - "type": "integer" - }, - { - "type": "boolean" - } - ], - "description": "Default value to be set." - } - ] - }, - { - "name": "clearUserPref", - "type": "function", - "description": "Removes a user value from the legacy pref system.", - "parameters": [ - { - "name": "aName", - "type": "string", - "description": "Name of the preference." - } - ] - } - ] - } +[ + { + "namespace": "LegacyPrefs", + "events": [ + { + "name": "onChanged", + "type": "function", + "description": "Fired when a preference has been changed.", + "parameters": [ + { + "name": "name", + "type": "string", + "description": "Name of the preference." + }, + { + "name": "value", + "type": "any", + "description": "Value of the preference." + } + ], + "extraParameters": [ + { + "name": "branch", + "description": "The branch to observe.", + "type": "string" + } + ] + } + ], + "functions": [ + { + "name": "getUserPref", + "type": "function", + "async": true, + "description": "Gets a user value from the legacy pref system.", + "parameters": [ + { + "name": "aName", + "type": "string", + "description": "Name of the preference." + } + ] + }, + { + "name": "getPref", + "type": "function", + "async": true, + "description": "Gets a value from the legacy pref system.", + "parameters": [ + { + "name": "aName", + "type": "string", + "description": "Name of the preference." + }, + { + "name": "aFallback", + "type": "any", + "description": "Value to be returned, if the requested preference does not exist.", + "optional": true, + "default": null + } + ] + }, + { + "name": "setPref", + "type": "function", + "async": true, + "description": "Sets a value for an existing pref of the legacy pref system.", + "parameters": [ + { + "name": "aName", + "type": "string", + "description": "Name of the preference." + }, + { + "name": "aValue", + "choices": [ + { + "type": "string" + }, + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "description": "Value to be set." + } + ] + }, + { + "name": "setDefaultPref", + "type": "function", + "async": true, + "description": "Defines the default value for pref of the legacy pref system. This defines the type of a pref and is needed for new prefs.", + "parameters": [ + { + "name": "aName", + "type": "string", + "description": "Name of the preference." + }, + { + "name": "aValue", + "choices": [ + { + "type": "string" + }, + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "description": "Default value to be set." + } + ] + }, + { + "name": "clearUserPref", + "type": "function", + "description": "Removes a user value from the legacy pref system.", + "parameters": [ + { + "name": "aName", + "type": "string", + "description": "Name of the preference." + } + ] + } + ] + } ] \ No newline at end of file diff -Nru allow-html-temp-8.1.5/api/allowHtmlTemp/implementation.js allow-html-temp-10.0.4/api/allowHtmlTemp/implementation.js --- allow-html-temp-8.1.5/api/allowHtmlTemp/implementation.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/api/allowHtmlTemp/implementation.js 2024-06-07 23:52:02.000000000 +0000 @@ -1,220 +1,266 @@ -(function (exports) { - - // Import some things we need. - var { ExtensionCommon } = ChromeUtils.import("resource://gre/modules/ExtensionCommon.jsm"); - var { ExtensionSupport } = ChromeUtils.import("resource:///modules/ExtensionSupport.jsm"); - - var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); - - var { MsgHdrToMimeMessage } = ChromeUtils.import("resource:///modules/gloda/MimeMessage.jsm"); - - var tracker; - - class Tracker { - constructor(extension) { - this.extension = extension; - this.windowTracker = new Set(); - this.onClickedListener = new ExtensionCommon.EventEmitter(); - - this.notifyOnClickedListener = (event) => { - let window = event.target.ownerGlobal; - let tabmail = window.document.getElementById("tabmail"); - // for standalone message windows "tabmail" = null - // therefore we must then use "window" to get "nativeTab" - let nativeTab = tabmail ? tabmail.currentTabInfo : window; - - let tabId = this.extension.tabManager.getWrapper(nativeTab).id; - this.onClickedListener.emit("remoteContentForMsg-clicked", tabId); - } - } - - get instanceId() { - return `${this.extension.uuid}_${this.extension.instanceId}`; - } - - get windowListenerId() { - return `windowListener_${this.instanceId}`; - } - - addOnClickedListener(callback) { - this.onClickedListener.on("remoteContentForMsg-clicked", callback); - } - - removeOnClickedListener(callback) { - this.onClickedListener.off("remoteContentForMsg-clicked", callback); - } - - trackWindow(window) { - this.windowTracker.add(window); - } - - untrackWindow(window) { - this.windowTracker.delete(window); - } - - get trackedWindows() { - return Array.from(this.windowTracker); - } - - } - - class allowHtmlTemp extends ExtensionCommon.ExtensionAPI { - // Alternative to defining a constructor here in order to init the class, is - // to use the onStartup event. However, this causes the API to be instantiated - // directly after the add-on has been loaded, not when the API is first used. - constructor(extension) { - // The only parameter is extension, but it could change in the future. - // super() will add the extension as a member of this. - super(extension); - - tracker = new Tracker(this.extension); - ExtensionSupport.registerWindowListener( - tracker.windowListenerId, { - chromeURLs: [ - "chrome://messenger/content/messenger.xhtml", - "chrome://messenger/content/messageWindow.xhtml" - ], - onLoadWindow: function (window) { - // console.debug("AHT - onLoadWindow"); - let element = window.document.getElementById("remoteContentOptionAllowForMsg"); - element.addEventListener("click", tracker.notifyOnClickedListener); - - // let oncommand_modified = "console.debug('AHT: remoteContentOptionAllowForMsg');"; - // element.setAttribute("oncommand", oncommand_modified); - element.removeAttribute("oncommand"); - - tracker.trackWindow(window); - }, - onUnloadWindow: function (window) { - // console.debug("AHT - onUnloadWindow"); - let element = window.document.getElementById("remoteContentOptionAllowForMsg"); - element.removeEventListener("click", tracker.notifyOnClickedListener); - - let oncommand_original = "LoadMsgWithRemoteContent();"; - element.setAttribute("oncommand", oncommand_original); - - tracker.untrackWindow(window); - } - } - ); - } - - // The API implementation. - getAPI(context) { - return { - // Again, this key must have the same name. - allowHtmlTemp: { - - // An event. Most of this is boilerplate you don't need to worry about, just copy it. - onClick: new ExtensionCommon.EventManager({ - context, - name: "allowHtmlTemp.onClick", - // In this function we add listeners for any events we want to listen to, and return a - // function that removes those listeners. To have the event fire in your extension, - // call fire.async. - register: (fire) => { - function listener(event, tabId) { - // console.debug("AHT: onClick register: tabId = " + tabId); - fire.sync(tabId); - } - tracker.addOnClickedListener(listener); - return () => { - tracker.removeOnClickedListener(listener); - }; - }, - }).api(), - - async checkMailForHtmlpart(messageId, optionsDebug) { - if(optionsDebug) - console.debug("AHT: run checkMailForHtmlpart ----------------"); - let ahtMsgHdr = context.extension.messageManager.get(messageId); - - // First check MsgHdr without decrypting to prevent an additional passphrase dialog in case of PGP/MIME - let aMimeMsg = await new Promise(resolve => { - MsgHdrToMimeMessage( - ahtMsgHdr, - null, - (aMsgHdr, aMimeMsg) => resolve(aMimeMsg), - true, - { - examineEncryptedParts: false - } - ); - }) - - // multipart/encrypted enables the button for encrypted PGP/MIME messages - // in this case we don't check for HTML, because the check seems not to be possible for PGP/MIME - if (aMimeMsg.prettyString().search("multipart/encrypted") != -1) { - if(optionsDebug) - console.debug("AHT: message is PGP/MIME multipart/encrypted"); - return true; - } else { - // search for 'Body: text/html' in MIME parts, - // it seems this is only working if messages are downloaded for offline reading? - let aMimeMsg = await new Promise(resolve => { - MsgHdrToMimeMessage( - ahtMsgHdr, - null, - (aMsgHdr, aMimeMsg) => resolve(aMimeMsg), - true, - { - examineEncryptedParts: true - } - ); - }) - - if(optionsDebug) { - console.debug("AHT: Check for html part ----------------"); - console.debug("AHT: Body: text/html " + aMimeMsg.prettyString().search("Body: text/html")); - console.debug("AHT: text/html " + aMimeMsg.prettyString().search("text/html")); - console.debug("AHT: Body: plain/html " + aMimeMsg.prettyString().search("Body: plain/html")); - console.debug("AHT: plain/html " + aMimeMsg.prettyString().search("plain/html")); - console.debug("AHT: multipart/alternative " + aMimeMsg.prettyString().search("multipart/alternative")); - console.debug("AHT: multipart/signed " + aMimeMsg.prettyString().search("multipart/signed")); - console.debug("AHT: multipart/encrypted " + aMimeMsg.prettyString().search("multipart/encrypted")); - } - - // 'Body: text/html' is found, enable ahtButtons - if (aMimeMsg.prettyString().search("Body: text/html") != -1) { - if(optionsDebug) - console.debug("AHT: message contains HTML body part"); - return true; - } - // no 'Body: text/html', disable ahtButtons - else { - if(optionsDebug) - console.debug("AHT: no HTML body part"); - return false; - } - } - } - - } - }; - } - - onShutdown(isAppShutdown) { - if (isAppShutdown) { - return; // the application gets unloaded anyway - } - - ExtensionSupport.unregisterWindowListener( - tracker.windowListenerId, - ); - - for(let window of tracker.trackedWindows) { - // console.debug("AHT - onShutdown"); - let element = window.document.getElementById("remoteContentOptionAllowForMsg"); - element.removeEventListener("click", tracker.notifyOnClickedListener); - - let oncommand_original = "LoadMsgWithRemoteContent();"; - element.setAttribute("oncommand", oncommand_original); - } - - // Flush all caches - Services.obs.notifyObservers(null, "startupcache-invalidate"); - } - } - - exports.allowHtmlTemp = allowHtmlTemp; +(function (exports) { + + // Import some things we need. + var { ExtensionCommon } = ChromeUtils.importESModule("resource://gre/modules/ExtensionCommon.sys.mjs"); + var { MsgHdrToMimeMessage } = ChromeUtils.importESModule("resource:///modules/gloda/MimeMessage.sys.mjs"); + + var tracker; + + class Tracker { + constructor(extension) { + this.extension = extension; + this.windowTracker = new Set(); + this.onClickedListener = new ExtensionCommon.EventEmitter(); + + this.notifyOnClickedListener = (event) => { + let window = event.target.ownerGlobal.top; + let tabmail = window.document.getElementById("tabmail"); + // for standalone message windows "tabmail" = null + // therefore we must then use "window" to get "nativeTab" + let nativeTab = tabmail ? tabmail.currentTabInfo : window; + + let tabId = this.extension.tabManager.getWrapper(nativeTab).id; + this.onClickedListener.emit("remoteContentForMsg-clicked", tabId); + } + } + + addOnClickedListener(callback) { + this.onClickedListener.on("remoteContentForMsg-clicked", callback); + } + + removeOnClickedListener(callback) { + this.onClickedListener.off("remoteContentForMsg-clicked", callback); + } + + trackWindow(window) { + this.windowTracker.add(window); + } + + untrackWindow(window) { + this.windowTracker.delete(window); + } + + get trackedWindows() { + return Array.from(this.windowTracker); + } + + } + + class allowHtmlTemp extends ExtensionCommon.ExtensionAPI { + // Alternative to defining a constructor here in order to init the class, is + // to use the onStartup event. However, this causes the API to be instantiated + // directly after the add-on has been loaded, not when the API is first used. + constructor(extension) { + // The only parameter is extension, but it could change in the future. + // super() will add the extension as a member of this. + super(extension); + + tracker = new Tracker(this.extension); + } + + // The API implementation. + getAPI(context) { + + function getMessageWindow(tabId) { + // Get about:message from the tabId. + let { nativeTab } = context.extension.tabManager.get(tabId); + if (nativeTab instanceof Ci.nsIDOMWindow) { + return nativeTab.messageBrowser.contentWindow + } else if (nativeTab.mode && nativeTab.mode.name == "mail3PaneTab") { + return nativeTab.chromeBrowser.contentWindow.messageBrowser.contentWindow + } else if (nativeTab.mode && nativeTab.mode.name == "mailMessageTab") { + return nativeTab.chromeBrowser.contentWindow; + } + return null; + } + + return { + // Again, this key must have the same name. + allowHtmlTemp: { + + // An event. Most of this is boilerplate you don't need to worry about, just copy it. + onClick: new ExtensionCommon.EventManager({ + context, + name: "allowHtmlTemp.onClick", + // In this function we add listeners for any events we want to listen to, and return a + // function that removes those listeners. To have the event fire in your extension, + // call fire.async. + register: (fire) => { + function listener(event, tabId) { + // console.debug("AHT: onClick register: tabId = " + tabId); + fire.sync(tabId); + } + tracker.addOnClickedListener(listener); + return () => { + tracker.removeOnClickedListener(listener); + }; + }, + }).api(), + + disconnectTab(tabId) { + // console.debug("AHT - disconnectTab ", tabId); + let messageWindow = getMessageWindow(tabId); + if (!messageWindow) { + return; + } + // Remove preference observers, to decouple this message tab from the + // menu item. If they would not be decoupled, every pref change would lead + // to a message reload (with default plaintext / HTML settings). + // For a list of observed (and message reload triggering) prefs see + // the _"topics": + // https://searchfox.org/comm-central/source/mail/base/content/aboutMessage.js#341 + + // The following line decouples the original complete "_topics" list from observed prefs: + messageWindow.preferenceObserver.cleanUp(); + // The following code block would only decouple the own "topics" array from observed prefs: + /* + let topics = [ + "mailnews.display.prefer_plaintext", + "mailnews.display.html_as", + "mailnews.display.disallow_mime_handlers", + "mail.inline_attachments", + ]; + for (let i = 0; i < topics.length; i++) { + console.debug("Services.prefs.removeObserver " + topics[i] + " from messageWindow.preferenceObserver in tabId = " + tabId); + Services.prefs.removeObserver(topics[i], messageWindow.preferenceObserver); + } + */ + + tracker.trackWindow(messageWindow); + + // register the remoteContentBar click listener and remove the original oncommand + try { + let element = messageWindow.document.getElementById("remoteContentOptionAllowForMsg"); + if(!element) { + // console.debug('AHT: addEventListener: !element'); + return; + } + element.removeAttribute("oncommand"); + element.addEventListener("click", tracker.notifyOnClickedListener); + // console.debug('AHT: addEventListener: ready'); + } catch (e) { + // console.debug("AHT: addEventListener: not possible"); + } + }, + + reconnectTab(tabId) { + // console.debug("AHT - reconnectTab ", tabId); + let messageWindow = getMessageWindow(tabId); + if (!messageWindow) { + return; + } + // Connect the tab back to the prefs. + messageWindow.preferenceObserver.init(); + }, + + reloadTab(tabId) { + // console.debug("AHT - reloadTab ", tabId); + let messageWindow = getMessageWindow(tabId); + if (!messageWindow) { + return; + } + // Connect the tab back to the prefs. + try { + messageWindow.ReloadMessage(); + } catch { + // console.debug("AHT - Error in reloadTab (not a real issue on Thunderbird startup)", tabId); + } + }, + + async checkMailForHtmlpart(messageId, optionsDebug) { + if(optionsDebug) + console.debug("AHT: run checkMailForHtmlpart ----------------"); + let ahtMsgHdr = context.extension.messageManager.get(messageId); + + // First check MsgHdr without decrypting to prevent an additional passphrase dialog in case of PGP/MIME + let aMimeMsg = await new Promise(resolve => { + MsgHdrToMimeMessage( + ahtMsgHdr, + null, + (aMsgHdr, aMimeMsg) => resolve(aMimeMsg), + true, + { + examineEncryptedParts: false + } + ); + }) + + // multipart/encrypted enables the button for encrypted PGP/MIME messages + // in this case we don't check for HTML, because the check seems not to be possible for PGP/MIME + if (aMimeMsg.prettyString().search("multipart/encrypted") != -1) { + if(optionsDebug) + console.debug("AHT: message is PGP/MIME multipart/encrypted"); + return true; + } else { + // search for 'Body: text/html' in MIME parts, + // it seems this is only working if messages are downloaded for offline reading? + let aMimeMsg = await new Promise(resolve => { + MsgHdrToMimeMessage( + ahtMsgHdr, + null, + (aMsgHdr, aMimeMsg) => resolve(aMimeMsg), + true, + { + examineEncryptedParts: true + } + ); + }) + + if(optionsDebug) { + console.debug("AHT: Check for html part ----------------"); + console.debug("AHT: Body: text/html " + aMimeMsg.prettyString().search("Body: text/html")); + console.debug("AHT: text/html " + aMimeMsg.prettyString().search("text/html")); + console.debug("AHT: Body: plain/html " + aMimeMsg.prettyString().search("Body: plain/html")); + console.debug("AHT: plain/html " + aMimeMsg.prettyString().search("plain/html")); + console.debug("AHT: multipart/alternative " + aMimeMsg.prettyString().search("multipart/alternative")); + console.debug("AHT: multipart/signed " + aMimeMsg.prettyString().search("multipart/signed")); + console.debug("AHT: multipart/encrypted " + aMimeMsg.prettyString().search("multipart/encrypted")); + } + + // 'Body: text/html' is found, enable ahtButtons + if (aMimeMsg.prettyString().search("Body: text/html") != -1) { + if(optionsDebug) + console.debug("AHT: message contains HTML body part"); + return true; + } + // no 'Body: text/html', disable ahtButtons + else { + if(optionsDebug) + console.debug("AHT: no HTML body part"); + return false; + } + } + } + + } + }; + } + + onShutdown(isAppShutdown) { + if (isAppShutdown) { + return; // the application gets unloaded anyway + } + + for(let messageWindow of tracker.trackedWindows) { + if (!messageWindow) { + continue; + } + + // Connect the tab back to the prefs. + messageWindow.preferenceObserver.init(); + + // Unregister and reset manipulated elements + // console.debug("AHT - onShutdown"); + let element = messageWindow.document.getElementById("remoteContentOptionAllowForMsg"); + element.removeEventListener("click", tracker.notifyOnClickedListener); + let oncommand_original = "LoadMsgWithRemoteContent();"; + element.setAttribute("oncommand", oncommand_original); + } + + // Flush all caches + Services.obs.notifyObservers(null, "startupcache-invalidate"); + } + } + + exports.allowHtmlTemp = allowHtmlTemp; })(this); \ No newline at end of file diff -Nru allow-html-temp-8.1.5/api/allowHtmlTemp/schema.json allow-html-temp-10.0.4/api/allowHtmlTemp/schema.json --- allow-html-temp-8.1.5/api/allowHtmlTemp/schema.json 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/api/allowHtmlTemp/schema.json 2024-03-03 11:41:20.000000000 +0000 @@ -1,75 +1,108 @@ -[ - { - "namespace": "allowHtmlTemp", - "functions": [ - { - "name": "checkMailForHtmlpart", - "type": "function", - "description": "Checks selected message for a HTML MIME part.", - "async": true, - "parameters": [ - { - "name": "messageId", - "type": "integer", - "description": "MailExtension message.id" - }, - { - "name": "optionsDebug", - "type": "boolean", - "description": "MailExtension options.debug" - } - ] - }, - { - "name": "changeRemoteContentPopupmenuItem", - "type": "function", - "description": "Applies the AHT button function to the doorhanger bar button", - "async": true, - "parameters": [ - { - "name": "tabId", - "type": "integer", - "description": "MailExtension tab.id" - }, - { - "name": "optionsDebug", - "type": "boolean", - "description": "MailExtension options.debug" - } - ] - }, - { - "name": "resetRemoteContentPopupmenuItem", - "type": "function", - "description": "Reset the doorhanger bar button to its original function", - "async": true, - "parameters": [ - { - "name": "tabId", - "type": "integer", - "description": "MailExtension tab.id" - }, - { - "name": "optionsDebug", - "type": "boolean", - "description": "MailExtension options.debug" - } - ] - } - ], - "events": [ - { - "name": "onClick", - "description": "fires when a specific DOM element is clicked", - "type": "function", - "parameters": [ - { - "name": "tabId", - "type": "integer", - "description": "MailExtension tab.id" - } - ] - } - ] - } +[ + { + "namespace": "allowHtmlTemp", + "functions": [ + { + "name": "checkMailForHtmlpart", + "type": "function", + "description": "Checks selected message for a HTML MIME part.", + "async": true, + "parameters": [ + { + "name": "messageId", + "type": "integer", + "description": "MailExtension message.id" + }, + { + "name": "optionsDebug", + "type": "boolean", + "description": "MailExtension options.debug" + } + ] + }, + { + "name": "changeRemoteContentPopupmenuItem", + "type": "function", + "description": "Applies the AHT button function to the doorhanger bar button", + "async": true, + "parameters": [ + { + "name": "tabId", + "type": "integer", + "description": "MailExtension tab.id" + }, + { + "name": "optionsDebug", + "type": "boolean", + "description": "MailExtension options.debug" + } + ] + }, + { + "name": "resetRemoteContentPopupmenuItem", + "type": "function", + "description": "Reset the doorhanger bar button to its original function", + "async": true, + "parameters": [ + { + "name": "tabId", + "type": "integer", + "description": "MailExtension tab.id" + }, + { + "name": "optionsDebug", + "type": "boolean", + "description": "MailExtension options.debug" + } + ] + }, + { + "name": "reloadTab", + "type": "function", + "async": true, + "parameters": [ + { + "name": "tabId", + "type": "integer" + } + ] + }, + { + "name": "disconnectTab", + "type": "function", + "async": true, + "parameters": [ + { + "name": "tabId", + "type": "integer" + } + ] + }, + { + "name": "reconnectTab", + "type": "function", + "async": true, + "parameters": [ + { + "name": "tabId", + "type": "integer" + } + ] + } + ], + "events": [ + { + "name": "onClick", + "description": "fires when a specific DOM element is clicked", + "type": "function", + "parameters": [ + { + "name": "tabId", + "type": "integer", + "description": "MailExtension tab.id" + } + ] + } + ] + } ] \ No newline at end of file diff -Nru allow-html-temp-8.1.5/api/messageContentPolicy/implementation.js allow-html-temp-10.0.4/api/messageContentPolicy/implementation.js --- allow-html-temp-8.1.5/api/messageContentPolicy/implementation.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/api/messageContentPolicy/implementation.js 2024-06-06 12:35:04.000000000 +0000 @@ -1,340 +1,273 @@ -var { - Services -} = ChromeUtils.import("resource://gre/modules/Services.jsm"); -var { - ExtensionCommon -} = ChromeUtils.import("resource://gre/modules/ExtensionCommon.jsm"); - -var messageContentPolicy = class extends ExtensionCommon.ExtensionAPI { - getAPI(context) { - return { - messageContentPolicy: { - async getCurrent() { - return new Promise(resolve => { - - /* currentPolicy should resolve as an object - currentPolicy.msgBodyAs = plaintext || sanitized || original || allBodyParts - currentPolicy.showAllBodyPartsMenuitem = true || false - currentPolicy.disableRemoteContent = true || false - currentPolicy.attachmentsInline = true || false - if needed, this could later be extended by other related values - */ - - let currentPolicy = {}; - - let prefer_plaintext = Services.prefs.getBoolPref("mailnews.display.prefer_plaintext"); - let html_as = Services.prefs.getIntPref("mailnews.display.html_as"); - let disallow_classes = Services.prefs.getIntPref("mailnews.display.disallow_mime_handlers"); - - if ((prefer_plaintext != true) && (html_as == 0) && (disallow_classes == 0)) { - currentPolicy.msgBodyAs = "original"; - } else if ((prefer_plaintext != true) && (html_as == 3) && (disallow_classes > 0)) { - currentPolicy.msgBodyAs = "sanitized"; - } else if ((prefer_plaintext == true) && (html_as == 1) && (disallow_classes > 0)) { - currentPolicy.msgBodyAs = "plaintext"; - } else if ((prefer_plaintext != true) && (html_as == 4) && (disallow_classes == 0)) { - currentPolicy.msgBodyAs = "allBodyParts"; - } - - currentPolicy.showAllBodyPartsMenuitem = Services.prefs.getBoolPref("mailnews.display.show_all_body_parts_menu"); - currentPolicy.disableRemoteContent = Services.prefs.getBoolPref("mailnews.message_display.disable_remote_image"); - currentPolicy.attachmentsInline = Services.prefs.getBoolPref("mail.inline_attachments"); - - resolve(currentPolicy); - - }); - }, - - async update(windowId, updateProperties, doNotReloadMsg) { - return new Promise(resolve => { - - /* updateProperties must be an object with the following possible properties - updateProperties.msgBodyAs = plaintext || sanitized || original || allBodyParts - updateProperties.showAllBodyPartsMenuitem = true || false - updateProperties.disableRemoteContent = true || false - updateProperties.attachmentsInline = true || false - if needed, this could later be extended by other related values - - doNotReloadMsg is an optional boolean parameter - if doNotReloadMsg is false or undefined, the message will be reloaded after prefs update (default behaviour) - if doNotReloadMsg is true, than the message must not be reloaded, after prefs update (this is necessary for the "Allow HTML Temp" addon) - */ - - /* var gDisallow_classes_no_html is provided as a global var by mailWindowOverlay.js - See comment in: https://searchfox.org/comm-central/source/mail/base/content/mailWindowOverlay.js#69 - */ - - // console.debug("AHT: updateProperties = ", updateProperties); - - let window = context.extension.windowManager.get(windowId).window; - let gDisallow_classes_no_html = window.gDisallow_classes_no_html; - // console.debug("AHT: gDisallow_classes_no_html = ", gDisallow_classes_no_html); - - // Fallback to default value = 1, if we don't got the global var - if (!gDisallow_classes_no_html) { - gDisallow_classes_no_html = 1; - } - - // Update the prefs for HTML mode (Menu View -> Message Body As) - switch (updateProperties.msgBodyAs) { - case "original": - Services.prefs.setBoolPref("mailnews.display.prefer_plaintext", false); - Services.prefs.setIntPref("mailnews.display.html_as", 0); - Services.prefs.setIntPref("mailnews.display.disallow_mime_handlers", 0); - break; - case "sanitized": - Services.prefs.setBoolPref("mailnews.display.prefer_plaintext", false); - Services.prefs.setIntPref("mailnews.display.html_as", 3); - Services.prefs.setIntPref("mailnews.display.disallow_mime_handlers", - gDisallow_classes_no_html); - break; - case "plaintext": - Services.prefs.setBoolPref("mailnews.display.prefer_plaintext", true); - Services.prefs.setIntPref("mailnews.display.html_as", 1); - Services.prefs.setIntPref("mailnews.display.disallow_mime_handlers", - gDisallow_classes_no_html); - break; - case "allBodyParts": - Services.prefs.setBoolPref("mailnews.display.prefer_plaintext", false); - Services.prefs.setIntPref("mailnews.display.html_as", 4); - Services.prefs.setIntPref("mailnews.display.disallow_mime_handlers", 0); - break; - default: - // console.debug("AHT: updateProperties.msgBodyAs is undefined or has an invalid value"); - } - - // Update the pref for All Body Parts menu item (by default hidden 4th option in Menu View -> Message Body As) - if (updateProperties.showAllBodyPartsMenuitem === true) { - Services.prefs.setBoolPref("mailnews.display.show_all_body_parts_menu", true); - } else if (updateProperties.showAllBodyPartsMenuitem === false) { - Services.prefs.setBoolPref("mailnews.display.show_all_body_parts_menu", false); - } else { - // console.debug("AHT: updateProperties.showAllBodyPartsMenuitem is undefined or has an invalid value"); - } - - // Update the pref for remote content (Preferences -> Privacy & Security -> Allow remote content in messages) - if (updateProperties.disableRemoteContent === true) { - Services.prefs.setBoolPref("mailnews.message_display.disable_remote_image", true); - } else if (updateProperties.disableRemoteContent === false) { - Services.prefs.setBoolPref("mailnews.message_display.disable_remote_image", false); - } else { - // console.debug("AHT: updateProperties.remoteContent is undefined or has an invalid value"); - } - - // Update the pref for inline attachments (Menu View -> Display Attachments Inline) - if (updateProperties.attachmentsInline === true) { - Services.prefs.setBoolPref("mail.inline_attachments", true); - } else if (updateProperties.attachmentsInline === false) { - Services.prefs.setBoolPref("mail.inline_attachments", false); - } else { - // console.debug("AHT: updateProperties.attachmentsInline is undefined or has an invalid value"); - } - - if (doNotReloadMsg) { - // console.debug("AHT: doNotReloadMsg: ", doNotReloadMsg); - resolve(true); - return; - } - - // reload message only, if doNotReloadMsg = false or undefined - - /* ReloadMessage() is provided by: ************************************************************ - https://searchfox.org/comm-central/source/mail/base/content/msgMail3PaneWindow.js#1909 - - function ReloadMessage() { - if (!gFolderDisplay.selectedMessage) { - return; - } - - let view = gFolderDisplay.view.dbView; - if (view) { - view.reloadMessage(); - } - } - - https://searchfox.org/comm-central/source/mail/base/content/messageWindow.js#949 - - function ReloadMessage() { - // If the current message was loaded from a file or attachment, so the dbView - // can't handle reloading it. Let's do it ourselves, instead. - if (window.arguments[0] instanceof Ci.nsIURI) { - gMessageDisplay.displayExternalMessage(window.arguments[0].spec); - } else { - gFolderDisplay.view.dbView.reloadMessage(); - } - } - ******************************************************************************************** */ - - // console.debug("AHT: doNotReloadMsg: ", doNotReloadMsg); - window.ReloadMessage(); - resolve(true); - - }); - }, - - onChanged: new ExtensionCommon.EventManager({ - context, - name: "messageContentPolicy.onChanged", - register(fire, changedProperty) { - - const prefsForAllProperties = [ - "mailnews.display.prefer_plaintext", - "mailnews.display.html_as", - "mailnews.display.disallow_mime_handlers", - "mailnews.display.show_all_body_parts_menu", - "mailnews.message_display.disable_remote_image", - "mail.inline_attachments" - ]; - const prefsForMsgBodyAs = [ - "mailnews.display.prefer_plaintext", - "mailnews.display.html_as", - "mailnews.display.disallow_mime_handlers", - ]; - - let observer = {}; - - switch (changedProperty) { - - case "msgBodyAs": - observer = { - observe(subject, topic, data) { - let callbackData = {}; - if (topic == "nsPref:changed" && (prefsForMsgBodyAs.includes(data))) { - let prefer_plaintext = Services.prefs.getBoolPref("mailnews.display.prefer_plaintext"); - let html_as = Services.prefs.getIntPref("mailnews.display.html_as"); - let disallow_classes = Services.prefs.getIntPref("mailnews.display.disallow_mime_handlers"); - if ((prefer_plaintext != true) && (html_as == 0) && (disallow_classes == 0)) { - callbackData.msgBodyAs = "original"; - } else if ((prefer_plaintext != true) && (html_as == 3) && (disallow_classes > 0)) { - callbackData.msgBodyAs = "sanitized"; - } else if ((prefer_plaintext == true) && (html_as == 1) && (disallow_classes > 0)) { - callbackData.msgBodyAs = "plaintext"; - } else if ((prefer_plaintext != true) && (html_as == 4) && (disallow_classes == 0)) { - callbackData.msgBodyAs = "allBodyParts"; - } - // Only fire, if not null - if (callbackData.msgBodyAs != null) { - fire.async(callbackData.msgBodyAs); - } - } - }, - }; - Services.prefs.addObserver(null, observer); - return () => { - Services.prefs.removeObserver(null, observer); - }; - break; - - case "showAllBodyPartsMenuitem": - observer = { - observe(subject, topic, data) { - let callbackData = {}; - if (topic == "nsPref:changed" && (data == "mailnews.display.show_all_body_parts_menu")) { - callbackData.showAllBodyPartsMenuitem = Services.prefs.getBoolPref("mailnews.display.show_all_body_parts_menu"); - // Only fire, if not null - if (callbackData.showAllBodyPartsMenuitem != null) { - fire.async(callbackData.showAllBodyPartsMenuitem); - } - } - }, - }; - Services.prefs.addObserver(null, observer); - return () => { - Services.prefs.removeObserver(null, observer); - }; - break; - - case "disableRemoteContent": - observer = { - observe(subject, topic, data) { - let callbackData = {}; - if (topic == "nsPref:changed" && (data == "mailnews.message_display.disable_remote_image")) { - callbackData.disableRemoteContent = Services.prefs.getBoolPref("mailnews.message_display.disable_remote_image"); - // Only fire, if not null - if (callbackData.disableRemoteContent != null) { - fire.async(callbackData.disableRemoteContent); - } - } - }, - }; - Services.prefs.addObserver(null, observer); - return () => { - Services.prefs.removeObserver(null, observer); - }; - break; - - case "attachmentsInline": - observer = { - observe(subject, topic, data) { - let callbackData = {}; - if (topic == "nsPref:changed" && (data == "mail.inline_attachments")) { - callbackData.attachmentsInline = Services.prefs.getBoolPref("mail.inline_attachments"); - // Only fire, if not null - if (callbackData.attachmentsInline != null) { - fire.async(callbackData.attachmentsInline); - } - } - }, - }; - Services.prefs.addObserver(null, observer); - return () => { - Services.prefs.removeObserver(null, observer); - }; - break; - - case null: - observer = { - observe(subject, topic, data) { - let callbackData = {}; - if (topic == "nsPref:changed" && (prefsForAllProperties.includes(data))) { - if (prefsForMsgBodyAs.includes(data)) { - let prefer_plaintext = Services.prefs.getBoolPref("mailnews.display.prefer_plaintext"); - let html_as = Services.prefs.getIntPref("mailnews.display.html_as"); - let disallow_classes = Services.prefs.getIntPref("mailnews.display.disallow_mime_handlers"); - if ((prefer_plaintext != true) && (html_as == 0) && (disallow_classes == 0)) { - callbackData.msgBodyAs = "original"; - } else if ((prefer_plaintext != true) && (html_as == 3) && (disallow_classes > 0)) { - callbackData.msgBodyAs = "sanitized"; - } else if ((prefer_plaintext == true) && (html_as == 1) && (disallow_classes > 0)) { - callbackData.msgBodyAs = "plaintext"; - } else if ((prefer_plaintext != true) && (html_as == 4) && (disallow_classes == 0)) { - callbackData.msgBodyAs = "allBodyParts"; - } - } - if (data == "mailnews.display.show_all_body_parts_menu") { - callbackData.showAllBodyPartsMenuitem = Services.prefs.getBoolPref( - "mailnews.display.show_all_body_parts_menu"); - } - if (data == "mailnews.message_display.disable_remote_image") { - callbackData.disableRemoteContent = Services.prefs.getBoolPref( - "mailnews.message_display.disable_remote_image"); - } - if (data == "mail.inline_attachments") { - callbackData.attachmentsInline = Services.prefs.getBoolPref("mail.inline_attachments"); - } - // Fire only, if _not_ all properties are null - if (!((callbackData.msgBodyAs == null) && (callbackData.showAllBodyPartsMenuitem == null) && (callbackData.disableRemoteContent == null) && (callbackData.attachmentsInline == null))) { - // Fire and return the object as callback - fire.async(callbackData); - } - } - }, - }; - Services.prefs.addObserver(null, observer); - return () => { - Services.prefs.removeObserver(null, observer); - }; - break; - - default: - console.error("messageContentPolicy: Invalid value for changedProperty"); - - } - - }, - }).api(), - - } - }; - } -}; \ No newline at end of file +var messageContentPolicy = class extends ExtensionCommon.ExtensionAPI { + getAPI(context) { + return { + messageContentPolicy: { + async getCurrent() { + /* currentPolicy should resolve as an object + currentPolicy.msgBodyAs = plaintext || sanitized || original || allBodyParts + currentPolicy.showAllBodyPartsMenuitem = true || false + currentPolicy.disableRemoteContent = true || false + currentPolicy.attachmentsInline = true || false + if needed, this could later be extended by other related values + */ + + let currentPolicy = {}; + + let prefer_plaintext = Services.prefs.getBoolPref("mailnews.display.prefer_plaintext"); + let html_as = Services.prefs.getIntPref("mailnews.display.html_as"); + let disallow_classes = Services.prefs.getIntPref("mailnews.display.disallow_mime_handlers"); + + if ((prefer_plaintext != true) && (html_as == 0) && (disallow_classes == 0)) { + currentPolicy.msgBodyAs = "original"; + } else if ((prefer_plaintext != true) && (html_as == 3) && (disallow_classes > 0)) { + currentPolicy.msgBodyAs = "sanitized"; + } else if ((prefer_plaintext == true) && (html_as == 1) && (disallow_classes > 0)) { + currentPolicy.msgBodyAs = "plaintext"; + } else if ((prefer_plaintext != true) && (html_as == 4) && (disallow_classes == 0)) { + currentPolicy.msgBodyAs = "allBodyParts"; + } + + currentPolicy.showAllBodyPartsMenuitem = Services.prefs.getBoolPref("mailnews.display.show_all_body_parts_menu"); + currentPolicy.disableRemoteContent = Services.prefs.getBoolPref("mailnews.message_display.disable_remote_image"); + currentPolicy.attachmentsInline = Services.prefs.getBoolPref("mail.inline_attachments"); + + return currentPolicy; + }, + + async update(updateProperties) { + /* updateProperties must be an object with the following possible properties + updateProperties.msgBodyAs = plaintext || sanitized || original || allBodyParts + updateProperties.showAllBodyPartsMenuitem = true || false + updateProperties.disableRemoteContent = true || false + updateProperties.attachmentsInline = true || false + if needed, this could later be extended by other related values + + */ + + let gDisallow_classes_no_html = 1; + let disallow_classes = Services.prefs.getIntPref("mailnews.display.disallow_mime_handlers"); + if (disallow_classes > 0) { + gDisallow_classes_no_html = disallow_classes; + } + + // Update the prefs for HTML mode (Menu View -> Message Body As) + switch (updateProperties.msgBodyAs) { + case "original": + Services.prefs.setBoolPref("mailnews.display.prefer_plaintext", false); + Services.prefs.setIntPref("mailnews.display.html_as", 0); + Services.prefs.setIntPref("mailnews.display.disallow_mime_handlers", 0); + break; + case "sanitized": + Services.prefs.setBoolPref("mailnews.display.prefer_plaintext", false); + Services.prefs.setIntPref("mailnews.display.html_as", 3); + Services.prefs.setIntPref("mailnews.display.disallow_mime_handlers", + gDisallow_classes_no_html); + break; + case "plaintext": + Services.prefs.setBoolPref("mailnews.display.prefer_plaintext", true); + Services.prefs.setIntPref("mailnews.display.html_as", 1); + Services.prefs.setIntPref("mailnews.display.disallow_mime_handlers", + gDisallow_classes_no_html); + break; + case "allBodyParts": + Services.prefs.setBoolPref("mailnews.display.prefer_plaintext", false); + Services.prefs.setIntPref("mailnews.display.html_as", 4); + Services.prefs.setIntPref("mailnews.display.disallow_mime_handlers", 0); + break; + default: + // console.debug("AHT: updateProperties.msgBodyAs is undefined or has an invalid value"); + } + + // Update the pref for All Body Parts menu item (by default hidden 4th option in Menu View -> Message Body As) + if (updateProperties.showAllBodyPartsMenuitem === true) { + Services.prefs.setBoolPref("mailnews.display.show_all_body_parts_menu", true); + } else if (updateProperties.showAllBodyPartsMenuitem === false) { + Services.prefs.setBoolPref("mailnews.display.show_all_body_parts_menu", false); + } else { + // console.debug("AHT: updateProperties.showAllBodyPartsMenuitem is undefined or has an invalid value"); + } + + // Update the pref for remote content (Preferences -> Privacy & Security -> Allow remote content in messages) + if (updateProperties.disableRemoteContent === true) { + Services.prefs.setBoolPref("mailnews.message_display.disable_remote_image", true); + } else if (updateProperties.disableRemoteContent === false) { + Services.prefs.setBoolPref("mailnews.message_display.disable_remote_image", false); + } else { + // console.debug("AHT: updateProperties.remoteContent is undefined or has an invalid value"); + } + + // Update the pref for inline attachments (Menu View -> Display Attachments Inline) + if (updateProperties.attachmentsInline === true) { + Services.prefs.setBoolPref("mail.inline_attachments", true); + } else if (updateProperties.attachmentsInline === false) { + Services.prefs.setBoolPref("mail.inline_attachments", false); + } else { + // console.debug("AHT: updateProperties.attachmentsInline is undefined or has an invalid value"); + } + }, + + onChanged: new ExtensionCommon.EventManager({ + context, + name: "messageContentPolicy.onChanged", + register(fire, changedProperty) { + + const prefsForAllProperties = [ + "mailnews.display.prefer_plaintext", + "mailnews.display.html_as", + "mailnews.display.disallow_mime_handlers", + "mailnews.display.show_all_body_parts_menu", + "mailnews.message_display.disable_remote_image", + "mail.inline_attachments" + ]; + const prefsForMsgBodyAs = [ + "mailnews.display.prefer_plaintext", + "mailnews.display.html_as", + "mailnews.display.disallow_mime_handlers", + ]; + + let observer = {}; + + switch (changedProperty) { + + case "msgBodyAs": + observer = { + observe(subject, topic, data) { + let callbackData = {}; + if (topic == "nsPref:changed" && (prefsForMsgBodyAs.includes(data))) { + let prefer_plaintext = Services.prefs.getBoolPref("mailnews.display.prefer_plaintext"); + let html_as = Services.prefs.getIntPref("mailnews.display.html_as"); + let disallow_classes = Services.prefs.getIntPref("mailnews.display.disallow_mime_handlers"); + if ((prefer_plaintext != true) && (html_as == 0) && (disallow_classes == 0)) { + callbackData.msgBodyAs = "original"; + } else if ((prefer_plaintext != true) && (html_as == 3) && (disallow_classes > 0)) { + callbackData.msgBodyAs = "sanitized"; + } else if ((prefer_plaintext == true) && (html_as == 1) && (disallow_classes > 0)) { + callbackData.msgBodyAs = "plaintext"; + } else if ((prefer_plaintext != true) && (html_as == 4) && (disallow_classes == 0)) { + callbackData.msgBodyAs = "allBodyParts"; + } + // Only fire, if not null + if (callbackData.msgBodyAs != null) { + fire.async(callbackData.msgBodyAs); + } + } + }, + }; + Services.prefs.addObserver(null, observer); + return () => { + Services.prefs.removeObserver(null, observer); + }; + break; + + case "showAllBodyPartsMenuitem": + observer = { + observe(subject, topic, data) { + let callbackData = {}; + if (topic == "nsPref:changed" && (data == "mailnews.display.show_all_body_parts_menu")) { + callbackData.showAllBodyPartsMenuitem = Services.prefs.getBoolPref("mailnews.display.show_all_body_parts_menu"); + // Only fire, if not null + if (callbackData.showAllBodyPartsMenuitem != null) { + fire.async(callbackData.showAllBodyPartsMenuitem); + } + } + }, + }; + Services.prefs.addObserver(null, observer); + return () => { + Services.prefs.removeObserver(null, observer); + }; + break; + + case "disableRemoteContent": + observer = { + observe(subject, topic, data) { + let callbackData = {}; + if (topic == "nsPref:changed" && (data == "mailnews.message_display.disable_remote_image")) { + callbackData.disableRemoteContent = Services.prefs.getBoolPref("mailnews.message_display.disable_remote_image"); + // Only fire, if not null + if (callbackData.disableRemoteContent != null) { + fire.async(callbackData.disableRemoteContent); + } + } + }, + }; + Services.prefs.addObserver(null, observer); + return () => { + Services.prefs.removeObserver(null, observer); + }; + break; + + case "attachmentsInline": + observer = { + observe(subject, topic, data) { + let callbackData = {}; + if (topic == "nsPref:changed" && (data == "mail.inline_attachments")) { + callbackData.attachmentsInline = Services.prefs.getBoolPref("mail.inline_attachments"); + // Only fire, if not null + if (callbackData.attachmentsInline != null) { + fire.async(callbackData.attachmentsInline); + } + } + }, + }; + Services.prefs.addObserver(null, observer); + return () => { + Services.prefs.removeObserver(null, observer); + }; + break; + + case null: + observer = { + observe(subject, topic, data) { + let callbackData = {}; + if (topic == "nsPref:changed" && (prefsForAllProperties.includes(data))) { + if (prefsForMsgBodyAs.includes(data)) { + let prefer_plaintext = Services.prefs.getBoolPref("mailnews.display.prefer_plaintext"); + let html_as = Services.prefs.getIntPref("mailnews.display.html_as"); + let disallow_classes = Services.prefs.getIntPref("mailnews.display.disallow_mime_handlers"); + if ((prefer_plaintext != true) && (html_as == 0) && (disallow_classes == 0)) { + callbackData.msgBodyAs = "original"; + } else if ((prefer_plaintext != true) && (html_as == 3) && (disallow_classes > 0)) { + callbackData.msgBodyAs = "sanitized"; + } else if ((prefer_plaintext == true) && (html_as == 1) && (disallow_classes > 0)) { + callbackData.msgBodyAs = "plaintext"; + } else if ((prefer_plaintext != true) && (html_as == 4) && (disallow_classes == 0)) { + callbackData.msgBodyAs = "allBodyParts"; + } + } + if (data == "mailnews.display.show_all_body_parts_menu") { + callbackData.showAllBodyPartsMenuitem = Services.prefs.getBoolPref( + "mailnews.display.show_all_body_parts_menu"); + } + if (data == "mailnews.message_display.disable_remote_image") { + callbackData.disableRemoteContent = Services.prefs.getBoolPref( + "mailnews.message_display.disable_remote_image"); + } + if (data == "mail.inline_attachments") { + callbackData.attachmentsInline = Services.prefs.getBoolPref("mail.inline_attachments"); + } + // Fire only, if _not_ all properties are null + if (!((callbackData.msgBodyAs == null) && (callbackData.showAllBodyPartsMenuitem == null) && (callbackData.disableRemoteContent == null) && (callbackData.attachmentsInline == null))) { + // Fire and return the object as callback + fire.async(callbackData); + } + } + }, + }; + Services.prefs.addObserver(null, observer); + return () => { + Services.prefs.removeObserver(null, observer); + }; + break; + + default: + console.error("messageContentPolicy: Invalid value for changedProperty"); + + } + + }, + }).api(), + } + }; + } +}; diff -Nru allow-html-temp-8.1.5/api/messageContentPolicy/schema.json allow-html-temp-10.0.4/api/messageContentPolicy/schema.json --- allow-html-temp-8.1.5/api/messageContentPolicy/schema.json 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/api/messageContentPolicy/schema.json 2024-03-03 11:41:20.000000000 +0000 @@ -1,82 +1,71 @@ -[ - { - "namespace": "messageContentPolicy", - "functions": [ - { - "name": "getCurrent", - "description": "Resolves with the object currentPolicy, including the properties msgBodyAs, remoteContent, attachmentsInline", - "type": "function", - "async": true, - "parameters": [] - }, - { - "name": "update", - "description": "Updates the related application settings by the given updateProperties object, and than reloads the displayed message, if the optional parameter doNotReloadMsg is not true.", - "type": "function", - "async": true, - "parameters": [ - { - "name": "windowId", - "type": "integer", - "description": "This windowId is used to get the window in API, to use its global vars and functions." - }, - { - "name": "updateProperties", - "type": "object", - "description": "Object with the possible properties msgBodyAs, disableRemoteContent, attachmentsInline. Given properties will be updated.", - "properties": { - "msgBodyAs": { - "type": "string", - "optional": true, - "description": "This message Body mode will be set. Possible values are: plaintext || sanitized || original || allBodyParts" - }, - "showAllBodyPartsMenuitem": { - "type": "boolean", - "optional": true, - "description": "If value is true, the by default hidden menuitem will be displayed." - }, - "disableRemoteContent": { - "type": "boolean", - "optional": true, - "description": "If value is true, remote content will be disallowed and _not_ loaded in displayed messages." - }, - "attachmentsInline": { - "type": "boolean", - "optional": true, - "description": "If value is true, attached images will be displayed inline." - } - } - }, - { - "name": "doNotReloadMsg", - "type": "boolean", - "optional": true, - "description": "An optional parameter, to suppress message reload after the properties update, if the value = true." - } - ] - } - ], - "events": [ - { - "name": "onChanged", - "type": "function", - "description": "Listens for changes in supported API properties.", - "parameters": [ - { - "name": "newValue", - "type": "any", - "description": "The new value of the property." - } - ], - "extraParameters": [ - { - "name": "changedProperty", - "type": "string", - "optional": true, - "description": "The propertiy to listen to." - } - ] - } - ] - } -] \ No newline at end of file +[ + { + "namespace": "messageContentPolicy", + "functions": [ + { + "name": "getCurrent", + "description": "Resolves with the object currentPolicy, including the properties msgBodyAs, remoteContent, attachmentsInline", + "type": "function", + "async": true, + "parameters": [] + }, + { + "name": "update", + "description": "Updates the related application settings by the given updateProperties object, and than reloads the displayed message, if the optional parameter doNotReloadMsg is not true.", + "type": "function", + "async": true, + "parameters": [ + { + "name": "updateProperties", + "type": "object", + "description": "Object with the possible properties msgBodyAs, disableRemoteContent, attachmentsInline. Given properties will be updated.", + "properties": { + "msgBodyAs": { + "type": "string", + "optional": true, + "description": "This message Body mode will be set. Possible values are: plaintext || sanitized || original || allBodyParts" + }, + "showAllBodyPartsMenuitem": { + "type": "boolean", + "optional": true, + "description": "If value is true, the by default hidden menuitem will be displayed." + }, + "disableRemoteContent": { + "type": "boolean", + "optional": true, + "description": "If value is true, remote content will be disallowed and _not_ loaded in displayed messages." + }, + "attachmentsInline": { + "type": "boolean", + "optional": true, + "description": "If value is true, attached images will be displayed inline." + } + } + } + ] + } + ], + "events": [ + { + "name": "onChanged", + "type": "function", + "description": "Listens for changes in supported API properties.", + "parameters": [ + { + "name": "newValue", + "type": "any", + "description": "The new value of the property." + } + ], + "extraParameters": [ + { + "name": "changedProperty", + "type": "string", + "optional": true, + "description": "The propertiy to listen to." + } + ] + } + ] + } +] diff -Nru allow-html-temp-8.1.5/api/remoteContent/implementation.js allow-html-temp-10.0.4/api/remoteContent/implementation.js --- allow-html-temp-8.1.5/api/remoteContent/implementation.js 1970-01-01 00:00:00.000000000 +0000 +++ allow-html-temp-10.0.4/api/remoteContent/implementation.js 2024-06-06 12:32:12.000000000 +0000 @@ -0,0 +1,82 @@ +/* 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 http://mozilla.org/MPL/2.0/. + * + * This API is based on Jonathan Kamens Remote Content API in his + * "Remote Content by Folder" Thunderbird extension provided at + * https://github.com/Extended-Thunder/remote-content-by-folder +*/ + +var { ExtensionParent } = ChromeUtils.importESModule( + "resource://gre/modules/ExtensionParent.sys.mjs" +); +var { ExtensionSupport } = ChromeUtils.importESModule( + "resource:///modules/ExtensionSupport.sys.mjs" +); + +// From nsMsgContentPolicy.cpp +const kNoRemoteContentPolicy = 0; +const kBlockRemoteContent = 1; +const kAllowRemoteContent = 2; + +const contentPolicyProperty = "remoteContentPolicy"; +const policyMap = [ + { + id: kNoRemoteContentPolicy, + name: "None", + }, + { + id: kBlockRemoteContent, + name: "Block", + }, + { + id: kAllowRemoteContent, + name: "Allow", + }, +]; + +function getMessageWindow(nativeTab) { + if (nativeTab instanceof Ci.nsIDOMWindow) { + return nativeTab.messageBrowser.contentWindow; + } else if (nativeTab.mode && nativeTab.mode.name == "mail3PaneTab") { + return nativeTab.chromeBrowser.contentWindow.messageBrowser.contentWindow; + } else if (nativeTab.mode && nativeTab.mode.name == "mailMessageTab") { + return nativeTab.chromeBrowser.contentWindow; + } + return null; +} + +var remoteContent = class extends ExtensionCommon.ExtensionAPI { + getAPI(context) { + return { + remoteContent: { + getContentPolicy: function (messageId) { + let realMessage = context.extension.messageManager.get(messageId); + let policyId = realMessage.getUint32Property(contentPolicyProperty); + let policy = policyMap.find((e) => e.id == policyId); + if (!policy) { + throw new Error(`Unknown policy id ${policyId}`); + } + return policy.name; + }, + + setContentPolicy: async function (messageId, policyName) { + let realMessage = context.extension.messageManager.get(messageId); + let newPolicy = policyMap.find((e) => e.name == policyName); + if (!newPolicy) { + throw new Error(`Unknown policy name ${policyName}`); + } + + let oldPolicyId = realMessage.getUint32Property( + contentPolicyProperty, + ); + if (newPolicy.id == oldPolicyId) { + return; + } + realMessage.setUint32Property(contentPolicyProperty, newPolicy.id); + // console.debug("AHT: setContentPolicy finished"); + }, + }, + }; + } +}; \ No newline at end of file diff -Nru allow-html-temp-8.1.5/api/remoteContent/schema.json allow-html-temp-10.0.4/api/remoteContent/schema.json --- allow-html-temp-8.1.5/api/remoteContent/schema.json 1970-01-01 00:00:00.000000000 +0000 +++ allow-html-temp-10.0.4/api/remoteContent/schema.json 2024-06-05 11:52:36.000000000 +0000 @@ -0,0 +1,35 @@ +[ + { + "namespace": "remoteContent", + "functions": [ + { + "name": "getContentPolicy", + "type": "function", + "desription": "Get the policy of a specific message", + "async": true, + "parameters": [ + { + "name": "messageId", + "type": "integer" + } + ] + }, + { + "name": "setContentPolicy", + "type": "function", + "desription": "Set the policy of a specific message", + "async": true, + "parameters": [ + { + "name": "messageId", + "type": "integer" + }, + { + "name": "policy", + "type": "string" + } + ] + } + ] + } +] \ No newline at end of file diff -Nru allow-html-temp-8.1.5/debian/changelog allow-html-temp-10.0.4/debian/changelog --- allow-html-temp-8.1.5/debian/changelog 2022-11-16 18:04:54.000000000 +0000 +++ allow-html-temp-10.0.4/debian/changelog 2024-09-18 14:39:21.000000000 +0000 @@ -1,3 +1,39 @@ +allow-html-temp (10.0.4-1~deb12u1) bookworm; urgency=medium + + * Prepared for uploading to bookworm proposed update + + -- Mechtilde Stehmann Wed, 18 Sep 2024 16:39:21 +0200 + +allow-html-temp (10.0.4-1) unstable; urgency=medium + + [ Mechtilde ] + * [9600c16] New upstream version 10.0.4 + * [6fbc1c4] Added Link to a.t.n + * [dfdd43f] Bumped year of copyright + * [f18e5c4] Bumped standard version - no changes needed + * [50fede0] Bumped to recent thunderbird esr version + * [1bf6b7b] Improved d/watch + * [c6b36d3] Fixed version number in d/control + + -- Mechtilde Stehmann Sat, 31 Aug 2024 11:39:57 +0200 + +allow-html-temp (9.0.0-2) unstable; urgency=medium + + [ Mechtilde ] + * [9461d49] Fixed d/watch + + -- Mechtilde Stehmann Wed, 15 May 2024 19:21:45 +0200 + +allow-html-temp (9.0.0-1) unstable; urgency=medium + + [ Mechtilde ] + * [f6b9b32] New upstream version 9.0.0 + * [187f994] Bumped thunderbird version to 115 and limit it to 119 + * [2662398] Bumped standard version to recent one - no changes needed + * [82471ba] Fixed max version of thunderbird + + -- Mechtilde Stehmann Sun, 03 Sep 2023 12:58:30 +0200 + allow-html-temp (8.1.5-1) unstable; urgency=medium [ Mechtilde ] diff -Nru allow-html-temp-8.1.5/debian/control allow-html-temp-10.0.4/debian/control --- allow-html-temp-8.1.5/debian/control 2022-08-07 10:46:12.000000000 +0000 +++ allow-html-temp-10.0.4/debian/control 2024-08-31 09:23:44.000000000 +0000 @@ -5,7 +5,7 @@ Uploaders: Mechtilde Stehmann Build-Depends: debhelper-compat (=13) , zip -Standards-Version: 4.6.1 +Standards-Version: 4.7.0 Rules-Requires-Root: no Vcs-Git: https://salsa.debian.org/webext-team/allow-html-temp.git Vcs-Browser: https://salsa.debian.org/webext-team/allow-html-temp @@ -14,7 +14,8 @@ Package: webext-allow-html-temp Architecture: all Depends: ${misc:Depends} - , thunderbird (>= 1:102) + , thunderbird (>= 1:128.1) + , thunderbird (<< 1:131.x) Description: View selective HTML-Mail Allows one to have HTML temporarily allowed in the currently displayed message by only one click. diff -Nru allow-html-temp-8.1.5/debian/copyright allow-html-temp-10.0.4/debian/copyright --- allow-html-temp-8.1.5/debian/copyright 2022-05-26 15:19:06.000000000 +0000 +++ allow-html-temp-10.0.4/debian/copyright 2024-08-31 08:57:58.000000000 +0000 @@ -8,7 +8,7 @@ License: MPL-2.0 Files: debian/* -Copyright: 2021-2022 Mechtilde Stehmann +Copyright: 2021-2024 Mechtilde Stehmann License: MPL-2.0 License: MPL-2.0 diff -Nru allow-html-temp-8.1.5/debian/upstream/metadata allow-html-temp-10.0.4/debian/upstream/metadata --- allow-html-temp-8.1.5/debian/upstream/metadata 2022-01-15 18:37:27.000000000 +0000 +++ allow-html-temp-10.0.4/debian/upstream/metadata 2024-08-31 08:51:22.000000000 +0000 @@ -6,3 +6,4 @@ Documentation: https://gitlab.com/ThunderbirdMailDE/allow-html-temp/-/blob/master/README.md Repository: https://gitlab.com/ThunderbirdMailDE/allow-html-temp Repository-Browse: https://gitlab.com/ThunderbirdMailDE/allow-html-temp +Reference: https://addons.thunderbird.net/en-US/thunderbird/addon/allow-html-temp/versions/ diff -Nru allow-html-temp-8.1.5/debian/watch allow-html-temp-10.0.4/debian/watch --- allow-html-temp-8.1.5/debian/watch 2022-05-24 09:06:22.000000000 +0000 +++ allow-html-temp-10.0.4/debian/watch 2024-08-31 09:16:35.000000000 +0000 @@ -3,4 +3,4 @@ repack,compression=xz,\ dversionmangle=s///,\ uversionmangle=s/-?([^\d.]+)/~$1/;tr/A-Z/a-z/ \ -https://gitlab.com/ThunderbirdMailDE/allow-html-temp/tags .*/allow-html-temp-(\d+\.\d+\.\d+)\.tar\.gz +https://addons.thunderbird.net/en-US/thunderbird/addon/allow-html-temp/versions/ (\d+\.\d+\.\d+)* diff -Nru allow-html-temp-8.1.5/icons/aht_addon_icon.svg allow-html-temp-10.0.4/icons/aht_addon_icon.svg --- allow-html-temp-8.1.5/icons/aht_addon_icon.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_addon_icon.svg 2022-05-27 15:10:56.000000000 +0000 @@ -1,11 +1,11 @@ - - - - - - - + + + + + + + diff -Nru allow-html-temp-8.1.5/icons/aht_button_supernova_color.svg allow-html-temp-10.0.4/icons/aht_button_supernova_color.svg --- allow-html-temp-8.1.5/icons/aht_button_supernova_color.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_button_supernova_color.svg 2022-06-15 13:50:42.000000000 +0000 @@ -1,5 +1,5 @@ - - - - - + + + + + diff -Nru allow-html-temp-8.1.5/icons/aht_button_supernova_color_plus.svg allow-html-temp-10.0.4/icons/aht_button_supernova_color_plus.svg --- allow-html-temp-8.1.5/icons/aht_button_supernova_color_plus.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_button_supernova_color_plus.svg 2022-06-15 13:53:02.000000000 +0000 @@ -1,6 +1,6 @@ - - - - - - + + + + + + diff -Nru allow-html-temp-8.1.5/icons/aht_button_supernova_plaintext.svg allow-html-temp-10.0.4/icons/aht_button_supernova_plaintext.svg --- allow-html-temp-8.1.5/icons/aht_button_supernova_plaintext.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_button_supernova_plaintext.svg 2024-08-04 21:05:30.000000000 +0000 @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff -Nru allow-html-temp-8.1.5/icons/aht_button_supernova_plaintext_lightdarkcss.svg allow-html-temp-10.0.4/icons/aht_button_supernova_plaintext_lightdarkcss.svg --- allow-html-temp-8.1.5/icons/aht_button_supernova_plaintext_lightdarkcss.svg 1970-01-01 00:00:00.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_button_supernova_plaintext_lightdarkcss.svg 2024-08-04 22:57:08.000000000 +0000 @@ -0,0 +1,17 @@ + + + + + + + + \ No newline at end of file diff -Nru allow-html-temp-8.1.5/icons/aht_button_supernova_sanitized.svg allow-html-temp-10.0.4/icons/aht_button_supernova_sanitized.svg --- allow-html-temp-8.1.5/icons/aht_button_supernova_sanitized.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_button_supernova_sanitized.svg 2022-06-15 13:12:34.000000000 +0000 @@ -1,5 +1,5 @@ - - - - + + + + \ No newline at end of file diff -Nru allow-html-temp-8.1.5/icons/aht_button_supernova_sanitized_lightdarkcss.svg allow-html-temp-10.0.4/icons/aht_button_supernova_sanitized_lightdarkcss.svg --- allow-html-temp-8.1.5/icons/aht_button_supernova_sanitized_lightdarkcss.svg 1970-01-01 00:00:00.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_button_supernova_sanitized_lightdarkcss.svg 2024-08-04 22:57:08.000000000 +0000 @@ -0,0 +1,16 @@ + + + + + + + \ No newline at end of file diff -Nru allow-html-temp-8.1.5/icons/aht_icon.svg allow-html-temp-10.0.4/icons/aht_icon.svg --- allow-html-temp-8.1.5/icons/aht_icon.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_icon.svg 2022-05-27 15:10:56.000000000 +0000 @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff -Nru allow-html-temp-8.1.5/icons/aht_statusbar_color.svg allow-html-temp-10.0.4/icons/aht_statusbar_color.svg --- allow-html-temp-8.1.5/icons/aht_statusbar_color.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_statusbar_color.svg 2022-05-27 15:10:56.000000000 +0000 @@ -1,9 +1,9 @@ - - - - - - + + + + + + diff -Nru allow-html-temp-8.1.5/icons/aht_statusbar_feed.svg allow-html-temp-10.0.4/icons/aht_statusbar_feed.svg --- allow-html-temp-8.1.5/icons/aht_statusbar_feed.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_statusbar_feed.svg 2022-05-27 15:10:56.000000000 +0000 @@ -1,5 +1,5 @@ - - - - + + + + \ No newline at end of file diff -Nru allow-html-temp-8.1.5/icons/aht_statusbar_plaintext.svg allow-html-temp-10.0.4/icons/aht_statusbar_plaintext.svg --- allow-html-temp-8.1.5/icons/aht_statusbar_plaintext.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_statusbar_plaintext.svg 2022-05-27 15:10:56.000000000 +0000 @@ -1,14 +1,14 @@ - - - - - - + + + + + + \ No newline at end of file diff -Nru allow-html-temp-8.1.5/icons/aht_statusbar_plaintext_contextcolor.svg allow-html-temp-10.0.4/icons/aht_statusbar_plaintext_contextcolor.svg --- allow-html-temp-8.1.5/icons/aht_statusbar_plaintext_contextcolor.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_statusbar_plaintext_contextcolor.svg 2022-05-27 15:10:56.000000000 +0000 @@ -1,14 +1,14 @@ - - - - - - + + + + + + \ No newline at end of file diff -Nru allow-html-temp-8.1.5/icons/aht_statusbar_plaintext_inverted.svg allow-html-temp-10.0.4/icons/aht_statusbar_plaintext_inverted.svg --- allow-html-temp-8.1.5/icons/aht_statusbar_plaintext_inverted.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_statusbar_plaintext_inverted.svg 2022-05-27 15:10:56.000000000 +0000 @@ -1,14 +1,14 @@ - - - - - - + + + + + + \ No newline at end of file diff -Nru allow-html-temp-8.1.5/icons/aht_statusbar_sanitized.svg allow-html-temp-10.0.4/icons/aht_statusbar_sanitized.svg --- allow-html-temp-8.1.5/icons/aht_statusbar_sanitized.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_statusbar_sanitized.svg 2022-05-27 15:10:56.000000000 +0000 @@ -1,6 +1,6 @@ - - - - + + + + \ No newline at end of file diff -Nru allow-html-temp-8.1.5/icons/aht_statusbar_sanitized_contextcolor.svg allow-html-temp-10.0.4/icons/aht_statusbar_sanitized_contextcolor.svg --- allow-html-temp-8.1.5/icons/aht_statusbar_sanitized_contextcolor.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_statusbar_sanitized_contextcolor.svg 2022-05-27 15:10:56.000000000 +0000 @@ -1,6 +1,6 @@ - - - - + + + + \ No newline at end of file diff -Nru allow-html-temp-8.1.5/icons/aht_statusbar_sanitized_inverted.svg allow-html-temp-10.0.4/icons/aht_statusbar_sanitized_inverted.svg --- allow-html-temp-8.1.5/icons/aht_statusbar_sanitized_inverted.svg 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/icons/aht_statusbar_sanitized_inverted.svg 2022-05-27 15:10:56.000000000 +0000 @@ -1,6 +1,6 @@ - - - - + + + + \ No newline at end of file diff -Nru allow-html-temp-8.1.5/manifest.json allow-html-temp-10.0.4/manifest.json --- allow-html-temp-8.1.5/manifest.json 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/manifest.json 2024-08-04 22:39:44.000000000 +0000 @@ -1,96 +1,91 @@ -{ - "manifest_version": 2, - "name": "__MSG_extensionName__", - "description": "__MSG_extensionDescription__", - "version": "8.1.5", - "author": "Alexander Ihrig", - "homepage_url": "https://addons.thunderbird.net/thunderbird/addon/allow-html-temp/", - "applications": { - "gecko": { - "id": "{532269cf-a10e-4396-8613-b5d9a9a516d4}", - "strict_min_version": "102.4.0", - "strict_max_version": "102.*" - } - }, - "default_locale": "en", - "icons": { - "32": "icons/aht_icon.svg" - }, - "permissions": [ - "accountsRead", - "messagesRead", - "activeTab", - "storage" - ], - "background": { - "scripts": [ - "scripts/debug.js", - "scripts/aht_functions.js", - "scripts/options_defaults.js", - "scripts/options.js", - "scripts/update_ui.js", - "scripts/background.js" - ] - }, - "options_ui": { - "browser_style": true, - "open_in_tab": false, - "page": "options/options_ui.html" - }, - "browser_action": { - "default_windows": [ - "normal", - "messageDisplay" - ], - "default_label": "__MSG_button_label__", - "default_title": "__MSG_button_tooltip__", - "theme_icons": [{ - "light": "icons/aht_button_supernova_color.svg", - "dark": "icons/aht_button_supernova_color.svg", - "size": 16 - }] - }, - "message_display_action": { - "default_label": "__MSG_button_label__", - "default_title": "__MSG_button_tooltip__", - "theme_icons": [{ - "light": "icons/aht_button_supernova_color.svg", - "dark": "icons/aht_button_supernova_color.svg", - "size": 16 - }] - }, - "commands": { - "_execute_message_display_action": { - "suggested_key": { - "default": "Ctrl+Alt+F5" - }, - "description": "Do exactly what the addon button would do, depending on its settings" - } - }, - "experiment_apis": { - "LegacyPrefs": { - "schema": "api/LegacyPrefs/schema.json", - "parent": { - "scopes": ["addon_parent"], - "paths": [["LegacyPrefs"]], - "script": "api/LegacyPrefs/implementation.js" - } - }, - "messageContentPolicy": { - "schema": "api/messageContentPolicy/schema.json", - "parent": { - "scopes": ["addon_parent"], - "paths": [["messageContentPolicy"]], - "script": "api/messageContentPolicy/implementation.js" - } - }, - "allowHtmlTemp": { - "schema": "api/allowHtmlTemp/schema.json", - "parent": { - "scopes": ["addon_parent"], - "paths": [["allowHtmlTemp"]], - "script": "api/allowHtmlTemp/implementation.js" - } - } - } -} \ No newline at end of file +{ + "manifest_version": 2, + "name": "__MSG_extensionName__", + "description": "__MSG_extensionDescription__", + "version": "10.0.4", + "author": "Alexander Ihrig", + "homepage_url": "https://addons.thunderbird.net/thunderbird/addon/allow-html-temp/", + "applications": { + "gecko": { + "id": "{532269cf-a10e-4396-8613-b5d9a9a516d4}", + "strict_min_version": "126.0", + "strict_max_version": "130.*" + } + }, + "default_locale": "en", + "icons": { + "32": "icons/aht_icon.svg" + }, + "permissions": [ + "accountsRead", + "messagesRead", + "activeTab", + "storage" + ], + "background": { + "scripts": [ + "scripts/aht_functions.js", + "scripts/debug.js", + "scripts/options_defaults.js", + "scripts/options.js", + "scripts/update_ui.js", + "scripts/background.js" + ] + }, + "options_ui": { + "browser_style": true, + "open_in_tab": false, + "page": "options/options_ui.html" + }, + "message_display_action": { + "default_label": "__MSG_button_label__", + "default_title": "__MSG_button_tooltip__", + "theme_icons": [{ + "light": "icons/aht_button_supernova_color.svg", + "dark": "icons/aht_button_supernova_color.svg", + "size": 16 + }] + }, + "commands": { + "_execute_message_display_action": { + "suggested_key": { + "default": "Ctrl+Alt+F5" + }, + "description": "Do exactly what the addon button would do, depending on its settings" + } + }, + "experiment_apis": { + "LegacyPrefs": { + "schema": "api/LegacyPrefs/schema.json", + "parent": { + "scopes": ["addon_parent"], + "paths": [["LegacyPrefs"]], + "script": "api/LegacyPrefs/implementation.js" + } + }, + "messageContentPolicy": { + "schema": "api/messageContentPolicy/schema.json", + "parent": { + "scopes": ["addon_parent"], + "paths": [["messageContentPolicy"]], + "script": "api/messageContentPolicy/implementation.js" + } + }, + "allowHtmlTemp": { + "schema": "api/allowHtmlTemp/schema.json", + "parent": { + "scopes": ["addon_parent"], + "paths": [["allowHtmlTemp"]], + "script": "api/allowHtmlTemp/implementation.js" + } + }, + "remoteContent": { + "schema": "api/remoteContent/schema.json", + "parent": { + "scopes": ["addon_parent"], + "paths": [["remoteContent"]], + "script": "api/remoteContent/implementation.js" + } + } + } +} diff -Nru allow-html-temp-8.1.5/options/options_ui.css allow-html-temp-10.0.4/options/options_ui.css --- allow-html-temp-8.1.5/options/options_ui.css 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/options/options_ui.css 2022-05-27 15:10:56.000000000 +0000 @@ -1,173 +1,173 @@ -@namespace html "http://www.w3.org/1999/xhtml"; -@namespace xul "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - -:host, -:root { -/* --in-content-button-background-hover: rgb(204, 223, 249) !important; */ -} - -@supports not -moz-bool-pref("browser.proton.enabled") { -} /** END not Proton **/ - -/** body for Options in Tab **/ -/* -body { - padding: 28px 40px; - width: 800px; - background-color: var(--in-content-box-background); - color: var(--in-content-page-color); -} -*/ - -/** body for Options inline **/ - -body { - padding-top: 1.5em; - background-color: var(--in-content-box-background); - color: var(--in-content-page-color); -} - -/* Nicht notwendig, wenn common.css vorhanden ist */ -/* -.subcategory:not([hidden]) ~ .subcategory { - margin-top: 16px; - padding-top: 16px; - border-top: 1px solid rgba(211, 211, 211, 0.5); -} -*/ - -.flex-container { - display: flex; - flex-direction: row; -} -.flex-container > .flex-item { - flex: auto; -} -.flex-container > .raw-item { -} - -button { - min-height: 32px; -/* margin-top: 1ex; */ -/* margin-bottom: 1ex; */ - margin-left: 6px; - min-width: 7em; - text-align: center; -/* float: right; */ -} - - -input[type="text"] { -} - -input[type="checkbox"]:not(.position-null), -input[type="radio"]:not(.position-null) { - position: relative; -} -input[type="radio"]:not(.position-null) { - top: 4px; - left: 5px; -} -input[type="checkbox"]:not(.position-null) { - top: 4px; - left: 5px; -} -input[type="checkbox"].position-null { - margin-inline: 0; -} - -input[type="select"], -select { - padding-top: 0; - padding-bottom: 0; -} - -/* Nicht notwendig, wenn common.css vorhanden ist */ -/* -select, input[type="select"] { - padding-top: 5px; - padding-bottom: 5px; - min-height: 32px; -} -*/ - -/* tweak the buggy background for select options */ -/* the "option" itself doesn't work, so the whole select hover has to be tweaked */ -@media (prefers-color-scheme: dark) { - select:hover, - option:hover { - background-color: rgb(65, 95, 126) !important; - } -} -@media (prefers-color-scheme: light) { - select:hover, - option:hover { - background-color: rgba(140, 197, 255, 0.6) !important; - } -} - -.subcategory_infotext { - margin-bottom: 0.6em; -} - -@media (prefers-color-scheme: dark) { - .warning { - background: #42381F !important; - color: #FCE2A1 !important; - } - /* - .cmd_warning { - background: #4B2F36 !important; - color: #FFB3D2 !important; - } - */ -} -.warning { - background: #ffea00; - border-radius: 2px; - margin: 0.5em 0; - padding: 0.5em 1em; - font-size: 85%; -} -.cmd_warning { - background: #ff7878; - border-radius: 2px; - margin: 0.5em 0; - padding: 0.5em 1em; - font-size: 85%; -} - -.hidden { - display: none; -} - -.disabled { - opacity: 0.4; -} - -.indent { - margin-left: 30px; -} - -.indent > label:first-child { - margin-left: 6px; -} - -.center { - text-align: center; -} - -.flexbox { - display: flex; -} - -#box_defaultHtml { - width: 50%; - margin-right: 1em; - /* border-right: 1px; */ -} - -#box_buttonHtml { - width: 50%; - margin-left: 1em; -} +@namespace html "http://www.w3.org/1999/xhtml"; +@namespace xul "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; + +:host, +:root { +/* --in-content-button-background-hover: rgb(204, 223, 249) !important; */ +} + +@supports not -moz-bool-pref("browser.proton.enabled") { +} /** END not Proton **/ + +/** body for Options in Tab **/ +/* +body { + padding: 28px 40px; + width: 800px; + background-color: var(--in-content-box-background); + color: var(--in-content-page-color); +} +*/ + +/** body for Options inline **/ + +body { + padding-top: 1.5em; + background-color: var(--in-content-box-background); + color: var(--in-content-page-color); +} + +/* Nicht notwendig, wenn common.css vorhanden ist */ +/* +.subcategory:not([hidden]) ~ .subcategory { + margin-top: 16px; + padding-top: 16px; + border-top: 1px solid rgba(211, 211, 211, 0.5); +} +*/ + +.flex-container { + display: flex; + flex-direction: row; +} +.flex-container > .flex-item { + flex: auto; +} +.flex-container > .raw-item { +} + +button { + min-height: 32px; +/* margin-top: 1ex; */ +/* margin-bottom: 1ex; */ + margin-left: 6px; + min-width: 7em; + text-align: center; +/* float: right; */ +} + + +input[type="text"] { +} + +input[type="checkbox"]:not(.position-null), +input[type="radio"]:not(.position-null) { + position: relative; +} +input[type="radio"]:not(.position-null) { + top: 4px; + left: 5px; +} +input[type="checkbox"]:not(.position-null) { + top: 4px; + left: 5px; +} +input[type="checkbox"].position-null { + margin-inline: 0; +} + +input[type="select"], +select { + padding-top: 0; + padding-bottom: 0; +} + +/* Nicht notwendig, wenn common.css vorhanden ist */ +/* +select, input[type="select"] { + padding-top: 5px; + padding-bottom: 5px; + min-height: 32px; +} +*/ + +/* tweak the buggy background for select options */ +/* the "option" itself doesn't work, so the whole select hover has to be tweaked */ +@media (prefers-color-scheme: dark) { + select:hover, + option:hover { + background-color: rgb(65, 95, 126) !important; + } +} +@media (prefers-color-scheme: light) { + select:hover, + option:hover { + background-color: rgba(140, 197, 255, 0.6) !important; + } +} + +.subcategory_infotext { + margin-bottom: 0.6em; +} + +@media (prefers-color-scheme: dark) { + .warning { + background: #42381F !important; + color: #FCE2A1 !important; + } + /* + .cmd_warning { + background: #4B2F36 !important; + color: #FFB3D2 !important; + } + */ +} +.warning { + background: #ffea00; + border-radius: 2px; + margin: 0.5em 0; + padding: 0.5em 1em; + font-size: 85%; +} +.cmd_warning { + background: #ff7878; + border-radius: 2px; + margin: 0.5em 0; + padding: 0.5em 1em; + font-size: 85%; +} + +.hidden { + display: none; +} + +.disabled { + opacity: 0.4; +} + +.indent { + margin-left: 30px; +} + +.indent > label:first-child { + margin-left: 6px; +} + +.center { + text-align: center; +} + +.flexbox { + display: flex; +} + +#box_defaultHtml { + width: 50%; + margin-right: 1em; + /* border-right: 1px; */ +} + +#box_buttonHtml { + width: 50%; + margin-left: 1em; +} diff -Nru allow-html-temp-8.1.5/options/options_ui.html allow-html-temp-10.0.4/options/options_ui.html --- allow-html-temp-8.1.5/options/options_ui.html 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/options/options_ui.html 2023-08-09 10:32:08.000000000 +0000 @@ -1,175 +1,175 @@ - - - - - - - - __MSG_optionPageTitle_label__ - - - - - - - - -
-

__MSG_optionHTML_label__

-
-
- __MSG_optionGeneralDescription_label__ -
- -
- __MSG_optionHTMLDescription_label__ -
- -
-
- - __MSG_optionAppHTML_label__ - -
-
- - -
-
- - -
-
- - -
- -
-
-
- - __MSG_optionButtonHTML_label__ - -
-
- - -
-
- - -
-
- - -
-
-
-
- - -
-

__MSG_optionAdditionalOptions_label__

-
-
- __MSG_optionAllwaysVersusClickDescription_label__ -
- - - __MSG_optionRemoteContent_label__ - -
-
- - - -
-
- - -
-
- - - __MSG_optionAttachments_label__ - -
-
- - - -
-
- - -
-
- -
-

__MSG_optionCommandKeyHeader_label__

-
-
- __MSG_optionCommandKeyDescription_label__ -
-
-
- - -
-
- - - -
-

__MSG_optionDebugHeader_label__

-
-
- __MSG_optionDebugDescription_label__ -
-
-
- - -
-
- -
-

__MSG_optionResetAllOptionsHeader_label__

-
-
- __MSG_optionResetAllOptionsDescription2_label__ -
-
- - -
- - - - - - - - - - - + + + + + + + + __MSG_optionPageTitle_label__ + + + + + + + + +
+

__MSG_optionHTML_label__

+
+
+ __MSG_optionGeneralDescription_label__ +
+ +
+ __MSG_optionHTMLDescription_label__ +
+ +
+
+ + __MSG_optionAppHTML_label__ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ + __MSG_optionButtonHTML_label__ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+

__MSG_optionAdditionalOptions_label__

+
+
+ __MSG_optionAllwaysVersusClickDescription_label__ +
+ + + __MSG_optionRemoteContent_label__ + +
+
+ + + +
+
+ + +
+
+ + + __MSG_optionAttachments_label__ + +
+
+ + + +
+
+ + +
+
+ +
+

__MSG_optionCommandKeyHeader_label__

+
+
+ __MSG_optionCommandKeyDescription_label__ +
+
+
+ + +
+
+ + + +
+

__MSG_optionDebugHeader_label__

+
+
+ __MSG_optionDebugDescription_label__ +
+
+
+ + +
+
+ +
+

__MSG_optionResetAllOptionsHeader_label__

+
+
+ __MSG_optionResetAllOptionsDescription2_label__ +
+
+ + +
+ + + + + + + + + + + \ No newline at end of file diff -Nru allow-html-temp-8.1.5/options/options_ui.js allow-html-temp-10.0.4/options/options_ui.js --- allow-html-temp-8.1.5/options/options_ui.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/options/options_ui.js 2022-05-27 15:10:56.000000000 +0000 @@ -1,35 +1,35 @@ -// From top of the HTML options page to bottom to be working correctly! -var parentAndChilds = []; -parentAndChilds = [ - ["appRemoteContent",["tempRemoteContent", "tempRemoteContentLabelId"]], - ["allwaysInline",["tempInline", "tempInlineLabelId"]] -]; - -// Enable or disable options UI child elements -function enableOrDisableOptionUiElements() { - parentAndChilds.forEach((parentAndChild) => { - consoleDebug("AHT: parentElement: " + parentAndChild[0]); - // Cave: In this Addon the logic is vice-versa -> when the parent is disabled, the child is enabled! - if ((!document.getElementById(parentAndChild[0]).checked) || (document.getElementById(parentAndChild[0]).getAttribute("disabled"))) { - parentAndChild[1].forEach((childElement) => { - consoleDebug("AHT: enable child: " + childElement); - if ((document.getElementById(childElement).nodeName == "INPUT") || (document.getElementById(childElement).nodeName == "SELECT")) { - document.getElementById(childElement).removeAttribute("disabled"); - } - else { - document.getElementById(childElement).classList.remove("disabled"); - } - }); - } else { - parentAndChild[1].forEach((childElement) => { - consoleDebug("AHT: disable child: " + childElement); - if ((document.getElementById(childElement).nodeName == "INPUT") || (document.getElementById(childElement).nodeName == "SELECT")) { - document.getElementById(childElement).setAttribute("disabled", "true"); - } - else { - document.getElementById(childElement).classList.add("disabled"); - } - }); - } - }); +// From top of the HTML options page to bottom to be working correctly! +var parentAndChilds = []; +parentAndChilds = [ + ["appRemoteContent",["tempRemoteContent", "tempRemoteContentLabelId"]], + ["allwaysInline",["tempInline", "tempInlineLabelId"]] +]; + +// Enable or disable options UI child elements +function enableOrDisableOptionUiElements() { + parentAndChilds.forEach((parentAndChild) => { + consoleDebug("AHT: parentElement: " + parentAndChild[0]); + // Cave: In this Addon the logic is vice-versa -> when the parent is disabled, the child is enabled! + if ((!document.getElementById(parentAndChild[0]).checked) || (document.getElementById(parentAndChild[0]).getAttribute("disabled"))) { + parentAndChild[1].forEach((childElement) => { + consoleDebug("AHT: enable child: " + childElement); + if ((document.getElementById(childElement).nodeName == "INPUT") || (document.getElementById(childElement).nodeName == "SELECT")) { + document.getElementById(childElement).removeAttribute("disabled"); + } + else { + document.getElementById(childElement).classList.remove("disabled"); + } + }); + } else { + parentAndChild[1].forEach((childElement) => { + consoleDebug("AHT: disable child: " + childElement); + if ((document.getElementById(childElement).nodeName == "INPUT") || (document.getElementById(childElement).nodeName == "SELECT")) { + document.getElementById(childElement).setAttribute("disabled", "true"); + } + else { + document.getElementById(childElement).classList.add("disabled"); + } + }); + } + }); } \ No newline at end of file diff -Nru allow-html-temp-8.1.5/options/options_ui_listeners.js allow-html-temp-10.0.4/options/options_ui_listeners.js --- allow-html-temp-8.1.5/options/options_ui_listeners.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/options/options_ui_listeners.js 2024-03-03 11:41:20.000000000 +0000 @@ -1,164 +1,164 @@ -// onLoad listener to load Options and LegacyPrefs -document.addEventListener('DOMContentLoaded', async () => { - consoleDebug("AHT: DOMContentLoaded, restoreAllOptions() and initLegacyPrefs()"); - restoreAllOptions(); - initLegacyPrefs(); - - await messenger.messageContentPolicy.onChanged.addListener(async (newValue) => { - consoleDebug("AHT: messageContentPolicy newValue:", newValue); - await initLegacyPrefs(); - }); - - document.addEventListener("visibilitychange", async () => { - consoleDebug("AHT: DOMContent beforeunload"); - await messenger.messageContentPolicy.onChanged.removeListener(async () => { - await initLegacyPrefs(); - }); - }); -}); - -// onChange listener for all options to save the changed options -OptionsList.forEach((option) => { - consoleDebug("AHT: OptionsList.forEach(): option: " + option); - switch(option) { - case "buttonHtmlMode": - document.getElementById("buttonMode_html").addEventListener("change", (e) => { - consoleDebug("AHT: OptionsList.forEach(): Option buttonHtmlMode changed, saveOptions()"); - saveOptions(e); - }); - document.getElementById("buttonMode_sanitized").addEventListener("change", (e) => { - consoleDebug("AHT: OptionsList.forEach(): Option buttonHtmlMode changed, saveOptions()"); - saveOptions(e); - }); - document.getElementById("buttonMode_plaintext").addEventListener("change", (e) => { - consoleDebug("AHT: OptionsList.forEach(): Option buttonHtmlMode changed, saveOptions()"); - saveOptions(e); - }); - break; - - case "commandKey": - document.getElementById("commandKey").addEventListener("change", async (e) => { - consoleDebug("AHT: OptionsList.forEach(): Option commandKey changed, saveOptions()"); - if(testCommandKey(document.getElementById("commandKey").value) == true) { - showCommandKeyWarning(false); - saveOptions(e); - } else { - showCommandKeyWarning(true); - saveOptions(e); - } - }); - break; - - default: - document.getElementById(option).addEventListener("change", (e) => { - consoleDebug("AHT: OptionsList.forEach(): Option " + option + " changed, saveOptions()"); - saveOptions(e); - // .then(() => { enableOrDisableOptionUiElements(); }); - }); - } -}); - -// onChange listener for all options to save the changed prefs -PrefsList.forEach((option) => { - consoleDebug("AHT: pref: " + option); - switch(option) { - case "appHtmlMode": - document.getElementById("appMode_html").addEventListener("change", (e) => { - consoleDebug("AHT: PrefsList.forEach(): Option appHtmlMode (original HTML) changed, setPrefsMsgBodyAllowHTML()"); - setPrefsMsgBodyAllowHTML(); - prefChangedWarning("warning_appHtmlMode"); - }); - document.getElementById("appMode_sanitized").addEventListener("change", (e) => { - consoleDebug("AHT: PrefsList.forEach(): Option appHtmlMode (sanitized HTML) changed, setPrefsMsgBodySanitized()"); - setPrefsMsgBodySanitized(); - prefChangedWarning("warning_appHtmlMode"); - }); - document.getElementById("appMode_plaintext").addEventListener("change", (e) => { - consoleDebug("AHT: PrefsList.forEach(): Option appHtmlMode (plaintext) changed, setPrefsMsgBodyAsPlaintext()"); - setPrefsMsgBodyAsPlaintext(); - prefChangedWarning("warning_appHtmlMode"); - }); - document.getElementById("appMode_allBodyParts").addEventListener("change", (e) => { - consoleDebug("AHT: PrefsList.forEach(): Option appHtmlMode (AllBodyParts) changed, setPrefsMsgBodyAllParts()"); - setPrefsMsgBodyAllParts(); - prefChangedWarning("warning_appHtmlMode"); - }); - break; - - case "appRemoteContent": - document.getElementById("appRemoteContent").addEventListener("change", (e) => { - consoleDebug("AHT: PrefsList.forEach(): Option appRemoteContent changed, setPrefsAppRemoteContent()"); - setPrefsAppRemoteContent(); - prefChangedWarning("warning_appRemoteContent"); - }); - break; - - case "allwaysInline": - document.getElementById("allwaysInline").addEventListener("change", (e) => { - consoleDebug("AHT: PrefsList.forEach(): Option allwaysInline changed, setPrefsAppAttachmentsInline()"); - setPrefsAppAttachmentsInline(); - prefChangedWarning("warning_allwaysInline"); - }); - break; - } -}); - -// resetToDefault click listener -document.getElementById("resetToDefault").addEventListener("click", () => { - consoleDebug("AHT: Reset clicked, resetToDefault()"); - resetToDefault(); - showCommandKeyWarning(false); -}); - -// resetToRecommended click listener -document.getElementById("resetToRecommended").addEventListener("click", () => { - consoleDebug("AHT: Reset clicked, resetToRecommended()"); - resetToRecommended(); - prefChangedWarning("warning_appHtmlMode"); - prefChangedWarning("warning_appRemoteContent"); - prefChangedWarning("warning_allwaysInline"); - showCommandKeyWarning(false); -}); - -function prefChangedWarning (elementId) { - let element = document.getElementById(elementId); - if (element.classList.contains("hidden")) { - element.classList.remove("hidden"); - consoleDebug("AHT: options_ui_listeners.js: prefChangedWarning: element.classList.remove"); - } -} - -function testCommandKey(testValue) { - consoleDebug("AHT: testCommandKey: " + testValue); - - let detail = {}; - detail.name = "_execute_message_display_action"; - detail.shortcut = testValue; - - if(detail.shortcut === "") { - return false; - } - - try { - messenger.commands.update(detail) - return true; - } catch (e) { - return false; - } -} - -function showCommandKeyWarning(doWarn) { - if(doWarn) { - let element = document.getElementById("warning_optionCommandKey"); - if (element.classList.contains("hidden")) { - element.classList.remove("hidden"); - consoleDebug("AHT: options_ui_listeners.js: warning_optionCommandKey: element.classList.remove"); - } - } else { - let element = document.getElementById("warning_optionCommandKey"); - if (!element.classList.contains("hidden")) { - element.classList.add("hidden"); - consoleDebug("AHT: options_ui_listeners.js: warning_optionCommandKey: element.classList.add"); - } - } -} +// onLoad listener to load Options and LegacyPrefs +document.addEventListener('DOMContentLoaded', async () => { + consoleDebug("AHT: DOMContentLoaded, restoreAllOptions() and initLegacyPrefs()"); + restoreAllOptions(); + initLegacyPrefs(); + + await messenger.messageContentPolicy.onChanged.addListener(async (newValue) => { + consoleDebug("AHT: messageContentPolicy newValue:", newValue); + await initLegacyPrefs(); + }); + + document.addEventListener("visibilitychange", async () => { + consoleDebug("AHT: DOMContent beforeunload"); + await messenger.messageContentPolicy.onChanged.removeListener(async () => { + await initLegacyPrefs(); + }); + }); +}); + +// onChange listener for all options to save the changed options +OptionsList.forEach((option) => { + consoleDebug("AHT: OptionsList.forEach(): option: " + option); + switch(option) { + case "buttonHtmlMode": + document.getElementById("buttonMode_html").addEventListener("change", (e) => { + consoleDebug("AHT: OptionsList.forEach(): Option buttonHtmlMode changed, saveOptions()"); + saveOptions(e); + }); + document.getElementById("buttonMode_sanitized").addEventListener("change", (e) => { + consoleDebug("AHT: OptionsList.forEach(): Option buttonHtmlMode changed, saveOptions()"); + saveOptions(e); + }); + document.getElementById("buttonMode_plaintext").addEventListener("change", (e) => { + consoleDebug("AHT: OptionsList.forEach(): Option buttonHtmlMode changed, saveOptions()"); + saveOptions(e); + }); + break; + + case "commandKey": + document.getElementById("commandKey").addEventListener("change", async (e) => { + consoleDebug("AHT: OptionsList.forEach(): Option commandKey changed, saveOptions()"); + if(testCommandKey(document.getElementById("commandKey").value) == true) { + showCommandKeyWarning(false); + saveOptions(e); + } else { + showCommandKeyWarning(true); + saveOptions(e); + } + }); + break; + + default: + document.getElementById(option).addEventListener("change", (e) => { + consoleDebug("AHT: OptionsList.forEach(): Option " + option + " changed, saveOptions()"); + saveOptions(e); + // .then(() => { enableOrDisableOptionUiElements(); }); + }); + } +}); + +// onChange listener for all options to save the related about:config prefs +PrefsList.forEach((option) => { + consoleDebug("AHT: pref: " + option); + switch(option) { + case "appHtmlMode": + document.getElementById("appMode_html").addEventListener("change", (e) => { + consoleDebug("AHT: PrefsList.forEach(): Option appHtmlMode (original HTML) changed, setPrefsMsgBodyAllowHTML()"); + setPrefsMsgBodyAllowHTML(); + prefChangedWarning("warning_appHtmlMode"); + }); + document.getElementById("appMode_sanitized").addEventListener("change", (e) => { + consoleDebug("AHT: PrefsList.forEach(): Option appHtmlMode (sanitized HTML) changed, setPrefsMsgBodySanitized()"); + setPrefsMsgBodySanitized(); + prefChangedWarning("warning_appHtmlMode"); + }); + document.getElementById("appMode_plaintext").addEventListener("change", (e) => { + consoleDebug("AHT: PrefsList.forEach(): Option appHtmlMode (plaintext) changed, setPrefsMsgBodyAsPlaintext()"); + setPrefsMsgBodyAsPlaintext(); + prefChangedWarning("warning_appHtmlMode"); + }); + document.getElementById("appMode_allBodyParts").addEventListener("change", (e) => { + consoleDebug("AHT: PrefsList.forEach(): Option appHtmlMode (AllBodyParts) changed, setPrefsMsgBodyAllParts()"); + setPrefsMsgBodyAllParts(); + prefChangedWarning("warning_appHtmlMode"); + }); + break; + + case "appRemoteContent": + document.getElementById("appRemoteContent").addEventListener("change", (e) => { + consoleDebug("AHT: PrefsList.forEach(): Option appRemoteContent changed, setPrefsAppRemoteContent()"); + setPrefsAppRemoteContent(); + prefChangedWarning("warning_appRemoteContent"); + }); + break; + + case "allwaysInline": + document.getElementById("allwaysInline").addEventListener("change", (e) => { + consoleDebug("AHT: PrefsList.forEach(): Option allwaysInline changed, setPrefsAppAttachmentsInline()"); + setPrefsAppAttachmentsInline(); + prefChangedWarning("warning_allwaysInline"); + }); + break; + } +}); + +// resetToDefault click listener +document.getElementById("resetToDefault").addEventListener("click", () => { + consoleDebug("AHT: Reset clicked, resetToDefault()"); + resetToDefault(); + showCommandKeyWarning(false); +}); + +// resetToRecommended click listener +document.getElementById("resetToRecommended").addEventListener("click", () => { + consoleDebug("AHT: Reset clicked, resetToRecommended()"); + resetToRecommended(); + prefChangedWarning("warning_appHtmlMode"); + prefChangedWarning("warning_appRemoteContent"); + prefChangedWarning("warning_allwaysInline"); + showCommandKeyWarning(false); +}); + +function prefChangedWarning (elementId) { + let element = document.getElementById(elementId); + if (element.classList.contains("hidden")) { + element.classList.remove("hidden"); + consoleDebug("AHT: options_ui_listeners.js: prefChangedWarning: element.classList.remove"); + } +} + +function testCommandKey(testValue) { + consoleDebug("AHT: testCommandKey: " + testValue); + + let detail = {}; + detail.name = "_execute_message_display_action"; + detail.shortcut = testValue; + + if(detail.shortcut === "") { + return false; + } + + try { + messenger.commands.update(detail) + return true; + } catch (e) { + return false; + } +} + +function showCommandKeyWarning(doWarn) { + if(doWarn) { + let element = document.getElementById("warning_optionCommandKey"); + if (element.classList.contains("hidden")) { + element.classList.remove("hidden"); + consoleDebug("AHT: options_ui_listeners.js: warning_optionCommandKey: element.classList.remove"); + } + } else { + let element = document.getElementById("warning_optionCommandKey"); + if (!element.classList.contains("hidden")) { + element.classList.add("hidden"); + consoleDebug("AHT: options_ui_listeners.js: warning_optionCommandKey: element.classList.add"); + } + } +} diff -Nru allow-html-temp-8.1.5/options/options_ui_save-restore.js allow-html-temp-10.0.4/options/options_ui_save-restore.js --- allow-html-temp-8.1.5/options/options_ui_save-restore.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/options/options_ui_save-restore.js 2024-06-06 12:32:12.000000000 +0000 @@ -1,197 +1,194 @@ -function saveOptions(e) { - e.preventDefault(); - - return messenger.storage.local.set({ - debug: document.getElementById("debug").checked, - buttonHtmlMode: document.querySelector('input[name=buttonHtmlMode]:checked').value, - tempRemoteContent: document.getElementById("tempRemoteContent").checked, - tempInline: document.getElementById("tempInline").checked, - commandKey: document.getElementById("commandKey").value - }); -} - -function restoreOption(id) { - return messenger.storage.local.get(id).then((res) => { - consoleDebug("AHT: restoreOption(id): option.id = " + id); - let element=""; - switch(id) { - case "commandKey": - element = document.getElementById(id); - element.value = res[id] || DefaultOptions[id]; - break; - case "buttonHtmlMode": - // radio handling - element = document.getElementById(res[id] || DefaultOptions[id]); - element.checked = true; - break; - default: - // checkbox handling - element = document.getElementById(id); - if (element.type && element.type == "checkbox") { - consoleDebug( "AHT: restoreOption(id): " + element.id + " = " + res[id] ); - if (res[id] === undefined) { - element.checked = DefaultOptions[id]; - } else { - element.checked = res[id]; - } - } else { - consoleDebug( "AHT: restoreOption(id): " + element.id + " = " + res[id] ); - element.value = res[id] || DefaultOptions[id]; - } - } - }, defaultError); -} - -async function restoreAllOptions() { - await restoreOption("debug"); - await restoreOption("buttonHtmlMode"); - await restoreOption("tempRemoteContent"); - await restoreOption("tempInline"); - await restoreOption("commandKey"); -} - -async function resetToDefault() { - // Reset LegacyPrefs - let window = await messenger.windows.getCurrent(); - let updateProperties = { - msgBodyAs: "original", - disableRemoteContent: true, - attachmentsInline: true - }; - await messenger.messageContentPolicy.update(window.id, updateProperties, false); - await initLegacyPrefs(); - - // Reset localstorage options - return messenger.storage.local.remove(OptionsList).then(() => { - restoreAllOptions(); - }); -} - -async function resetToRecommended() { - // Reset LegacyPrefs - let window = await messenger.windows.getCurrent(); - let updateProperties = { - msgBodyAs: "sanitized", - disableRemoteContent: true, - attachmentsInline: false - }; - await messenger.messageContentPolicy.update(window.id, updateProperties, false); - await initLegacyPrefs(); - - // Reset localstorage options - return messenger.storage.local.remove(OptionsList).then(() => { - restoreAllOptions(); - }); -} - -////// Handle Legacy Prefs by the Experiment API "Legacy Prefs" ///////////////////////////////// -async function initLegacyPrefs() { - consoleDebug("AHT: function initLegacyPrefs()"); - - let AllowHTML_menuitem = document.getElementById("appMode_html"); - let Sanitized_menuitem = document.getElementById("appMode_sanitized"); - let AsPlaintext_menuitem = document.getElementById("appMode_plaintext"); - let AllBodyParts_menuitem = document.getElementById("appMode_allBodyParts"); - - let currentPolicy = await messenger.messageContentPolicy.getCurrent(); - consoleDebug("AHT: initLegacyPrefs:", currentPolicy); - - let element = document.getElementById("allBodyParts"); - if(currentPolicy.showAllBodyPartsMenuitem) { - if (element.classList.contains("hidden")) { - element.classList.remove("hidden"); - consoleDebug("AHT: initLegacyPrefs: element.classList.remove"); - } - } else { - if (!element.classList.contains("hidden")) { - element.classList.add("hidden"); - consoleDebug("AHT: initLegacyPrefs: element.classList.add"); - } - } - - consoleDebug("AHT: initLegacyPrefs: set the correct radio item as checked."); - - switch (currentPolicy.msgBodyAs) { - case "allBodyParts": - if (AllBodyParts_menuitem) { - AllBodyParts_menuitem.checked = true; - } - break; - case "original": - if (AllowHTML_menuitem) { - AllowHTML_menuitem.checked = true; - } - break; - case "sanitized": - if (Sanitized_menuitem) { - Sanitized_menuitem.checked = true; - } - break; - case "plaintext": - if (AsPlaintext_menuitem) { - AsPlaintext_menuitem.checked = true; - } - break; - } - - document.getElementById("appRemoteContent").checked = !(currentPolicy.disableRemoteContent); - document.getElementById("allwaysInline").checked = currentPolicy.attachmentsInline; - - enableOrDisableOptionUiElements(); -} - -async function setPrefsMsgBodyAllowHTML() { - consoleDebug("AHT: function setPrefsMsgBodyAllowHTML()"); - let window = await messenger.windows.getCurrent(); - let updateProperties = { - msgBodyAs: "original" - }; - await messenger.messageContentPolicy.update(window.id, updateProperties, false); -} - -async function setPrefsMsgBodySanitized() { - consoleDebug("AHT: function setPrefsMsgBodySanitized()"); - let window = await messenger.windows.getCurrent(); - let updateProperties = { - msgBodyAs: "sanitized" - }; - await messenger.messageContentPolicy.update(window.id, updateProperties, false); -} - -async function setPrefsMsgBodyAsPlaintext() { - consoleDebug("AHT: function setPrefsMsgBodyAsPlaintext()"); - let window = await messenger.windows.getCurrent(); - let updateProperties = { - msgBodyAs: "plaintext" - }; - await messenger.messageContentPolicy.update(window.id, updateProperties, false); -} - -async function setPrefsMsgBodyAllParts() { - consoleDebug("AHT: function setPrefsMsgBodyAllParts()"); - let window = await messenger.windows.getCurrent(); - let updateProperties = { - msgBodyAs: "allBodyParts" - }; - await messenger.messageContentPolicy.update(window.id, updateProperties, false); -} - -async function setPrefsAppRemoteContent() { - consoleDebug("AHT: function setPrefsAppRemoteContent()"); - let window = await messenger.windows.getCurrent(); - let updateProperties = { - disableRemoteContent: !(document.getElementById("appRemoteContent").checked) - }; - await messenger.messageContentPolicy.update(window.id, updateProperties, false); - enableOrDisableOptionUiElements(); -} - -async function setPrefsAppAttachmentsInline() { - consoleDebug("AHT: function setPrefsAppAttachmentsInline()"); - let window = await messenger.windows.getCurrent(); - let updateProperties = { - attachmentsInline: document.getElementById("allwaysInline").checked - }; - await messenger.messageContentPolicy.update(window.id, updateProperties, false); - enableOrDisableOptionUiElements(); -} +function saveOptions(e) { + e.preventDefault(); + + return messenger.storage.local.set({ + debug: document.getElementById("debug").checked, + buttonHtmlMode: document.querySelector('input[name=buttonHtmlMode]:checked').value, + tempRemoteContent: document.getElementById("tempRemoteContent").checked, + tempInline: document.getElementById("tempInline").checked, + commandKey: document.getElementById("commandKey").value + }); +} + +function restoreOption(id) { + return messenger.storage.local.get(id).then((res) => { + consoleDebug("AHT: restoreOption(id): option.id = " + id); + let element=""; + switch(id) { + case "commandKey": + element = document.getElementById(id); + element.value = res[id] || DefaultOptions[id]; + break; + case "buttonHtmlMode": + // radio handling + element = document.getElementById(res[id] || DefaultOptions[id]); + element.checked = true; + break; + default: + // checkbox handling + element = document.getElementById(id); + if (element.type && element.type == "checkbox") { + consoleDebug( "AHT: restoreOption(id): " + element.id + " = " + res[id] ); + if (res[id] === undefined) { + element.checked = DefaultOptions[id]; + } else { + element.checked = res[id]; + } + } else { + consoleDebug( "AHT: restoreOption(id): " + element.id + " = " + res[id] ); + element.value = res[id] || DefaultOptions[id]; + } + } + }, defaultError); +} + +async function restoreAllOptions() { + await restoreOption("debug"); + await restoreOption("buttonHtmlMode"); + await restoreOption("tempRemoteContent"); + await restoreOption("tempInline"); + await restoreOption("commandKey"); +} + +async function resetToDefault() { + // Reset LegacyPrefs + let updateProperties = { + msgBodyAs: "original", + disableRemoteContent: true, + attachmentsInline: true + }; + await messenger.messageContentPolicy.update(updateProperties); + await initLegacyPrefs(); + + // Reset localstorage options + return messenger.storage.local.remove(OptionsList).then(() => { + restoreAllOptions(); + }); +} + +async function resetToRecommended() { + // Reset LegacyPrefs + let updateProperties = { + msgBodyAs: "sanitized", + disableRemoteContent: true, + attachmentsInline: false + }; + await messenger.messageContentPolicy.update(updateProperties); + await initLegacyPrefs(); + + // Reset localstorage options + return messenger.storage.local.remove(OptionsList).then(() => { + restoreAllOptions(); + }); +} + +////// Handle Legacy Prefs by the Experiment API "Legacy Prefs" ///////////////////////////////// +async function initLegacyPrefs() { + consoleDebug("AHT: function initLegacyPrefs()"); + + let AllowHTML_menuitem = document.getElementById("appMode_html"); + let Sanitized_menuitem = document.getElementById("appMode_sanitized"); + let AsPlaintext_menuitem = document.getElementById("appMode_plaintext"); + let AllBodyParts_menuitem = document.getElementById("appMode_allBodyParts"); + + let currentPolicy = await messenger.messageContentPolicy.getCurrent(); + consoleDebug("AHT: initLegacyPrefs:", currentPolicy); + + let element = document.getElementById("allBodyParts"); + if(currentPolicy.showAllBodyPartsMenuitem) { + if (element.classList.contains("hidden")) { + element.classList.remove("hidden"); + consoleDebug("AHT: initLegacyPrefs: element.classList.remove"); + } + } else { + if (!element.classList.contains("hidden")) { + element.classList.add("hidden"); + consoleDebug("AHT: initLegacyPrefs: element.classList.add"); + } + } + + consoleDebug("AHT: initLegacyPrefs: set the correct radio item as checked."); + + switch (currentPolicy.msgBodyAs) { + case "allBodyParts": + if (AllBodyParts_menuitem) { + AllBodyParts_menuitem.checked = true; + } + break; + case "original": + if (AllowHTML_menuitem) { + AllowHTML_menuitem.checked = true; + } + break; + case "sanitized": + if (Sanitized_menuitem) { + Sanitized_menuitem.checked = true; + } + break; + case "plaintext": + if (AsPlaintext_menuitem) { + AsPlaintext_menuitem.checked = true; + } + break; + } + + document.getElementById("appRemoteContent").checked = !(currentPolicy.disableRemoteContent); + document.getElementById("allwaysInline").checked = currentPolicy.attachmentsInline; + + enableOrDisableOptionUiElements(); +} + +async function setPrefsMsgBodyAllowHTML() { + consoleDebug("AHT: function setPrefsMsgBodyAllowHTML()"); + let updateProperties = { + msgBodyAs: "original" + }; + await messenger.messageContentPolicy.update(updateProperties); +} + +async function setPrefsMsgBodySanitized() { + consoleDebug("AHT: function setPrefsMsgBodySanitized()"); + // let window = await messenger.windows.getCurrent(); + let updateProperties = { + msgBodyAs: "sanitized" + }; + await messenger.messageContentPolicy.update(updateProperties); +} + +async function setPrefsMsgBodyAsPlaintext() { + consoleDebug("AHT: function setPrefsMsgBodyAsPlaintext()"); + // let window = await messenger.windows.getCurrent(); + let updateProperties = { + msgBodyAs: "plaintext" + }; + await messenger.messageContentPolicy.update(updateProperties); +} + +async function setPrefsMsgBodyAllParts() { + consoleDebug("AHT: function setPrefsMsgBodyAllParts()"); + // let window = await messenger.windows.getCurrent(); + let updateProperties = { + msgBodyAs: "allBodyParts" + }; + await messenger.messageContentPolicy.update(updateProperties); +} + +async function setPrefsAppRemoteContent() { + consoleDebug("AHT: function setPrefsAppRemoteContent()"); + // let window = await messenger.windows.getCurrent(); + let updateProperties = { + disableRemoteContent: !(document.getElementById("appRemoteContent").checked) + }; + await messenger.messageContentPolicy.update(updateProperties); + enableOrDisableOptionUiElements(); +} + +async function setPrefsAppAttachmentsInline() { + consoleDebug("AHT: function setPrefsAppAttachmentsInline()"); + // let window = await messenger.windows.getCurrent(); + let updateProperties = { + attachmentsInline: document.getElementById("allwaysInline").checked + }; + await messenger.messageContentPolicy.update(updateProperties); + enableOrDisableOptionUiElements(); +} diff -Nru allow-html-temp-8.1.5/scripts/aht_functions.js allow-html-temp-10.0.4/scripts/aht_functions.js --- allow-html-temp-8.1.5/scripts/aht_functions.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/scripts/aht_functions.js 2024-06-05 14:47:40.000000000 +0000 @@ -1,212 +1,118 @@ -var ahtFunctions = { - - savedPolicy: {}, - block: false, - tabId: 0, - - startup: function() { - consoleDebug("AHT: startup"); - - // a block to really reset the settings only once, - // to prevent mixed up prefs - ahtFunctions.block = false; - // variable for the tab.id the reload listener is related to - ahtFunctions.tabId = 0; - }, - - listenerToRestoreOriginalPrefs: function(tab) { - consoleDebug("AHT: messageDisplay.onMessageDisplayed: listenerToRestoreOriginalPrefs"); - consoleDebug("AHT: messageDisplay.onMessageDisplayed: ahtFunctions.block = " + ahtFunctions.block); - consoleDebug("AHT: messageDisplay.onMessageDisplayed: previous saved tabId = " + ahtFunctions.tabId); - consoleDebug("AHT: messageDisplay.onMessageDisplayed: tab.id: " + tab.id); - if ((ahtFunctions.block === true) && (ahtFunctions.tabId === tab.id)) { - // Revert to the users default settings - // after the message is reloaded. - ahtFunctions.RestoreHTMLcontentPrefs(); - } - }, - - registerListener: function() { - consoleDebug("AHT: registerListener listenerToRestoreOriginalPrefs"); - messenger.messageDisplay.onMessageDisplayed.addListener(ahtFunctions.listenerToRestoreOriginalPrefs); - }, - - removeListener: function() { - consoleDebug("AHT: removeListener listenerToRestoreOriginalPrefs"); - messenger.messageDisplay.onMessageDisplayed.removeListener(ahtFunctions.listenerToRestoreOriginalPrefs); - }, - - allowHtmlTemp: async function(tabId, infoModifiers, remoteButton) { - consoleDebug("AHT: allowHtmlTemp: fired"); - consoleDebug("AHT: allowHtmlTemp: options.debug = " + options.debug); - consoleDebug("AHT: allowHtmlTemp: options.buttonHtmlMode = " + options.buttonHtmlMode); - consoleDebug("AHT: allowHtmlTemp: options.tempRemoteContent = " + options.tempRemoteContent); - consoleDebug("AHT: allowHtmlTemp: tabId: " + tabId); - consoleDebug("AHT: allowHtmlTemp: infoModifiers: " + infoModifiers); - consoleDebug("AHT: allowHtmlTemp: remoteButton: " + remoteButton); - - // Save users applications default settings - // the await is absolutely important here! - if ((await ahtFunctions.SaveHTMLcontentPrefs(tabId)) === false) - return false; - // Only go further if the previous SaveHTMLcontentPrefs function call returns true, which means - // it actually has really saved the original prefs and isn't run into the blocked situation. - - consoleDebug("AHT: allowHtmlTemp: --------------------") - consoleDebug("AHT: allowHtmlTemp: saved values:", ahtFunctions.savedPolicy); - - // RemoteContent popupmenu item clicked in remote content bar in a HTML message - if (remoteButton === true) { - consoleDebug("AHT: allowHtmlTemp: remoteButton === true"); - ahtFunctions.ShowRemote(tabId); - } - - // We must now differ the chosen function by modifier key (ahtKeyboardEvent). - - // Addon button clicked + both CTRL and SHIFT key - else if((infoModifiers.includes("Ctrl") || infoModifiers.includes("Command")) && infoModifiers.includes("Shift")) { - consoleDebug("AHT: allowHtmlTemp: Addon button clicked + both CTRL and SHIFT key"); - ahtFunctions.ShowSanitizedHTML(tabId); - } - - // Addon button clicked + only CTRL key - else if((infoModifiers.includes("Ctrl") || infoModifiers.includes("Command")) && !(infoModifiers.includes("Shift"))) { - consoleDebug("AHT: allowHtmlTemp: Addon button clicked + only CTRL key"); - ahtFunctions.ShowRemote(tabId); - } - - // Addon button clicked + only SHIFT key - else if ((infoModifiers.includes("Shift")) && !((infoModifiers.includes("Ctrl") || infoModifiers.includes("Command")))) { - consoleDebug("AHT: allowHtmlTemp: Addon button clicked + only SHIFT key"); - ahtFunctions.ShowPlaintext(tabId); - } - - // Addon button clicked - no key pressed - else if (!(infoModifiers.includes("Shift") || infoModifiers.includes("Ctrl") || infoModifiers.includes("Command"))) { - consoleDebug("AHT: allowHtmlTemp: keyboard command pressed || button clicked + no key pressed"); - consoleDebug("AHT: allowHtmlTemp: options.buttonHtmlMode = " + options.buttonHtmlMode); - switch (options.buttonHtmlMode) { - case "buttonMode_html": - if (options.tempRemoteContent) { - consoleDebug("AHT: html + tempRemoteContent"); - ahtFunctions.ShowRemote(tabId); - } else { - consoleDebug("AHT: html"); - ahtFunctions.ShowOriginalHTML(tabId); - } - break; - case "buttonMode_sanitized": - consoleDebug("AHT: sanitized"); - ahtFunctions.ShowSanitizedHTML(tabId); - break; - case "buttonMode_plaintext": - consoleDebug("AHT: plaintext"); - ahtFunctions.ShowPlaintext(tabId); - break; - default: - consoleDebug("AHT: default"); - } - } - }, - - ShowPlaintext: async function(tabId) { - consoleDebug("AHT: ShowPlaintext"); - try { - let window = await messenger.windows.getCurrent(); - let updateProperties = { - msgBodyAs: "plaintext" - }; - await messenger.messageContentPolicy.update(window.id, updateProperties, false); - } catch (e) { - console.error("AHT: Plaintext error"); - } - }, - - ShowSanitizedHTML: async function(tabId) { - consoleDebug("AHT: ShowSanitizedHTML"); - try { - let window = await messenger.windows.getCurrent(); - let updateProperties = { - msgBodyAs: "sanitized" - }; - await messenger.messageContentPolicy.update(window.id, updateProperties, false); - } catch (e) { - console.error("AHT: ShowSanitizedHTML error"); - } - }, - - ShowOriginalHTML: async function(tabId) { - consoleDebug("AHT: ShowOriginalHTML"); - try { - let window = await messenger.windows.getCurrent(); - let updateProperties = { - msgBodyAs: "original", - // do not use false for attachmentsInline, but null to leave option unset if not tempInline - attachmentsInline: ((options.tempInline === true) ? true : null) - }; - await messenger.messageContentPolicy.update(window.id, updateProperties, false); - } catch (e) { - console.error("AHT: ShowOriginalHTML error"); - } - }, - - ShowRemote: async function(tabId) { - consoleDebug("AHT: ShowRemote"); - try { - let window = await messenger.windows.getCurrent(); - let updateProperties = { - msgBodyAs: "original", - disableRemoteContent: false, - // do not use false for attachmentsInline, but null to leave option unset if not tempInline - attachmentsInline: ((options.tempInline === true) ? true : null) - }; - await messenger.messageContentPolicy.update(window.id, updateProperties, false); - } catch (e) { - console.error("AHT: ShowRemote error"); - } - }, - - SaveHTMLcontentPrefs: async function(tabId) { - consoleDebug("AHT: SaveHTMLcontentPrefs"); - - // We need the following block to prevent from - // starting AHT again before the return - // to the original settings! Otherwise we would loose - // original settings and end up with garbled settings, - // which would be an unwanted 'Security leak'! - if (ahtFunctions.block === false) { - consoleDebug("AHT: SaveHTMLcontentPrefs: ahtFunctions.block === false >>> set it to true and save the tab.id"); - - ahtFunctions.block = true; - ahtFunctions.tabId = tabId; - ahtFunctions.registerListener(); - - consoleDebug("AHT: SaveHTMLcontentPrefs: go further after ahtFunctions.registerListener()"); - - ahtFunctions.savedPolicy = await messenger.messageContentPolicy.getCurrent(); - return true; - } else { - consoleDebug("AHT: SaveHTMLcontentPrefs: ahtFunctions.block === true >>> don't save prefs AND do not register listener"); - return false; - } - }, - - RestoreHTMLcontentPrefs: async function() { - consoleDebug("AHT: RestoreHTMLcontentPrefs"); - consoleDebug("AHT:", ahtFunctions.savedPolicy); - - if (ahtFunctions.block === true) { - let window = await messenger.windows.getCurrent(); - await messenger.messageContentPolicy.update(window.id, ahtFunctions.savedPolicy, true); - - ahtFunctions.removeListener(); - ahtFunctions.tabId = 0; - ahtFunctions.block = false; - } - }, - -} - -window.addEventListener("load", function(e) { - ahtFunctions.startup(); -}, false); +var ahtFunctions = { + + allowHtmlTemp: async function(tabId, infoModifiers, remoteButton) { + + // RemoteContent popupmenu item clicked in remote content bar in a HTML message + if (remoteButton === true) { + consoleDebug("AHT: allowHtmlTemp: remoteButton === true"); + ahtFunctions.ShowRemote(tabId); + } + + // We must now differ the chosen function by modifier key (ahtKeyboardEvent). + + // Addon button clicked + both CTRL and SHIFT key + else if((infoModifiers.includes("Ctrl") || infoModifiers.includes("Command")) && infoModifiers.includes("Shift")) { + consoleDebug("AHT: allowHtmlTemp: Addon button clicked + both CTRL and SHIFT key"); + ahtFunctions.ShowSanitizedHTML(); + } + + // Addon button clicked + only CTRL key + else if((infoModifiers.includes("Ctrl") || infoModifiers.includes("Command")) && !(infoModifiers.includes("Shift"))) { + consoleDebug("AHT: allowHtmlTemp: Addon button clicked + only CTRL key"); + ahtFunctions.ShowRemote(tabId); + } + + // Addon button clicked + only SHIFT key + else if ((infoModifiers.includes("Shift")) && !((infoModifiers.includes("Ctrl") || infoModifiers.includes("Command")))) { + consoleDebug("AHT: allowHtmlTemp: Addon button clicked + only SHIFT key"); + ahtFunctions.ShowPlaintext(); + } + + // Addon button clicked - no key pressed + else if (!(infoModifiers.includes("Shift") || infoModifiers.includes("Ctrl") || infoModifiers.includes("Command"))) { + consoleDebug("AHT: allowHtmlTemp: keyboard command pressed || button clicked + no key pressed"); + consoleDebug("AHT: allowHtmlTemp: options.buttonHtmlMode = " + options.buttonHtmlMode); + switch (options.buttonHtmlMode) { + case "buttonMode_html": + if (options.tempRemoteContent) { + consoleDebug("AHT: html + tempRemoteContent"); + ahtFunctions.ShowRemote(tabId); + } else { + consoleDebug("AHT: html"); + ahtFunctions.ShowOriginalHTML(); + } + break; + case "buttonMode_sanitized": + consoleDebug("AHT: sanitized"); + ahtFunctions.ShowSanitizedHTML(); + break; + case "buttonMode_plaintext": + consoleDebug("AHT: plaintext"); + ahtFunctions.ShowPlaintext(); + break; + default: + consoleDebug("AHT: default"); + } + } + }, + + ShowPlaintext: async function() { + consoleDebug("AHT: ShowPlaintext"); + try { + let updateProperties = { + msgBodyAs: "plaintext" + }; + await messenger.messageContentPolicy.update(updateProperties); + } catch (e) { + console.error("AHT: Plaintext error"); + } + }, + + ShowSanitizedHTML: async function() { + consoleDebug("AHT: ShowSanitizedHTML"); + try { + let updateProperties = { + msgBodyAs: "sanitized" + }; + await messenger.messageContentPolicy.update(updateProperties); + } catch (e) { + console.error("AHT: ShowSanitizedHTML error"); + } + }, + + ShowOriginalHTML: async function() { + consoleDebug("AHT: ShowOriginalHTML"); + try { + let updateProperties = { + msgBodyAs: "original", + // do not use false for attachmentsInline, but null to leave option unset if not tempInline + attachmentsInline: ((options.tempInline === true) ? true : null) + }; + await messenger.messageContentPolicy.update(updateProperties); + } catch (e) { + console.error("AHT: ShowOriginalHTML error"); + } + }, + + ShowRemote: async function(tabId) { + consoleDebug("AHT: ShowRemote"); + try { + let message = await messenger.messageDisplay.getDisplayedMessage(tabId); + consoleDebug("AHT: ShowRemote: message.id = ", message.id); + await messenger.remoteContent.setContentPolicy(message.id, "Allow"); + } catch (e) { + console.error("AHT: ShowRemote ERROR with remoteContent policy"); + } + try { + let updateProperties = { + msgBodyAs: "original", + disableRemoteContent: false, + // do not use false for attachmentsInline, but null to leave option unset if not tempInline + attachmentsInline: ((options.tempInline === true) ? true : null) + }; + await messenger.messageContentPolicy.update(updateProperties); + } catch (e) { + console.error("AHT: ShowRemote ERROR with messageContent policy"); + } + } +}; \ No newline at end of file diff -Nru allow-html-temp-8.1.5/scripts/background.js allow-html-temp-10.0.4/scripts/background.js --- allow-html-temp-8.1.5/scripts/background.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/scripts/background.js 2024-08-04 20:47:22.000000000 +0000 @@ -1,33 +1,205 @@ -(async () => { - - await optionsMigrate(); - await optionsInit(); - await messenger.storage.onChanged.addListener(optionsInit); - - // Add eventListener for onClicked on the toolbar button - messenger.browserAction.onClicked.addListener(onToolbarButtonClicked); - async function onToolbarButtonClicked(tab, info) { - consoleDebug("AHT: browserAction.onClicked: Toolbar button fired"); - consoleDebug("AHT: browserAction.onClicked: tab.id = " + tab.id); - consoleDebug("AHT: browserAction.onClicked: info.modifiers = " + info.modifiers); - - ahtFunctions.allowHtmlTemp(tab.id, info.modifiers, false); - } - - // Add eventListener for onClicked on the header button - messenger.messageDisplayAction.onClicked.addListener(onHeaderButtonClicked); - async function onHeaderButtonClicked(tab, info) { - consoleDebug("AHT: messageDisplayAction.onClicked: Header button fired"); - consoleDebug("AHT: messageDisplayAction.onClicked: tab.id = " + tab.id); - consoleDebug("AHT: messageDisplayAction.onClicked: info.modifiers = " + info.modifiers); - - ahtFunctions.allowHtmlTemp(tab.id, info.modifiers, false); - } - - // Add eventListener for remote item in doorhanger context menu - messenger.allowHtmlTemp.onClick.addListener((tabId) => { - consoleDebug("AHT: allowHtmlTemp.onClick.addListener: tabId = " + tabId); - ahtFunctions.allowHtmlTemp(tabId, "", true); - }); - -})(); \ No newline at end of file +// Since we disconnect all tabs from the policy prefs, we need to manually reload +// them on pref updates. If the pref change is a temporary add-on-inflicted change, +// we reload only a specific tab. +var ahtStatus = { + reloadAllTabs: true +}; + +var blockButtonClicks = []; + +messenger.messageContentPolicy.onChanged.addListener(async (newValue) => { + // If this policy change is part of an add-on inflicted temporary + // policy change, ignore it. + if (ahtStatus.ignorePolicyChange) { + return; + } + + let tabs = await messenger.tabs.query({}); + for (let tab of tabs) { + if (!["messageDisplay", "mail"].includes(tab.type)) { + continue; + } + if (ahtStatus.reloadAllTabs || ahtStatus.reloadTab == tab.id) { + await messenger.allowHtmlTemp.reloadTab(tab.id); + } + } + await setButtonIconAndLabel(); +}); + +// An option change could cause the button policy to be identical to the current +// policy and the button needs to be disabled. +messenger.storage.onChanged.addListener(async (changes) => { + await optionsInit(); + if (changes.buttonHtmlMode) { + // Reload all already open tabs, to trigger the single entry point for all + // UI updates of the AHT addon: a message display. + let tabs = await messenger.tabs.query({}); + for (let tab of tabs) { + if (!["messageDisplay", "mail"].includes(tab.type)) { + continue; + } + await messenger.allowHtmlTemp.reloadTab(tab.id); + } + } + await setButtonIconAndLabel(); + await setCommandKey(); +}); + +// Add eventListener for onClicked on the message header button. +messenger.messageDisplayAction.onClicked.addListener(async (tab, info) => { + await ahtLogic(tab.id, info, false); +}); + +// Add eventListener for remote item in remoteContentBar doorhanger context menu +messenger.allowHtmlTemp.onClick.addListener(async (tabId) => { + consoleDebug("AHT: allowHtmlTemp.onClick.addListener: tabId = ", tabId); + await ahtLogic(tabId, "", true); +}); + +// Disconnect all message tabs from the menu/prefs and disable/enable buttons. +messenger.messageDisplay.onMessagesDisplayed.addListener(async (tab, messages) => { + await messenger.allowHtmlTemp.disconnectTab(tab.id); + + // This is a reload caused by an add-on inflicted policy change, return to the + // user defined value without reloading the tab again. + if (ahtStatus.returnToPolicy) { + // The following policy update should not trigger a reload. + // not 100 % sure, but use the complete object, not only msgBodyAs + let updateProperties = ahtStatus.returnToPolicy; + ahtStatus = { + ignorePolicyChange: true + } + // not 100 % sure, but use the complete object, not only msgBodyAs + await messenger.messageContentPolicy.update(updateProperties); + } else { + // Update buttons for the newly loaded message. + updateActionButtonForNewMessages(tab, messages); + } + + // Remove the action block now that the policy has been reset to default. + blockButtonClicks[tab.id] = false; + consoleDebug("AHT: onMessagesDisplayed: blockButtonClicks tab.id: ", tab.id); + consoleDebug("AHT: onMessagesDisplayed: blockButtonClicks value: ", blockButtonClicks[tab.id]); + + // Reconnect after the add-on inflicted temporary policy change, to have all tabs reloaded + // in case of later default policy change + if (ahtStatus.ignorePolicyChange) { + ahtStatus = { + reloadAllTabs: true + } + } + await setButtonIconAndLabel(); +}); + +(async () => {getCurrentPolicy + await optionsMigrate(); + await optionsInit(); + + // Reload all already open tabs, to trigger the single entry point for all + // UI updates of the AHT addon: a message display. + let tabs = await messenger.tabs.query({}); + for (let tab of tabs) { + if (!["messageDisplay", "mail"].includes(tab.type)) { + continue; + } + await messenger.allowHtmlTemp.reloadTab(tab.id); + } + +})(); + +async function ahtLogic(tabId, info, remoteButton) { + consoleDebug("AHT: allowHtmlTemp: fired"); + consoleDebug("AHT: allowHtmlTemp: options.debug = " + options.debug); + consoleDebug("AHT: allowHtmlTemp: options.buttonHtmlMode = " + options.buttonHtmlMode); + consoleDebug("AHT: allowHtmlTemp: options.tempRemoteContent = " + options.tempRemoteContent); + consoleDebug("AHT: allowHtmlTemp: tabId: " + tabId); + consoleDebug("AHT: allowHtmlTemp: info.modifiers: " + info.modifiers); + consoleDebug("AHT: allowHtmlTemp: remoteButton: " + remoteButton); + + let buttonPolicy = await getButtonPolicy(info, remoteButton); + let currentPolicy = await getCurrentPolicy(); + consoleDebug("AHT: ahtLogic: buttonPolicy: ", buttonPolicy); + consoleDebug("AHT: ahtLogic: currentPolicy: ", currentPolicy); + + // Block the action in case of quick multiple clicks, to prevent garbled default prefs + consoleDebug("AHT: ahtLogic: blockButtonClicks tabId: ", tabId); + consoleDebug("AHT: ahtLogic: blockButtonClicks value: ", blockButtonClicks[tabId]); + if (blockButtonClicks[tabId]) { return; } + blockButtonClicks[tabId] = true; + consoleDebug("AHT: ahtLogic: blockButtonClicks tabId: ", tabId); + consoleDebug("AHT: ahtLogic: blockButtonClicks value: ", blockButtonClicks[tabId]); + + // The following policy switch is not a change of the default, but a temporary + // switch, so we have to return to the current policy once the tab is loaded. + ahtStatus = { + returnToPolicy: currentPolicy, + reloadTab: tabId, + } + + await ahtFunctions.allowHtmlTemp(tabId, info.modifiers, remoteButton); + + // In the following case the above call of ahtFunctions.allowhtmltemp() doesn't trigger a message reload, + // so we need to trigger the message reload manual by the following lines + if (buttonPolicy.msgBodyAs == currentPolicy.msgBodyAs) { + consoleDebug("AHT: ahtLogic: buttonPolicy.msgBodyAs == currentPolicy.msgBodyAs: ", (buttonPolicy.msgBodyAs == currentPolicy.msgBodyAs)); + await messenger.allowHtmlTemp.reloadTab(tabId); + } +} + +async function getButtonPolicy(info, remoteButton) { + // RemoteContent popupmenu item clicked in remote content bar in a HTML message + if (remoteButton === true) { + consoleDebug("AHT: getButtonPolicy: remoteButton === true"); + return { + msgBodyAs: "original", + disableRemoteContent: false, + // do not use false for attachmentsInline, but null to leave option unset if not tempInline + attachmentsInline: ((options.tempInline === true) ? true : null) + }; + } + + // Adapt button policy according to the possible modifier keys + // Addon button clicked + both CTRL and SHIFT key + if((info.modifiers.includes("Ctrl") || info.modifiers.includes("Command")) && info.modifiers.includes("Shift")) { + consoleDebug("AHT: getButtonPolicy: Addon button clicked + both CTRL and SHIFT key"); + return { msgBodyAs: "sanitized" }; + } + // Addon button clicked + only CTRL key + else if((info.modifiers.includes("Ctrl") || info.modifiers.includes("Command")) && !(info.modifiers.includes("Shift"))) { + consoleDebug("AHT: getButtonPolicy: Addon button clicked + only CTRL key"); + return { + msgBodyAs: "original", + disableRemoteContent: false, + // do not use false for attachmentsInline, but null to leave option unset if not tempInline + attachmentsInline: ((options.tempInline === true) ? true : null) + }; + } + // Addon button clicked + only SHIFT key + else if ((info.modifiers.includes("Shift")) && !((info.modifiers.includes("Ctrl") || info.modifiers.includes("Command")))) { + consoleDebug("AHT: getButtonPolicy: Addon button clicked + only SHIFT key"); + return { msgBodyAs: "plaintext" }; + } + + // The last case is just the button without a relevant modifier key + else { + const modeMap = { + "buttonMode_plaintext": "plaintext", + "buttonMode_sanitized": "sanitized", + "buttonMode_html": "original", + } + // return modeMap[await getOption("buttonHtmlMode")]; + // buttonPolicy must include the options tempRemoteContent (which is vice versa to disableRemoteContent) + // and tempInline + return { + msgBodyAs: modeMap[await getOption("buttonHtmlMode")], + disableRemoteContent: !(options.tempRemoteContent), + // do not use false for attachmentsInline, but null to leave option unset if not tempInline + attachmentsInline: ((options.tempInline === true) ? true : null) + }; + } +} + +async function getCurrentPolicy() { + let currentPolicy = await messenger.messageContentPolicy.getCurrent(); + return currentPolicy; +} diff -Nru allow-html-temp-8.1.5/scripts/debug.js allow-html-temp-10.0.4/scripts/debug.js --- allow-html-temp-8.1.5/scripts/debug.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/scripts/debug.js 2022-05-27 15:10:56.000000000 +0000 @@ -1,10 +1,10 @@ -function consoleDebug(text, object) { - if(options.debug == true) { - if(object != undefined) { - console.debug(text, object); - } - else { - console.debug(text); - } - } +function consoleDebug(text, object) { + if(options.debug == true) { + if(object != undefined) { + console.debug(text, object); + } + else { + console.debug(text); + } + } } \ No newline at end of file diff -Nru allow-html-temp-8.1.5/scripts/i18n.js allow-html-temp-10.0.4/scripts/i18n.js --- allow-html-temp-8.1.5/scripts/i18n.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/scripts/i18n.js 2022-05-27 15:10:56.000000000 +0000 @@ -1,50 +1,50 @@ -var i18n = { - updateString(string) { - let re = new RegExp(this.keyPrefix + "(.+?)__", "g"); - return string.replace(re, matched => { - const key = matched.slice(this.keyPrefix.length, -2); - let rv = this.extension - ? this.extension.localeData.localizeMessage(key) - : messenger.i18n.getMessage(key); - return rv || matched; - }); - }, - - updateSubtree(node) { - const texts = document.evaluate( - 'descendant::text()[contains(self::text(), "' + this.keyPrefix + '")]', - node, - null, - XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, - null - ); - for (let i = 0, maxi = texts.snapshotLength; i < maxi; i++) { - const text = texts.snapshotItem(i); - if (text.nodeValue.includes(this.keyPrefix)) text.nodeValue = this.updateString(text.nodeValue); - } - - const attributes = document.evaluate( - 'descendant::*/attribute::*[contains(., "' + this.keyPrefix + '")]', - node, - null, - XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, - null - ); - for (let i = 0, maxi = attributes.snapshotLength; i < maxi; i++) { - const attribute = attributes.snapshotItem(i); - if (attribute.value.includes(this.keyPrefix)) attribute.value = this.updateString(attribute.value); - } - }, - - updateDocument(options = {}) { - this.extension = null; - this.keyPrefix = "__MSG_"; - if (options) { - if (options.extension) this.extension = options.extension; - if (options.keyPrefix) this.keyPrefix = options.keyPrefix; - } - this.updateSubtree(document); - } -}; - +var i18n = { + updateString(string) { + let re = new RegExp(this.keyPrefix + "(.+?)__", "g"); + return string.replace(re, matched => { + const key = matched.slice(this.keyPrefix.length, -2); + let rv = this.extension + ? this.extension.localeData.localizeMessage(key) + : messenger.i18n.getMessage(key); + return rv || matched; + }); + }, + + updateSubtree(node) { + const texts = document.evaluate( + 'descendant::text()[contains(self::text(), "' + this.keyPrefix + '")]', + node, + null, + XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, + null + ); + for (let i = 0, maxi = texts.snapshotLength; i < maxi; i++) { + const text = texts.snapshotItem(i); + if (text.nodeValue.includes(this.keyPrefix)) text.nodeValue = this.updateString(text.nodeValue); + } + + const attributes = document.evaluate( + 'descendant::*/attribute::*[contains(., "' + this.keyPrefix + '")]', + node, + null, + XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, + null + ); + for (let i = 0, maxi = attributes.snapshotLength; i < maxi; i++) { + const attribute = attributes.snapshotItem(i); + if (attribute.value.includes(this.keyPrefix)) attribute.value = this.updateString(attribute.value); + } + }, + + updateDocument(options = {}) { + this.extension = null; + this.keyPrefix = "__MSG_"; + if (options) { + if (options.extension) this.extension = options.extension; + if (options.keyPrefix) this.keyPrefix = options.keyPrefix; + } + this.updateSubtree(document); + } +}; + i18n.updateDocument(); \ No newline at end of file diff -Nru allow-html-temp-8.1.5/scripts/options.js allow-html-temp-10.0.4/scripts/options.js --- allow-html-temp-8.1.5/scripts/options.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/scripts/options.js 2024-03-03 11:41:20.000000000 +0000 @@ -1,100 +1,108 @@ -var options = {}; - -async function optionsMigrate() { - // Because of old LegacyPrefs using other value then the new options system, we can't do a simple recursion for the 3 LegacyPrefs. - // Therefore the following procedures (only) seem to be redundant. - - let legacyName = ""; - let legacyValue = null; - - legacyName = "extensions.allowHtmlTemp.ButtonFunction"; - legacyValue = null; - legacyValue = await messenger.LegacyPrefs.getUserPref(legacyName); - - if (legacyValue !== null) { - console.log("Migrating legacy preference: " + legacyName + " = ", legacyValue); - - // Migrate old integer value to new string value - // Sometimes, there is a strange issue leading to string vs integer values. Get both in the switch: - switch (legacyValue) { - case 0: - newValue = "buttonMode_html"; - break; - case "0": - newValue = "buttonMode_html"; - break; - case 1: - newValue = "buttonMode_sanitized"; - break; - case "1": - newValue = "buttonMode_sanitized"; - break; - case 2: - newValue = "buttonMode_plaintext"; - break; - case "2": - newValue = "buttonMode_plaintext"; - break; - } - messenger.storage.local.set({ - buttonHtmlMode: newValue - }); - - // Clear the legacy value. - messenger.LegacyPrefs.clearUserPref(legacyName); - } - - legacyName = "extensions.allowHtmlTemp.ForceRemoteContent"; - legacyValue = null; - legacyValue = await messenger.LegacyPrefs.getUserPref(legacyName); - if (legacyValue !== null) { - console.log("Migrating legacy preference: " + legacyName + " = ", legacyValue); - - messenger.storage.local.set({ - tempRemoteContent: legacyValue - }); - - // Clear the legacy value. - messenger.LegacyPrefs.clearUserPref(legacyName); - } - - legacyName = "extensions.allowHtmlTemp.InlineAttachmentsTemp"; - legacyValue = null; - legacyValue = await messenger.LegacyPrefs.getUserPref(legacyName); - if (legacyValue !== null) { - console.log("Migrating legacy preference: " + legacyName + " = ", legacyValue); - - messenger.storage.local.set({ - tempInline: legacyValue - }); - - // Clear the legacy value. - messenger.LegacyPrefs.clearUserPref(legacyName); - } - - // Clear 2 more old legacy prefs - messenger.LegacyPrefs.clearUserPref("extensions.allowHtmlTemp.JavaScriptTemp"); - messenger.LegacyPrefs.clearUserPref("extensions.allowHtmlTemp.reset_javascript_default_done_once"); -} - - -async function optionsInit() { - await reloadAllOptions(); -} - -async function reloadAllOptions() { - await reloadOption("debug"); - await reloadOption("commandKey"); - await reloadOption("buttonHtmlMode"); - await reloadOption("tempRemoteContent"); - await reloadOption("tempInline"); -} - -function reloadOption(id) { - return messenger.storage.local.get(id).then((res) => { - if (res[id] != undefined) - options[id] = res[id]; - else - options[id] = DefaultOptions[id]; - }, defaultError); -} +var options = {}; + +async function optionsMigrate() { + // Because of old LegacyPrefs using other value then the new options system, we can't do a simple recursion for the 3 LegacyPrefs. + // Therefore the following procedures (only) seem to be redundant. + + let legacyName = ""; + let legacyValue = null; + + legacyName = "extensions.allowHtmlTemp.ButtonFunction"; + legacyValue = null; + legacyValue = await messenger.LegacyPrefs.getUserPref(legacyName); + + if (legacyValue !== null) { + console.log("Migrating legacy preference: " + legacyName + " = ", legacyValue); + + // Migrate old integer value to new string value + // Sometimes, there is a strange issue leading to string vs integer values. Get both in the switch: + switch (legacyValue) { + case 0: + newValue = "buttonMode_html"; + break; + case "0": + newValue = "buttonMode_html"; + break; + case 1: + newValue = "buttonMode_sanitized"; + break; + case "1": + newValue = "buttonMode_sanitized"; + break; + case 2: + newValue = "buttonMode_plaintext"; + break; + case "2": + newValue = "buttonMode_plaintext"; + break; + } + messenger.storage.local.set({ + buttonHtmlMode: newValue + }); + + // Clear the legacy value. + messenger.LegacyPrefs.clearUserPref(legacyName); + } + + legacyName = "extensions.allowHtmlTemp.ForceRemoteContent"; + legacyValue = null; + legacyValue = await messenger.LegacyPrefs.getUserPref(legacyName); + if (legacyValue !== null) { + console.log("Migrating legacy preference: " + legacyName + " = ", legacyValue); + + messenger.storage.local.set({ + tempRemoteContent: legacyValue + }); + + // Clear the legacy value. + messenger.LegacyPrefs.clearUserPref(legacyName); + } + + legacyName = "extensions.allowHtmlTemp.InlineAttachmentsTemp"; + legacyValue = null; + legacyValue = await messenger.LegacyPrefs.getUserPref(legacyName); + if (legacyValue !== null) { + console.log("Migrating legacy preference: " + legacyName + " = ", legacyValue); + + messenger.storage.local.set({ + tempInline: legacyValue + }); + + // Clear the legacy value. + messenger.LegacyPrefs.clearUserPref(legacyName); + } + + // Clear 2 more old legacy prefs + messenger.LegacyPrefs.clearUserPref("extensions.allowHtmlTemp.JavaScriptTemp"); + messenger.LegacyPrefs.clearUserPref("extensions.allowHtmlTemp.reset_javascript_default_done_once"); +} + + +async function optionsInit() { + await reloadAllOptions(); +} + +async function reloadAllOptions() { + await reloadOption("debug"); + await reloadOption("commandKey"); + await reloadOption("buttonHtmlMode"); + await reloadOption("tempRemoteContent"); + await reloadOption("tempInline"); +} + +function reloadOption(id) { + return messenger.storage.local.get(id).then((res) => { + if (res[id] != undefined) + options[id] = res[id]; + else + options[id] = DefaultOptions[id]; + }, defaultError); +} + +async function getOption(name) { + if (!DefaultOptions[name]) { + throw new Error(`Unknown option ${name}`) + } + let rv = await messenger.storage.local.get({[name]: DefaultOptions[name]}); + return rv[name]; +} diff -Nru allow-html-temp-8.1.5/scripts/options_defaults.js allow-html-temp-10.0.4/scripts/options_defaults.js --- allow-html-temp-8.1.5/scripts/options_defaults.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/scripts/options_defaults.js 2023-08-10 20:04:42.000000000 +0000 @@ -1,19 +1,19 @@ -const DefaultOptions = { - debug: false, - commandKey: "Ctrl+Alt+F5", - buttonHtmlMode: "buttonMode_html", - tempRemoteContent: false, - tempInline: false -} -const OptionsList = Object.keys(DefaultOptions); - -const DefaultPrefs = { - appHtmlMode: "appMode_sanitized", - appRemoteContent: true, - allwaysInline: false -} -const PrefsList = Object.keys(DefaultPrefs); - -function defaultError(error) { - console.error("AHT: Error:", error); +const DefaultOptions = { + debug: false, + commandKey: "Ctrl+Alt+F5", + buttonHtmlMode: "buttonMode_html", + tempRemoteContent: false, + tempInline: false +} +const OptionsList = Object.keys(DefaultOptions); + +const DefaultPrefs = { + appHtmlMode: "appMode_sanitized", + appRemoteContent: true, + allwaysInline: false +} +const PrefsList = Object.keys(DefaultPrefs); + +function defaultError(error) { + console.error("AHT: Error:", error); } \ No newline at end of file diff -Nru allow-html-temp-8.1.5/scripts/update_ui.js allow-html-temp-10.0.4/scripts/update_ui.js --- allow-html-temp-8.1.5/scripts/update_ui.js 2022-10-23 21:19:58.000000000 +0000 +++ allow-html-temp-10.0.4/scripts/update_ui.js 2024-08-04 22:54:48.000000000 +0000 @@ -1,214 +1,126 @@ -// Set enabled/disabled status for toolbar / message header button in multiple steps -// Step 1.1: disable if message selection changes (to catch one versus multiple) - -async function registerListeners() { - messenger.mailTabs.onSelectedMessagesChanged.addListener(async (tab, selectedMessages) => { - consoleDebug("AHT: mailTabs.onSelectedMessagesChanged: disable toolbar button if selected messages != 1"); - consoleDebug("AHT: Object.keys(selectedMessages.messages).length = " + Object.keys(selectedMessages.messages).length); - - // Allways disable the button, and decide in the other (following) listeners to re-enable the button. - // Contra: This leads to a short button "blinking" (off-on). - // Pro: In Offline Mode the button is disabled (as intended), if the message body is not available and no message is displayed - disableButtons(tab.id); - - // This would be the alternative to allways disabling the button, but the button will then not be disabled in the following - // listeners below, when no message body is available in Offline Mode. - /* - if(Object.keys(selectedMessages.messages).length != 1) { - disableButtons(tab.id); - } - */ - }); - - // Step 1.2: disable if folder is changed - messenger.mailTabs.onDisplayedFolderChanged.addListener(async (tab, displayedFolder) => { - consoleDebug("AHT: mailTabs.onDisplayedFolderChanged: disable toolbar button"); - - disableButtons(tab.id); - }); - - // Step 1.3: disable if tab is changed - messenger.tabs.onActivated.addListener(async (activeInfo) => { - consoleDebug("AHT: tabs.onActivated: disable toolbar button"); - - disableButtons(activeInfo.tabId); - }); - - // Step 3: enable / disable if junk status changes - // - // Commented out since the junk status change will now (Thunderbird 101+) fire onMessageDisplayed again for - // all opened instances of a message. So it isn't necessary to listen for the onUpdated event, which would - // be more complicated, and the code below was not yet complete and not really working. - // - /********************************************************************************************************** - messenger.messages.onUpdated.addListener(async (message, changedProperties) => { - consoleDebug("AHT: messages.onUpdated: changedProperties.junk: " + changedProperties.junk); - consoleDebug("AHT: messages.onUpdated: changedProperties message.id: " + message.id); - - ////////////////// The following code in this listener has be reworked. ///////////////////////////// - // The goal is to catch all tabs and windows in which the relevant message is shown, - // to dis- or enable the Button according to the junk status, - // which has changed after the inital display of the message. - let MessageHeaderUpdated = message; - let MailTab = await messenger.mailTabs.getCurrent(); - // MailTab sometimes is undefined, so so use if(MailTab) to prevent errors in console - if (MailTab) { - consoleDebug("AHT: messages.onUpdated: changedProperties: displayed MailTab.id = " + MailTab.id); - let MessageHeaderDisplayed = await messenger.messageDisplay.getDisplayedMessage(MailTab.id); - if (MessageHeaderUpdated.headerMessageId == MessageHeaderDisplayed.headerMessageId) { - consoleDebug("AHT: messages.onUpdated: changedProperties headerMessageId == messages displayed headerMessageId"); - } - } - // disableButtons(activeInfo.tabId); - }); - **********************************************************************************************************/ - - // Step 2: re-enable if really a (one) message is displayed - // - and it is not Junk - // - and it is not News - // - and it has a HTML MIME part - messenger.messageDisplay.onMessageDisplayed.addListener(async (tab, message) => { - consoleDebug("AHT: messageDisplay.onMessageDisplayed: tab.id = " + tab.id + " message.id = " + message.id); - - // disableButtons(tab.id); - - // check for folder type and don't enable UI for junk folders - let MessageHeader = await messenger.messages.get(message.id) - consoleDebug("AHT: messageDisplay.onMessageDisplayed: folder type = " + MessageHeader.folder.type); - if (MessageHeader.folder.type == "junk") { - disableButtons(tab.id); - return; - } - // check for junk status and don't enable UI for junk messages - consoleDebug("AHT: messageDisplay.onMessageDisplayed: junk status = " + MessageHeader.junk); - if (MessageHeader.junk) { - disableButtons(tab.id); - return; - } - - // check for account type: - // don't enable UI for News accounts, - // but enable UI for RSS accounts - let account = await messenger.accounts.get(message.folder.accountId); - consoleDebug("AHT: messageDisplay.onMessageDisplayed: account type = " + account.type); - if (account.type == "news") { - disableButtons(tab.id); - return; - } - if (account.type == "rss") { - consoleDebug("AHT: messageDisplay.onMessageDisplayed: enable toolbar button"); - enableButtons(tab.id); - return; - } - - // for all other messages check, if they have a HTML MIME part - consoleDebug("AHT: messageDisplay.onMessageDisplayed: checkMailForHtmlpart"); - - let hasHtmlMimePart = await messenger.allowHtmlTemp.checkMailForHtmlpart(message.id, options.debug); - - consoleDebug("AHT: messageDisplay.onMessageDisplayed: checkMailForHtmlpart returns: " + hasHtmlMimePart); - - if(hasHtmlMimePart) { - enableButtons(tab.id); - } else { - disableButtons(tab.id); - } - }); - - // Listen for option changes to set the button icon and label - await messenger.storage.onChanged.addListener(setButtonIconAndLabel); - // Listen for option changes to set the command key - await messenger.storage.onChanged.addListener(setCommandKey); - - // Listen for prefs changes using the messageContentPolicy API - await messenger.messageContentPolicy.onChanged.addListener(async (newValue) => { - consoleDebug("AHT: messageContentPolicy newValue:", newValue); - await setButtonIconAndLabel(); - }); - - consoleDebug("AHT: registered initial listeners for update_ui.js: "); -} - -async function setButtonIconAndLabel() { - buttonIcon = {}; - buttonLabel = {}; - - await reloadOption("buttonHtmlMode"); - let appRemoteContent = !(await messenger.messageContentPolicy.getCurrent()).disableRemoteContent; - await reloadOption("tempRemoteContent"); - consoleDebug("AHT: setButtonIcon: options.buttonHtmlMode: " + options.buttonHtmlMode); - consoleDebug("AHT: setButtonIcon: pref appRemoteContent: " + appRemoteContent); - consoleDebug("AHT: setButtonIcon: options.tempRemoteContent: " + options.tempRemoteContent); - - switch (options.buttonHtmlMode) { - case "buttonMode_html": - if((appRemoteContent == true) || (options.tempRemoteContent == true)) { - consoleDebug("AHT: setButtonIcon: html+"); - buttonIcon.path = "../icons/aht_button_supernova_color_plus.svg"; - buttonLabel.label = messenger.i18n.getMessage("button_label_html"); - break; - } else { - consoleDebug("AHT: setButtonIcon: html"); - buttonIcon.path = "../icons/aht_button_supernova_color.svg"; - buttonLabel.label = messenger.i18n.getMessage("button_label_html"); - break; - } - case "buttonMode_sanitized": - consoleDebug("AHT: setButtonIcon: sanitized"); - buttonIcon.path = "../icons/aht_button_supernova_sanitized.svg"; - buttonLabel.label = messenger.i18n.getMessage("button_label_sanitized"); - break; - case "buttonMode_plaintext": - consoleDebug("AHT: setButtonIcon: plaintext"); - buttonIcon.path = "../icons/aht_button_supernova_plaintext.svg"; - buttonLabel.label = messenger.i18n.getMessage("button_label_plaintext"); - break; - default: - consoleDebug("AHT: setButtonIcon: default"); - buttonIcon.path = "../icons/aht_button_supernova_color.svg"; - buttonLabel.label = messenger.i18n.getMessage("button_label_html"); - break; - } - - messenger.browserAction.setIcon(buttonIcon); - messenger.browserAction.setLabel(buttonLabel); - messenger.messageDisplayAction.setIcon(buttonIcon); - messenger.messageDisplayAction.setLabel(buttonLabel); -} - -function enableButtons(tabId) { - messenger.messageDisplayAction.enable(tabId); - messenger.browserAction.enable(tabId); -} - -function disableButtons(tabId) { - messenger.messageDisplayAction.disable(tabId); - messenger.browserAction.disable(tabId); -} - -async function setCommandKey() { - await reloadOption("commandKey"); - consoleDebug("AHT: setCommandKey: options.commandKey: " + options.commandKey); - - let detail = {}; - detail.name = "_execute_message_display_action"; - detail.shortcut = options.commandKey; - if(detail.shortcut === "") { - consoleDebug("AHT: setCommandKey: Your chosen commandkey is empty. Therefore the default \"" + DefaultOptions.commandKey + "\" will be used."); - detail.shortcut = DefaultOptions.commandKey; - } - try { - await messenger.commands.update(detail); - } catch (e) { - consoleDebug("AHT: setCommandKey: Your chosen commandkey isn't valid. Therefore the default \"" + DefaultOptions.commandKey + "\" will be used."); - detail.shortcut = DefaultOptions.commandKey; - await messenger.commands.update(detail); - // Reset option to default - return messenger.storage.local.remove("commandKey").then(() => { - }); - } -} - -registerListeners(); -setButtonIconAndLabel(); -setCommandKey(); \ No newline at end of file +// Enable if action buttons +// - if message is not Junk +// - if message is not News +// - if message has an HTML MIME part +async function updateActionButtonForNewMessages(tab, messages) { + // messages is technically an array of objects, which in theory should only + // have one object at this point. Nevertheless we need to recursively handle this array. + for (let i = 0; i < messages.length; i++){ + consoleDebug("AHT: updateActionButtonForNewMessages: messages Array i = " + i); + + let message = messages[i]; + + consoleDebug("AHT: updateActionButtonForNewMessage: tab.id = " + tab.id + " message.id = " + message.id); + + // check for folder type and don't enable UI for junk folders + consoleDebug("AHT: updateActionButtonForNewMessage: folder type = " + message.folder.type); + if (message.folder.type == "junk") { + messenger.messageDisplayAction.disable(tab.id); + return; + } + // check for junk status and don't enable UI for junk messages + consoleDebug("AHT: updateActionButtonForNewMessage: junk status = " + message.junk); + if (message.junk) { + messenger.messageDisplayAction.disable(tab.id); + return; + } + + // check for account type: + // don't enable UI for News accounts, + // but enable UI for RSS accounts + let account = await messenger.accounts.get(message.folder.accountId); + consoleDebug("AHT: updateActionButtonForNewMessage: account type = " + account.type); + if (account.type == "news") { + messenger.messageDisplayAction.disable(tab.id); + return; + } + + if (account.type == "rss") { + consoleDebug("AHT: updateActionButtonForNewMessage: enable toolbar button"); + messenger.messageDisplayAction.enable(tab.id); // Unconditionally for all rss messages? + return; + } + + // for all other messages check, if they have a HTML MIME part + consoleDebug("AHT: updateActionButtonForNewMessage: checkMailForHtmlpart"); + let hasHtmlMimePart = await messenger.allowHtmlTemp.checkMailForHtmlpart(message.id, options.debug); + consoleDebug("AHT: updateActionButtonForNewMessage: checkMailForHtmlpart returns: " + hasHtmlMimePart); + + if (hasHtmlMimePart) { + messenger.messageDisplayAction.enable(tab.id); + } else { + messenger.messageDisplayAction.disable(tab.id); + } + } +}; + +async function setButtonIconAndLabel() { + buttonIcon = {}; + buttonLabel = {}; + + await reloadOption("buttonHtmlMode"); + let appRemoteContent = !(await messenger.messageContentPolicy.getCurrent()).disableRemoteContent; + await reloadOption("tempRemoteContent"); + consoleDebug("AHT: setButtonIcon: options.buttonHtmlMode: " + options.buttonHtmlMode); + consoleDebug("AHT: setButtonIcon: pref appRemoteContent: " + appRemoteContent); + consoleDebug("AHT: setButtonIcon: options.tempRemoteContent: " + options.tempRemoteContent); + + switch (options.buttonHtmlMode) { + case "buttonMode_html": + if ((appRemoteContent == true) || (options.tempRemoteContent == true)) { + consoleDebug("AHT: setButtonIcon: html+"); + buttonIcon.path = "../icons/aht_button_supernova_color_plus.svg"; + buttonLabel.label = messenger.i18n.getMessage("button_label_html"); + break; + } else { + consoleDebug("AHT: setButtonIcon: html"); + buttonIcon.path = "../icons/aht_button_supernova_color.svg"; + buttonLabel.label = messenger.i18n.getMessage("button_label_html"); + break; + } + case "buttonMode_sanitized": + consoleDebug("AHT: setButtonIcon: sanitized"); + buttonIcon.path = "../icons/aht_button_supernova_sanitized_lightdarkcss.svg"; + buttonLabel.label = messenger.i18n.getMessage("button_label_sanitized"); + break; + case "buttonMode_plaintext": + consoleDebug("AHT: setButtonIcon: plaintext"); + buttonIcon.path = "../icons/aht_button_supernova_plaintext_lightdarkcss.svg"; + buttonLabel.label = messenger.i18n.getMessage("button_label_plaintext"); + break; + default: + consoleDebug("AHT: setButtonIcon: default"); + buttonIcon.path = "../icons/aht_button_supernova_color.svg"; + buttonLabel.label = messenger.i18n.getMessage("button_label_html"); + break; + } + + messenger.messageDisplayAction.setIcon(buttonIcon); + messenger.messageDisplayAction.setLabel(buttonLabel); +} + +async function setCommandKey() { + await reloadOption("commandKey"); + consoleDebug("AHT: setCommandKey: options.commandKey: " + options.commandKey); + + let detail = {}; + detail.name = "_execute_message_display_action"; + detail.shortcut = options.commandKey; + if (detail.shortcut === "") { + consoleDebug("AHT: setCommandKey: Your chosen commandkey is empty. Therefore the default \"" + DefaultOptions.commandKey + "\" will be used."); + detail.shortcut = DefaultOptions.commandKey; + } + try { + await messenger.commands.update(detail); + } catch (e) { + consoleDebug("AHT: setCommandKey: Your chosen commandkey isn't valid. Therefore the default \"" + DefaultOptions.commandKey + "\" will be used."); + detail.shortcut = DefaultOptions.commandKey; + await messenger.commands.update(detail); + // Reset option to default + return messenger.storage.local.remove("commandKey").then(() => { + }); + } +} + +setButtonIconAndLabel(); +setCommandKey();