-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
27 lines (26 loc) · 858 Bytes
/
background.js
File metadata and controls
27 lines (26 loc) · 858 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
// background.js
chrome.action.onClicked.addListener(async (tab) => {
// Execute the content script in the active tab
await chrome.scripting.executeScript({
target: { tabId: tab.id },
function: () => {
// Check if interface exists
const container = document.getElementById('copyButtonContainer');
if (container) {
// Toggle visibility if it exists
if (container.style.display === 'none') {
container.style.display = 'block';
} else {
container.style.display = 'none';
}
} else {
// Call the insertInterface function that's defined in content.js
if (typeof window.insertInterface === 'function') {
window.insertInterface();
} else {
console.error("insertInterface function not found");
}
}
}
});
});