This repository was archived by the owner on Jan 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
45 lines (43 loc) · 1.36 KB
/
Copy pathscript.js
File metadata and controls
45 lines (43 loc) · 1.36 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
38
39
40
41
42
43
44
45
chrome.runtime.onMessage.addListener((message, sender) => {
console.log(message);
if (message.from === "popup" && message.query == true){
console.log("calling test")
localStorage.setItem("active", true)
runNotBad("badge")
location.reload()
}
else if(message.from === "popup" && message.query == false){
localStorage.removeItem("active");
runNotBad("remove badge")
}
}
);
if(localStorage.getItem("active") == 'true'){
console.log("working")
let res;
function check(){
console.log("start check")
let el = document.querySelector(".db-new-main-table.align-top.js-db-table tbody")
console.log(el.children[0].children[0].children[0].textContent)
res = el.children[0].children[0].children[0].textContent
if(res !== 'No requests found.'){
runNotBad("notification")
localStorage.removeItem("active");
}
else{
console.log("reaload called")
setTimeout(reaload, 60000)
}
}
setTimeout(check, 2000)
}
function reaload(){
location.reload()
}
console.log("2")
function runNotBad(e){
chrome.runtime.sendMessage(
{ method: e, data: "send from script" },
(res) => {return true;}
);
}