Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
blackstormx committed Jul 29, 2020
1 parent bdcc260 commit 363697d
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 10 deletions.
28 changes: 25 additions & 3 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -35,7 +57,7 @@ addSlogan.onclick = () => {
updateUserBannedList("");
});
}
};
}

function updateUserBannedList(filter) {
filter = filter.toLowerCase();
Expand Down
Binary file added icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file renamed logo.png → icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
35 changes: 29 additions & 6 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down Expand Up @@ -117,6 +117,7 @@
display: flex;
margin-left: 15px;
margin-bottom: 10px;
margin-top: 10px;
}
.textbox input {
background: rgb(241, 241, 241);
Expand All @@ -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);
}
</style>
<body>
<div class="container" id="container">
Expand All @@ -145,6 +158,16 @@
</div>
<div id="page2" class="page">
<button id="s_page1" class="pageBtn">Go back</button>
<span class="h">Replacement word: </span>
<span class="textbox">
<input
type="text"
id="customBanWord"
placeholder="*Banned by StopSlogan*"
/>
<button id="set">Set</button>
</span>

<span class="h">Add your own banned slogans: </span>
<span class="textbox">
<input type="text" id="customSlogan" placeholder="Type to search" />
Expand Down

0 comments on commit 363697d

Please sign in to comment.