-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
22 lines (20 loc) · 848 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
document.getElementById('toggle').addEventListener('click', function() {
browser.tabs.query({ active: true, currentWindow: true }, function(tabs) {
// First, get the current status of the plugin
browser.tabs.sendMessage(tabs[0].id, { action: "getPluginStatus" }, function(response) {
if (response && response.isActive) {
browser.tabs.sendMessage(tabs[0].id, { action: "deactivatePlugin" });
} else {
browser.tabs.sendMessage(tabs[0].id, { action: "activatePlugin" });
}
});
});
});
function copyToClipboard(text) {
const textarea = document.createElement('textarea');
textarea.textContent = text;
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
}