Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
blackstormx committed Aug 1, 2020
1 parent 8a03d54 commit 1ac9610
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
22 changes: 12 additions & 10 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,18 @@ chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, { action: "getBannedSlogans" }, function(
response
) {
let resultContent = "";

if (response.length == 0) {
resultContent = fullDiv("Hooray, no banned words!");
} else {
response.forEach((slogan, i) => {
resultContent += span(span(i + 1) + span(slogan));
});
if (response) {
let resultContent = "";

if (response.length == 0) {
resultContent = fullDiv("Hooray, no banned words!");
} else {
response.forEach((slogan, i) => {
resultContent += span(span(i + 1) + span(slogan));
});
}

bannedSlogansList.innerHTML = resultContent;
}

bannedSlogansList.innerHTML = resultContent;
});
});
11 changes: 6 additions & 5 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ function startScan() {
let doc = domParser.parseFromString(text["*"], "text/html");
parseWikiNodes(doc);
checkNodeRecursively(body);
const observer = new MutationObserver(callback);
observer.observe(body, {
childList: true,
subtree: true
});
});
} else {
checkNodeRecursively(body);
}
const observer = new MutationObserver(callback);
observer.observe(body, {
childList: true,
subtree: true
});

function checkNode(startNode) {
if (startNode.nodeType == Node.TEXT_NODE) {
const value = startNode.nodeValue.toLowerCase();
Expand Down

0 comments on commit 1ac9610

Please sign in to comment.