-
Notifications
You must be signed in to change notification settings - Fork 1
/
popup.js
61 lines (48 loc) · 1.64 KB
/
popup.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
56
57
58
59
60
61
let changeColor=document.getElementById('changeColor');
const d=async ()=>{
let [tab]=await chrome.tabs.query({active:true,currentWindow:true});
chrome.scripting.executeScript({
target:{tabId:tab.id},
function:setPageBackgroundColor,
});
}
d();
changeColor.addEventListener('click',async ()=>{
let [tab]=await chrome.tabs.query({active:true,currentWindow:true});
chrome.scripting.executeScript({
target:{tabId:tab.id},
function:setPageBackgroundColor,
})
})
function setPageBackgroundColor(){
console.log("Here");
chrome.storage.sync.get("color",({color})=>{
document.body.style.backgroundColor=color;
document.body.style.color='pink';
});
const bar=document.body.getElementsByClassName('ytp-progress-bar');
console.log(bar[0]);
const controls=document.body.getElementsByClassName('ytp-left-controls');
const div=document.createElement('div');
div.innerText="SastaNotion";
controls[0].append(div);
bar[0].addEventListener('mousemove',()=>{
const div=document.createElement('div');
// div.style.height='50px';
// div.style.backgroundColor='red';
bar[0].append(div);
console.log("hovering");
})
bar[0].addEventListener('mouseout',()=>{
console.log("hovering");
})
div.addEventListener('click',()=>{
console.log("here2")
console.log(bar[0]);
const time=document.body.getElementsByClassName('ytp-time-current');
console.log(time[0].innerText);
});
}
chrome.storage.sync.get("color",({color})=>{
changeColor.style.backgroundColor=color;
});