-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontentScript.js
50 lines (43 loc) · 1.31 KB
/
contentScript.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
var add_disco = setInterval(function (){
if(document.body.contains(document.getElementsByClassName('NzPR9b')[0])){
// console.log('YEEEEEEEEEE')
stopInterval();
addDisco();
}
},3000)
function stopInterval(){
clearInterval(add_disco);
}
function addDisco(){
main = document.getElementsByClassName('NzPR9b')[0];
disco = document.createElement("div");
disco.id="celebratern"
disco.innerHTML = "🎉"
disco.style.fontSize = "30px"
disco.style.padding = "5px"
disco.style.marginLeft = "10px"
main.insertBefore(disco,main.childNodes[0])
disco.addEventListener("click", poof)
}
function poof(){
// console.log('poof')
// const poofpoof = chrome.tabs.executeScript({
// file: 'celebrate.js'
// });
// poofpoof.then(onexecuted, onerror)
chrome.runtime.sendMessage({type: "notification", options: {
type: "basic",
title: "Test",
message: "Test"
}});
}
function onExecuted(result) {
console.log(`We made it `);
}
function onError(error) {
console.log(`Error: ${error}`);
}
chrome.extension.sendMessage({}, function(response) {
//code to initialize my extension
});
//code to send message to open notification. This will eventually move into my extension logic