I am working on a Spoiler Blocker Chrome extension where user inputs a string in popup.html, presses submit and then js searches for this string (supposedly) in the current tab and if it finds matches then it redacts them.
The issue I am having is that my popup.js which takes care of recording user input in an array only works in the popup.html and does not redact content from the activeTab.
here is my popup.js code
function checkForSpoilers() {
$('*:contains("and")').each(function(){
$element = $(this);
if($element.children().length < 1) {
$element.addClass('spoiled');
if($element.is("strong,span,b,i,em")) {
$element.parent().addClass('spoiled');
}
}
});
}
I am checking for "and" because I also cannot figure out how to use $('*:contains(...) on an array that holds the input value
Here is the code for saving an input into an array
var spoilersArray = [];
function saveInputToArray() {
spoilersArray.push($('input').val());
}
I am very new to JS and I would appreciate any help or direction.