Skip to content

Commit

Permalink
Update background.js
Browse files Browse the repository at this point in the history
  • Loading branch information
blackstormx committed Jul 29, 2020
1 parent f19e0fc commit 893b080
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// console.log(request);
// sendResponse({ farewell: "goodbye" });
// });

let customSlogans = [];

chrome.storage.sync.get("savedCustomSlogans", function(items) {
Expand Down Expand Up @@ -39,10 +40,27 @@ function updateUserBannedList(filter) {
userBannedSlogansList.innerHTML = "";
customSlogans.forEach((slogan, i) => {
if (slogan.includes(filter)) {
let sloganDOM = span(span(i + 1) + span(slogan) + button(i, "-"));
let sloganDOM = span(
span(i + 1) + span(slogan) + button("removeSlogan-" + i, "-")
);
userBannedSlogansList.innerHTML += sloganDOM;
}
});
setTimeout(() => {
for (let i = 0; i < customSlogans.length; i++) {
let button = document.getElementById("removeSlogan-" + i);
button.name = i;
button.addEventListener("click", e => {
customSlogans.splice(i, 1);
chrome.storage.sync.set(
{ savedCustomSlogans: customSlogans },
function() {
updateUserBannedList(customSloganTextbox.value);
}
);
});
}
});
}

page2btn.onclick = () => {
Expand Down

0 comments on commit 893b080

Please sign in to comment.