diff --git a/background.js b/background.js index 4ed16c9..594d83b 100644 --- a/background.js +++ b/background.js @@ -29,10 +29,13 @@ chrome.storage.sync.get("customBanWord", function(items) { }); set.onclick = () => { - chrome.storage.sync.set({ customBanWord: customBanWord.value }, function() { - customBanWord.placeholder = "Current: " + customBanWord.value; - customBanWord.value = ""; - }); + saveNewBanWord(); +}; + +customBanWord.onkeyup = e => { + if (e.keyCode == 13) { + saveNewBanWord(); + } }; customSloganTextbox.onkeyup = e => { @@ -47,6 +50,13 @@ addSlogan.onclick = () => { addNew(); }; +function saveNewBanWord() { + chrome.storage.sync.set({ customBanWord: customBanWord.value }, function() { + customBanWord.placeholder = "Current: " + customBanWord.value; + customBanWord.value = ""; + }); +} + function addNew() { const customSlogan = customSloganTextbox.value.toLowerCase(); if (!customSlogans.includes(customSlogan)) { diff --git a/popup.html b/popup.html index 8526cf3..d039217 100644 --- a/popup.html +++ b/popup.html @@ -41,6 +41,7 @@ } #page1 > .list { height: calc(100% - 80px); + max-height: 340px; } #page2 > .list { height: calc(100% - 220px);