-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
39 lines (32 loc) · 891 Bytes
/
background.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
chrome.tabs.onCreated = () => {
alert("New tab opened");
};
function changer() {
document.querySelector("disabled")[0].backgroundColor = "red";
}
// Reusable functions
function gId(id) {
return document.getElementById(id);
}
function changeBg(id, color) {
gId(id).style.backgroundColor = color;
}
// Style changers
function successGreen() {
changeBg("submit-button", "rgb(0, 189, 0)");
gId("btn-icon").src = "images/tick.svg";
gId("btn-icon").classList = "tick";
}
function failedRed() {
changeBg("submit-button", "red");
gId("submit-button").innerHTML = "!";
}
function loader() {
gId("btn-icon").src = "images/loader.svg";
gId("btn-icon").classList = "tick loader";
}
function initialButtonState() {
gId("btn-icon").src = "images/arrow.svg";
changeBg("submit-button", "blue");
gId("btn-icon").classList = "tick";
}