diff --git a/.eslintrc b/.eslintrc index 8ed12dd..e361a86 100644 --- a/.eslintrc +++ b/.eslintrc @@ -10,7 +10,7 @@ "env": { "browser": true, "webextensions": true, - "es6": true + "es2021": true }, "extends": "eslint:recommended", "rules": { diff --git a/scripts/manifests/chromemanifest.json b/scripts/manifests/chromemanifest.json index cf69111..5dbdbc7 100644 --- a/scripts/manifests/chromemanifest.json +++ b/scripts/manifests/chromemanifest.json @@ -1,6 +1,6 @@ { "manifest_version": 2, - "name": "Unicodify DEV VERSION", + "name": "__MSG_extensionName__", "short_name": "__MSG_extensionNameShort__", "version": "0.1", "author": "Teal Dulcet, rugk", diff --git a/scripts/manifests/thunderbirdmanifest.json b/scripts/manifests/thunderbirdmanifest.json index 1de1d40..a7974b0 100644 --- a/scripts/manifests/thunderbirdmanifest.json +++ b/scripts/manifests/thunderbirdmanifest.json @@ -36,6 +36,7 @@ "permissions": [ "storage", + "", "tabs", "compose", "menus" diff --git a/src/background/modules/AutocorrectHandler.js b/src/background/modules/AutocorrectHandler.js index bb0326e..4e32109 100644 --- a/src/background/modules/AutocorrectHandler.js +++ b/src/background/modules/AutocorrectHandler.js @@ -18,7 +18,7 @@ let autocorrections = {}; let longest = 0; let symbolpatterns = []; -// Do not autocorrect for these patterns +// Exceptions, do not autocorrect for these patterns let antipatterns = []; // Chrome @@ -48,13 +48,10 @@ function applySettings() { } console.log("Longest autocorrection", longest); - symbolpatterns = []; // Escape special characters const regExSpecialChars = /[.*+?^${}()|[\]\\]/g; - for (const symbol in autocorrections) { - symbolpatterns.push(symbol.replace(regExSpecialChars, "\\$&")); - } + symbolpatterns = Object.keys(autocorrections).map((symbol) => symbol.replace(regExSpecialChars, "\\$&")); // Do not autocorrect for these patterns antipatterns = []; @@ -87,9 +84,7 @@ function applySettings() { antipatterns = antipatterns.filter((item, pos) => antipatterns.indexOf(item) === pos); console.log("Do not autocorrect for these patterns", antipatterns); - for (const [index, symbol] of antipatterns.entries()) { - antipatterns[index] = symbol.replace(regExSpecialChars, "\\$&"); - } + antipatterns = antipatterns.map((symbol) => symbol.replace(regExSpecialChars, "\\$&")); symbolpatterns = new RegExp(`(${symbolpatterns.join("|")})$`); antipatterns = new RegExp(`(${antipatterns.join("|")})$`); diff --git a/src/background/modules/ContextMenu.js b/src/background/modules/ContextMenu.js index 692b88e..ea6ee80 100644 --- a/src/background/modules/ContextMenu.js +++ b/src/background/modules/ContextMenu.js @@ -64,7 +64,7 @@ async function handleMenuShown(info) { // shorten preview text as it may not be shown anyway if (text.length > PREVIEW_STRING_CUT_LENGTH) { // to be sure, we append … anyway, in case some strange OS has a tooltip for context menus or so - text = `${text.substr(0, PREVIEW_STRING_CUT_LENGTH)}…`; + text = `${text.substring(0, PREVIEW_STRING_CUT_LENGTH)}…`; } text = text.normalize(); diff --git a/src/content_scripts/autocorrect.js b/src/content_scripts/autocorrect.js index 741b368..1fa9d3b 100644 --- a/src/content_scripts/autocorrect.js +++ b/src/content_scripts/autocorrect.js @@ -44,7 +44,7 @@ let longest = 0; // Regular expressions let symbolpatterns = null; -// Do not autocorrect for these patterns +// Exceptions, do not autocorrect for these patterns let antipatterns = null; // Thunderbird