by sequence7 · 6y ago · 0 comments
> The plugin maintains a persistent and customizable list of URLs (keywords) that are used as a 'blacklist' for stripping results.
Could you explain a little more about how the stripping of the 'blacklist' works.
var blacklist = new RegExp('https?:\/\/.*\.(geeksforgeeks|tutorialspoint).*\.*');
function clearURLs(urls) {
var i, j, arr, res, url;
arr = [];
res = document.querySelectorAll('div.rc');
for (i = 0; i < res.length; i++) {
for (j = 0; j < urls.blacklistURLs.length; j++) {
if (res[i].firstChild.firstChild.getAttribute('href').indexOf(urls.blacklistURLs[j]) !== -1) {
arr.push(i);
}
}
}
arr = [...new Set(arr)];
for (i = 0; i < arr.length; i++) {
url = res[arr[i]].firstChild.firstChild.getAttribute('href');
url = 'Wiper blacklisted URL: <a href="' + url + '">' + url + '</a>';
res[arr[i]].parentElement.innerHTML = url;
}
}
browser.storage.local.get('blacklistURLs').then(clearURLs);