Skip to content

Commit

Permalink
Merge pull request #24 from fertkir/ref
Browse files Browse the repository at this point in the history
indentation fix
  • Loading branch information
fertkir authored Jun 24, 2021
2 parents 5fb9684 + 6ca9e81 commit 83d824b
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,28 +85,28 @@ chrome.storage.sync.get(["sitesSettings"], function(result) {
}
});

function markTargetWord(str) {
const wordEndingRegex = "[^\\s.?,!:;]*";
let regex = "";
for (let word of targetWord.split(" ")) {
if (language === 'en') {
if (word !== targetWord && PRONOUNS_EN.has(word)) {
continue;
} else if (word.endsWith('y') || word.endsWith('e')) {
word = word.substring(0, word.length - 1);
}
} else if (language === 'es') {
if (word.length > 3) {
word = word.substring(0, word.length - 2);
}
function markTargetWord(str) {
const wordEndingRegex = "[^\\s.?,!:;]*";
let regex = "";
for (let word of targetWord.split(" ")) {
if (language === 'en') {
if (word !== targetWord && PRONOUNS_EN.has(word)) {
continue;
} else if (word.endsWith('y') || word.endsWith('e')) {
word = word.substring(0, word.length - 1);
}
} else if (language === 'es') {
if (word.length > 3) {
word = word.substring(0, word.length - 2);
}
regex += (regex === "" ? "" : "\\s+") + word + wordEndingRegex;
}
return str.replace(new RegExp(regex,"ig"), "*$&*");
regex += (regex === "" ? "" : "\\s+") + word + wordEndingRegex;
}
return str.replace(new RegExp(regex,"ig"), "*$&*");
}

function isWordMarked(str) { return str.indexOf("*") != -1 }
});
function isWordMarked(str) { return str.indexOf("*") != -1 }
});
});

const PRONOUNS_EN = new Set(["sth", "sb", "something", "somebody", "someone"]);

0 comments on commit 83d824b

Please sign in to comment.