M content/content.js => content/content.js +2 -2
@@ 34,9 34,9 @@ const dam = () => {
chrome.storage.sync.get(
- { domainsToDam: [] },
+ { dammed: [] },
).then((options) => {
- if (options.domainsToDam.includes(location.hostname)) {
+ if (options.dammed.includes(location.hostname)) {
dam();
}
});
M => +2 -2
@@ 5,9 5,9 @@
</head>
<body>
<h1>Beaver's Dam</h1>
<label for="domains-to-dam">List of domains to dam</label>
<label for="dammed">Dammed sites:</label>
<br>
<textarea id="domains-to-dam"></textarea>
<textarea id="dammed"></textarea>
<div id="status"></div>
<button id="save">Save</button>
<br>
M => +6 -4
@@ 1,10 1,11 @@
// Modified from https://developer.chrome.com/docs/extensions/mv3/options/
const textarea = document.getElementById("domains-to-dam");
const textarea = document.getElementById("dammed");
const saveSettings = () => {
chrome.storage.sync.set(
{ domainsToDam: textarea.value.split("\n") }
{ dammed: textarea.value.split("\n") }
).then(() => {
const saveStatus = document.getElementById("status");
saveStatus.textContent = "Saved.";
@@ 14,11 15,12 @@ const saveSettings = () => {
});
};
const restoreSettings = () => {
chrome.storage.sync.get(
{ domainsToDam: [] },
{ dammed: [] },
).then((settings) => {
textarea.value = settings.domainsToDam.join("\n");
textarea.value = settings.dammed.join("\n");
});
};