-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontentScript.js
More file actions
38 lines (31 loc) · 1.13 KB
/
contentScript.js
File metadata and controls
38 lines (31 loc) · 1.13 KB
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
if(document.querySelector(".popup")) {
let buttonOn = false;
const circle = document.querySelector(".circle");
const button = document.querySelector(".button");
const button1 = document.querySelector(".button1");
button.addEventListener("click", ()=>{
if(!buttonOn){
buttonOn = true;
circle.style.animation = "moveCircleRight 1s forwards";
button.style.animation = "backgroundCycle 1s forwards";
(async () => {
const message = await chrome.runtime.sendMessage({command: "darken"});
})();
}
else {
buttonOn = false;
circle.style.animation = "moveCircleLeft 1s forwards";
button.style.animation = "backgroundDecycle 1s forwards";
(async () => {
const message = await chrome.runtime.sendMessage({command1: "lighten"});
})();
}
})
button1.addEventListener("click", ()=>{
button1.style.animationName='replace';
(async () => {
const message = await chrome.runtime.sendMessage({command2: "picker"});
})();
})
button1.addEventListener('animationend', function() { button1.style.animationName='';});
}