Skip to content

Commit

Permalink
Fix injection in chrome:// & others
Browse files Browse the repository at this point in the history
  • Loading branch information
sr2echa authored Dec 3, 2023
1 parent 0cf0b40 commit a7179e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion background.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
let extensionStatus = 'on';

chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (tab.url.startsWith("chrome://")) {
// Set extension status to 'off' or prevent script injection
extensionStatus = 'off';
chrome.action.setIcon({ path: "icons/off.png", tabId: tabId });
}
});

// Create context menus on installation
chrome.runtime.onInstalled.addListener(() => {
chrome.contextMenus.create({
Expand Down Expand Up @@ -350,7 +358,7 @@ function showHelpToast() {

const overlay = document.createElement('div');
overlay.id = overlayId;
overlay.innerHTML = `<img src="https://i.imgur.com/qEQuh64.png" style="width: 250px; height: auto;">`;
overlay.innerHTML = `<img src="https://i.imgur.com/qEQuh64.png" style="width: 255px; height: auto;">`;
overlay.style.cssText = 'position: fixed; bottom: 20px; right: 20px; z-index: 9999;';

document.body.appendChild(overlay);
Expand Down
3 changes: 2 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["data/inject/rightclickmenu.js","data/inject/isolated.js", "data/inject/content.js", "data/inject/main.js"]
"exclude_matches": ["*://*.discord.com/*", "*://*.figma.com/*"],
"js": ["data/inject/rightclickmenu.js", "data/inject/isolated.js", "data/inject/content.js", "data/inject/main.js"]
}
],
"commands": {
Expand Down

0 comments on commit a7179e0

Please sign in to comment.