-
Notifications
You must be signed in to change notification settings - Fork 0
/
contentScript.js
41 lines (36 loc) · 929 Bytes
/
contentScript.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
30
31
32
33
34
35
36
37
38
39
40
41
const method = 2;
if (method === 1) {
const rem = () => {
const unwantedElements = document.querySelectorAll(
"[data-temptation-position]"
);
unwantedElements.forEach((elm) => {
console.debug("Removed: ", elm);
elm.remove();
});
};
const unhideAllElements = () => {
const hiddenItems = document.querySelectorAll("[style]");
Array.prototype.forEach.call(hiddenItems, (elm) => {
elm.style.cssText = elm.style.cssText.replace(/display: none;/g, "");
});
};
const run = () => {
chrome.action.setIcon({ path: "icon.png" });
rem();
unhideAllElements();
};
while (true) {
setTimeout(() => {
run();
}, 1000);
}
}
if (method === 2) {
var s = document.createElement("script");
s.src = chrome.runtime.getURL("script.js");
s.onload = function () {
this.remove();
};
(document.head || document.documentElement).appendChild(s);
}