Skip to content

Commit

Permalink
Merge pull request #19 from richardfrost/fix_beam_pro
Browse files Browse the repository at this point in the history
Only search text inside Body tag
  • Loading branch information
richardfrost authored Feb 23, 2017
2 parents 85cd702 + d916130 commit 4131898
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ function generateProfanityList() {
// Remove the profanity from the document
function removeProfanity() {
var evalResult = document.evaluate(
'.//text()[normalize-space(.) != ""]',
'//body//text()[normalize-space(.) != ""]',
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null
);

for (var i = 0; i < evalResult.snapshotLength; i++) {
var textNode = evalResult.snapshotItem(i);
for (var z = 0; z < profanityList.length; z++) {
Expand All @@ -51,15 +51,15 @@ function removeProfanity() {
// Remove the profanity from the node
function removeProfanityFromNode(event) {
var node = event.target;

var evalResult = document.evaluate(
'.//text()[normalize-space(.) != ""]',
node,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null
);

for (var i = 0; i < evalResult.snapshotLength; i++) {
var textNode = evalResult.snapshotItem(i);
for (var z = 0; z < profanityList.length; z++) {
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"short_name": "Profanity Filter",
"author": "phermium",
"manifest_version": 2,
"version": "0.9.3",
"version": "0.9.4",
"description": "An advanced profanity filter.",
"icons": {
"16": "icons/icon16.png",
Expand Down Expand Up @@ -37,4 +37,4 @@
"all_frames": true
}
]
}
}
8 changes: 4 additions & 4 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function save_options() {
settings.wordList = document.getElementById('wordList').value;
settings.preserveFirst = document.getElementById('preserveFirst').checked;
settings.filterSubstring = document.getElementById('filterSubstring').checked;
settings.showCounter = document.getElementById('showCounter').checked
settings.showCounter = document.getElementById('showCounter').checked;

// Save settings
chrome.storage.sync.set(settings, function() {
Expand Down Expand Up @@ -49,11 +49,11 @@ function toggleProfanity() {
profanityList.style.display = 'block';
document.getElementById('listWarning').style.display = 'none';
document.getElementById('wordList').focus();
document.getElementById('toggleProfanity').textContent = "Hide Profanity List"
document.getElementById('toggleProfanity').textContent = "Hide Profanity List";
} else {
profanityList.style.display = 'none';
document.getElementById('listWarning').style.display = 'block';
document.getElementById('toggleProfanity').textContent = "Modify Profanity List"
document.getElementById('toggleProfanity').textContent = "Modify Profanity List";
}
}

Expand All @@ -72,4 +72,4 @@ document.getElementById('save').addEventListener('click', save_options);
document.getElementById('preserveFirst').addEventListener('click', save_options);
document.getElementById('filterSubstring').addEventListener('click', save_options);
document.getElementById('showCounter').addEventListener('click', save_options);
document.getElementById('default').addEventListener('click', restore_defaults);
document.getElementById('default').addEventListener('click', restore_defaults);

0 comments on commit 4131898

Please sign in to comment.