generated from adatechschool/Projet_Collectif_Template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
55 lines (50 loc) · 1.84 KB
/
script.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//on écoute le changement du storage déclenché par le bouton de la popup
chrome.storage.local.onChanged.addListener((changes, local) => {
chrome.storage.local.get('decrease').then((result) => {
if (result.decrease == true) {
decreaseTextSize()
chrome.storage.local.set({'decrease': false})
}
})
chrome.storage.local.get('increase').then((result) => {
if (result.increase == true) {
increaseTextSize()
chrome.storage.local.set({'increase': false})
}
})
})
chrome.storage.local.onChanged.addListener((changes, local) => {
chrome.storage.local.get(["toggle"]).then((result) => {
if (result.toggle == true) {
function appOn() {
document.querySelector("html").style.filter = "invert(1) hue-rotate(180deg)";
let media = document.querySelectorAll("img, picture, video");
media.forEach((mediaItem) => {
mediaItem.style.filter = "invert(1) hue-rotate(180deg)";
})
}
appOn()
} else {
function appOff() {
document.querySelector("html").style.filter = "invert(0) hue-rotate(0deg)";
let media = document.querySelectorAll("img, picture, video");
media.forEach((mediaItem) => {
mediaItem.style.filter = "invert(0) hue-rotate(0deg)";
})
}
appOff()
}
});
})
function decreaseTextSize() {
let texts = document.querySelectorAll("h1, h2, h3, h4, h5, h6, txt, text, p, a, li, td");
for (let i=0 ; i<texts.length ; i++) {
texts[i].style.fontSize = "10px";
}
}
function increaseTextSize() {
let texts = document.querySelectorAll("h1, h2, h3, h4, h5, h6, txt, text, p, a, li, td");
for (let i=0 ; i<texts.length ; i++) {
texts[i].style.fontSize = "20px";
}
}