-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
53 lines (46 loc) · 2.01 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
//for check wheather meet is ongoing or not
chrome.tabs.executeScript(null, {
file: 'check_meet.js'
});
//receive msg from check_meet.js file
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
if (request.meet) {
if (request.running) {
document.querySelector('.meet').classList.add('hide');
document.querySelector('.running').classList.remove('hide');
if(request.goalset){
console.log("SetMembers: ", request.setMembers);
document.getElementById('exitnumber').innerHTML = request.setMembers;
}
} else {
console.log("Member in meeting is :-", request.incallmember);
document.getElementById('noOfParticipant').innerHTML = request.incallmember;
document.getElementById('requiredParticipantToExit').value = Math.round(request.incallmember / 4);
document.getElementById('confirm').addEventListener('click', () => {
const setMembers = document.getElementById('requiredParticipantToExit').value;
// console.log("SetMembers: ", setMembers);
chrome.tabs.executeScript(null, {
code: 'localStorage.setItem("running",true);'
})
chrome.tabs.executeScript(null, {
code: 'localStorage.setItem("goalset",true);'
})
chrome.tabs.executeScript(null, {
code: `localStorage.setItem("setMembers",${setMembers});`
})
chrome.tabs.executeScript(null, {
file: "leave.js"
})
});
}
} else {
document.querySelector('.meet').classList.add('hide');
console.log("Meeting Has Not Started");
}
});
document.querySelector('.cancelButton').addEventListener('click', () => {
chrome.tabs.executeScript(null, {
code: 'localStorage.removeItem("running");'
});
window.close();
});