diff --git a/extension/changelog.json b/extension/changelog.json index 70a22f1d5..5393f4967 100644 --- a/extension/changelog.json +++ b/extension/changelog.json @@ -3,7 +3,9 @@ "version": { "major": 6, "minor": 21, "build": 0 }, "title": "Beta", "date": false, - "logs": { "features": [], "fixes": [], "changes": [], "removed": [] } + "logs": { "features": [], "fixes": [ + { "message": "Fix CSP error for Points Value.", "contributor": "TheFoxMan" } + ], "changes": [], "removed": [] } }, { "version": { "major": 6, "minor": 20, "build": 0 }, diff --git a/extension/manifest.json b/extension/manifest.json index a219ae8ef..8763de972 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -41,7 +41,8 @@ "scripts/background.js", "scripts/*.inject.js", "scripts/features/no-confirm/*.inject.js", - "vendor/*" + "vendor/*", + "scripts/features/points-value/ttPointsValue.inject.js" ], "options_ui": { "page": "pages/settings/settings.html", "open_in_tab": true }, "browser_specific_settings": { "gecko": { "id": "{3754707b-1aa4-4c6f-96e7-5b1cdc1de5f9}" } }, diff --git a/extension/scripts/features/points-value/ttPointsValue.inject.js b/extension/scripts/features/points-value/ttPointsValue.inject.js new file mode 100644 index 000000000..76a970fc8 --- /dev/null +++ b/extension/scripts/features/points-value/ttPointsValue.inject.js @@ -0,0 +1 @@ +initializeTooltip(".tt-points-value", "white-tooltip"); diff --git a/extension/scripts/features/points-value/ttPointsValue.js b/extension/scripts/features/points-value/ttPointsValue.js index af629621d..3123ebd85 100644 --- a/extension/scripts/features/points-value/ttPointsValue.js +++ b/extension/scripts/features/points-value/ttPointsValue.js @@ -56,7 +56,16 @@ ); }); - executeScript((wrapped) => wrapped.initializeTooltip(".tt-points-value", "white-tooltip"), "initializeTooltip('.tt-points-value', 'white-tooltip')"); + // New method instead of executeScript() to avoid CSP error. + const scriptEl = document.newElement({ + type: "script", + attributes: { + type: "text/javascript", + src: chrome.runtime.getURL("scripts/features/points-value/ttPointsValue.inject.js") + } + }); + document.head.appendChild(scriptEl); + setTimeout(() => scriptEl.remove(), 2000); } function removeValue() {