~callum/beavers-dam

10ee1dcaf897a6053c9fdafccb402236f2a0a511 — Callum Brown 1 year, 2 months ago 0c5abc4
rename domainsToDam -> dammed
3 files changed, 10 insertions(+), 8 deletions(-)

M content/content.js
M popup/popup.html
M popup/popup.js
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 popup/popup.html => popup/popup.html +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 popup/popup.js => popup/popup.js +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");
	});
};