-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcontent.js
29 lines (24 loc) · 925 Bytes
/
content.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function isSiteWhitelisted(url, whitelist) {
return whitelist.some(site => url.includes(site));
}
function startCensorship() {
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
const currentTabUrl = tabs[0].url;
chrome.storage.sync.get(['whitelistedSites'], function(result) {
const whitelistedSites = result.whitelistedSites || [];
const isWhitelisted = isSiteWhitelisted(currentTabUrl, whitelistedSites);
if (!isWhitelisted) {
fetchCussWords().then(() => {
chrome.storage.local.get(['extensionActive'], function(result) {
if (result.extensionActive !== false) {
traverseAndBlur(document.body);
}
});
});
} else {
console.log('This site is whitelisted. Censorship is skipped.');
}
});
});
}
startCensorship();