-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpopup.js
More file actions
34 lines (30 loc) · 841 Bytes
/
Copy pathpopup.js
File metadata and controls
34 lines (30 loc) · 841 Bytes
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
let matchedTabs = [];
function isZoomSuccessTab(tab) {
try {
const url = new URL(tab.url);
return url.hostname.endsWith('zoom.us');
} catch (e) {
return false;
}
}
document.getElementById('scanBtn').addEventListener('click', () => {
matchedTabs = [];
document.getElementById('tabList').innerHTML = '';
chrome.tabs.query({}, (tabs) => {
tabs.forEach(tab => {
if (isZoomSuccessTab(tab)) {
matchedTabs.push(tab);
const li = document.createElement('li');
li.textContent = tab.url;
document.getElementById('tabList').appendChild(li);
}
});
});
});
document.getElementById('cleanBtn').addEventListener('click', () => {
matchedTabs.forEach(tab => {
chrome.tabs.remove(tab.id);
});
document.getElementById('tabList').innerHTML = '';
matchedTabs = [];
});