-
Notifications
You must be signed in to change notification settings - Fork 0
/
content.js
34 lines (28 loc) · 820 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
30
31
32
33
34
console.log("EXTENSION IS WORKING");
function changings() {
let elm = 'p,span,h1,h2,h3,h4';
let elements = document.querySelectorAll(elm);
let style = document.getElementsByTagName('style')[0];
if (style == null) {
let st = document.createElement('style');
let head = document.getElementsByTagName('head')[0];
head.appendChild(st);
style = document.getElementsByTagName('style')[0];
}
for (abc of elements) {
abc.innerHTML = 'no siema';
style.innerHTML += `
${elm} {
background-color: firebrick;
color: lightgrey !important;
}
`;
}
}
chrome.runtime.onMessage.addListener(gotMessage);
function gotMessage(message, sender, sendResponse) {
console.log(message.txt);
if (message.txt === "hello") {
changings();
}
}