-
Notifications
You must be signed in to change notification settings - Fork 22
/
popup.js
40 lines (37 loc) · 1.67 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
chrome.tabs.executeScript(null, {
file: 'check_if_in_meeting.js'
});
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');
} else {
document.getElementById('noOfParticipant').innerHTML = request.noOfParticipants;
document.getElementById('requiredParticipantToExit').value = Math.round(request.noOfParticipants/2);
document.getElementById('confirm').addEventListener('click', () => {
const requiredParticipantToExit = document.getElementById('requiredParticipantToExit').value;
document.querySelector('.meet').classList.add('hide');
document.querySelector('.running').classList.remove('hide');
chrome.tabs.executeScript(null, {
code: 'localStorage.setItem("running", true);'
});
chrome.tabs.executeScript(null, {
code: `localStorage.setItem("requiredParticipantToExit", ${requiredParticipantToExit});`
});
chrome.tabs.executeScript(null, {
file: "exitMeet.js"
})
});
}
} else {
document.querySelector('.meet').classList.add('hide');
document.querySelector('.nomeet').classList.remove('hide');
}
});
document.querySelector('.cancelButton').addEventListener('click', () => {
chrome.tabs.executeScript(null, {
code: 'localStorage.removeItem("running");'
});
window.close();
});