Skip to content

Commit

Permalink
Merge pull request #5 from hawkeyexl/next
Browse files Browse the repository at this point in the history
1.3.1:
- Fix for initial settings on extension install
- Fix for SVG background colors
  • Loading branch information
hawkeyexl authored Jan 9, 2023
2 parents fb3265c + 22b38d3 commit d83f9de
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
15 changes: 11 additions & 4 deletions src/background-manifestv2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
var browser = require("webextension-polyfill");

// On extension install/update
browser.runtime.onInstalled.addListener((details) => {
if (details.reason == "install") {
setDefaultOptions();
}
});

// On extension button click (Firefox - Manifest v2)
browser.browserAction.onClicked.addListener((tab) => insertDialog(tab));

Expand Down Expand Up @@ -43,7 +50,7 @@ async function setDefaultOptions() {
modeDisallowedIDs: "exact",
modeDisallowedClasses: "exact",
modeDisallowedTags: "exact",
modeDisallowedAttributes: "exact"
modeDisallowedAttributes: "exact",
});
}
}
Expand All @@ -52,11 +59,11 @@ function insertDialog(tab) {
// Inject dialog CSS
browser.scripting.insertCSS({
target: { tabId: tab.id },
files: ['dialog.css']
files: ["dialog.css"],
});
// Create or remove dialog
browser.scripting.executeScript({
target: { tabId: tab.id },
files: ['dialog.js']
files: ["dialog.js"],
});
}
}
14 changes: 9 additions & 5 deletions src/background-manifestv3.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
var browser = require("webextension-polyfill");

// On extension install/update
browser.runtime.onInstalled.addListener(setDefaultOptions());
browser.runtime.onInstalled.addListener((details) => {
if (details.reason == "install") {
setDefaultOptions();
}
});

// On extension button click (Chrome - Manifest v3)
browser.action.onClicked.addListener((tab) => insertDialog(tab));
Expand Down Expand Up @@ -46,7 +50,7 @@ async function setDefaultOptions() {
modeDisallowedIDs: "exact",
modeDisallowedClasses: "exact",
modeDisallowedTags: "exact",
modeDisallowedAttributes: "exact"
modeDisallowedAttributes: "exact",
});
}
}
Expand All @@ -55,11 +59,11 @@ function insertDialog(tab) {
// Inject dialog CSS
browser.scripting.insertCSS({
target: { tabId: tab.id },
files: ['dialog.css']
files: ["dialog.css"],
});
// Create or remove dialog
browser.scripting.executeScript({
target: { tabId: tab.id },
files: ['dialog.js']
files: ["dialog.js"],
});
}
}
15 changes: 11 additions & 4 deletions src/dialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
margin: 0 20px 0 8px;
}

#doc-detective button svg {
color: black;
}

#doc-detective .settings {
margin: auto 2px auto auto;
height: 18px;
Expand All @@ -60,6 +64,10 @@
padding: 0;
}

#doc-detective .settings svg {
background-color: white;
}

#doc-detective .copy {
position: absolute;
margin: auto 0;
Expand All @@ -70,7 +78,6 @@
padding: 0;
}

#doc-detective button svg {
color: black;
background-color: white;
}
#doc-detective .copy svg {
background-color: #efefef;
}

0 comments on commit d83f9de

Please # to comment.