diff --git a/background.js b/background.js index fdd9819..4ed16c9 100644 --- a/background.js +++ b/background.js @@ -21,11 +21,33 @@ const container = document.getElementById("container"); const customSloganTextbox = document.getElementById("customSlogan"); const addSlogan = document.getElementById("add"); -customSloganTextbox.onkeyup = () => { - updateUserBannedList(customSloganTextbox.value); +const customBanWord = document.getElementById("customBanWord"); +const set = document.getElementById("set"); + +chrome.storage.sync.get("customBanWord", function(items) { + customBanWord.placeholder = "Current: " + items.customBanWord; +}); + +set.onclick = () => { + chrome.storage.sync.set({ customBanWord: customBanWord.value }, function() { + customBanWord.placeholder = "Current: " + customBanWord.value; + customBanWord.value = ""; + }); +}; + +customSloganTextbox.onkeyup = e => { + if (e.keyCode == 13) { + addNew(); + } else { + updateUserBannedList(customSloganTextbox.value); + } }; addSlogan.onclick = () => { + addNew(); +}; + +function addNew() { const customSlogan = customSloganTextbox.value.toLowerCase(); if (!customSlogans.includes(customSlogan)) { customSlogans.push(customSlogan); @@ -35,7 +57,7 @@ addSlogan.onclick = () => { updateUserBannedList(""); }); } -}; +} function updateUserBannedList(filter) { filter = filter.toLowerCase(); diff --git a/icon128.png b/icon128.png new file mode 100644 index 0000000..cb2e0fe Binary files /dev/null and b/icon128.png differ diff --git a/logo.png b/icon16.png similarity index 91% rename from logo.png rename to icon16.png index 546064e..5623b6c 100644 Binary files a/logo.png and b/icon16.png differ diff --git a/icon48.png b/icon48.png new file mode 100644 index 0000000..c492ee3 Binary files /dev/null and b/icon48.png differ diff --git a/manifest.json b/manifest.json index b144788..47f4155 100644 --- a/manifest.json +++ b/manifest.json @@ -14,5 +14,10 @@ "browser_action": { "default_popup": "popup.html" }, - "permissions": ["activeTab", "storage"] + "permissions": ["activeTab", "storage"], + "icons": { + "16": "icon16.png", + "48": "icon48.png", + "128": "icon128.png" + } } diff --git a/popup.html b/popup.html index c7401be..8526cf3 100644 --- a/popup.html +++ b/popup.html @@ -35,21 +35,21 @@ .h { color: whitesmoke; font-size: 0.8em; - margin-bottom: 10px; - display: inline-block; - padding: 0 15px; + display: block; + padding: 10px 15px; + background: rgb(0, 0, 0); } #page1 > .list { height: calc(100% - 80px); } #page2 > .list { - height: calc(100% - 120px); + height: calc(100% - 220px); } .list { overflow: auto; max-height: 200px; font-size: 0.75em; - min-height: 20px; + min-height: 50px; margin-bottom: 10px; } .list > span { @@ -64,7 +64,7 @@ display: inline-block; } .list > span:nth-child(2n) { - background: rgb(34, 34, 34); + background: rgb(46, 46, 49); } .list > span > span:first-child { flex-shrink: 0; @@ -117,6 +117,7 @@ display: flex; margin-left: 15px; margin-bottom: 10px; + margin-top: 10px; } .textbox input { background: rgb(241, 241, 241); @@ -133,6 +134,18 @@ outline: none; font-size: 20px; } + #customBanWord { + width: 180px; + } + #set { + font-size: 0.9em; + background: rgb(250, 225, 83); + color: rgb(51, 51, 51); + } + #set:hover { + color: black; + background: rgb(180, 159, 38); + }
@@ -145,6 +158,16 @@
+ Replacement word: + + + + + Add your own banned slogans: