-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
18 lines (16 loc) · 811 Bytes
/
popup.js
File metadata and controls
18 lines (16 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Communicate with content.js for theme/file actions
document.getElementById('theme-toggle').onclick = () =>
chrome.tabs.query({active:true, currentWindow:true}, tabs =>
chrome.scripting.executeScript({target: {tabId: tabs[0].id}, func: toggleTheme})
);
document.getElementById('file-list').onclick = () =>
chrome.tabs.query({active:true, currentWindow:true}, tabs =>
chrome.scripting.executeScript({target: {tabId: tabs[0].id}, func: listFiles})
);
// Dummy implementations for context. Actual DOM queries go in content.js
function toggleTheme() {}
function listFiles() {}
document.getElementById('theme-dark').onclick = () =>
chrome.tabs.query({active:true, currentWindow:true}, tabs =>
chrome.scripting.executeScript({target: {tabId: tabs[0].id}, func: () => setTheme('dark')})
);