@@ 1,3 1,5 @@
+const MINWORDS = 3;
+
const save = (text) => {
chrome.storage.local.get(
{ entries: [] }
@@ 54,7 56,7 @@ const dam = () => {
let saveAndContinue = document.createElement("button");
saveAndContinue.textContent = `Save & Continue to ${location.hostname}`;
saveAndContinue.addEventListener("click", () => {
- if (textarea.value.length > 0) {
+ if (textarea.value.trim().split(" ").length >= MINWORDS) {
save(textarea.value);
dam.remove();
// Check if this host has been set to be undammed in popup.js
@@ 64,7 66,7 @@ const dam = () => {
}
}).then(() => chrome.storage.local.set({ undam: null }));
} else {
- window.alert("Please write in your journal.");
+ window.alert(`Please write at least ${MINWORDS} words.`);
}
});
dam.append(saveAndContinue)