Skip to content

Commit

Permalink
Fix CSP error for Points Value.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sashank999 committed Nov 13, 2023
1 parent ffe81b2 commit 87a5a12
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 3 additions & 1 deletion extension/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
3 changes: 2 additions & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}" } },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
initializeTooltip(".tt-points-value", "white-tooltip");
11 changes: 10 additions & 1 deletion extension/scripts/features/points-value/ttPointsValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 87a5a12

Please sign in to comment.