-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
64 lines (57 loc) · 2.64 KB
/
main.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
62
63
64
function pseudo() {
function exportList(fileName, fileContents) {
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:attachment/text,' + encodeURI(fileContents);
hiddenElement.target = '_blank';
hiddenElement.download = fileName + '.txt';
hiddenElement.click();
console.debug(fileContents);
}
function gmeet() {
var current = new Date();
fileName = '[GMEET] ' + current.toLocaleDateString().replaceAll('/', '-') + ' ' + current.toLocaleTimeString();
fileContents = `[${current.toLocaleString()}] [${document.location.href}]\n\nParticipants:\n`
let button = document.querySelector("#ow3 > div.T4LgNb > div > div:nth-child(12) > div.crqnQb > div.UnvNgf.Sdwpn.P9KVBf.IYIJAc.BIBiNe > div.jsNRx > div.fXLZ2 > div > div > div:nth-child(2) > span > button")
button.click()
setTimeout(function () {
for (i = 1; i < 5000; i++) {
try {
userName = document.querySelector(`#ow3 > div.T4LgNb > div > div:nth-child(12) > div.crqnQb > div.R3Gmyc.qwU8Me > div.WUFI9b > div.hWX4r > div.ggUFBf.Ze1Fpc > div.m3Uzve.RJRKn > div > div:nth-child(${i}) > div.SKWIhd > div.zSX24d > div`).textContent
fileContents += `${i}. ` + userName + "\n";
} catch {
break;
}
}
exportList(fileName, fileContents);
}, 1000);
}
function zoom() {
var current = new Date();
fileName = '[ZOOM] ' + current.toLocaleDateString().replaceAll('/', '-') + ' ' + current.toLocaleTimeString();
fileContents = `[${current.toLocaleString()}] [${document.location.href}]\n\nParticipants:\n`
for (i = 0; i < 5000; i++) {
try {
userName = document.querySelector(`#participants-list-${i} > div > div.participants-item__left-section > span > span.participants-item__display-name`).textContent
fileContents += `${i + 1}. ` + userName + "\n";
} catch {
break;
}
}
exportList(fileName, fileContents);
}
if (document.location.href.includes('meet.google.com')) {
gmeet();
}
else if (document.location.href.includes('.zoom.')) {
zoom();
}
}
chrome.action.onClicked.addListener((tab) => {
if (tab.url.includes("meet.google.com") || tab.url.includes(".zoom.")) {
console.debug("ZOOM/GMEET Export")
chrome.scripting.executeScript({
target: { tabId: tab.id },
function: pseudo
});
}
});