mirror of
https://gitlab.com/arnekeller/yt-addiction-control.git
synced 2024-11-09 18:30:39 +00:00
14 lines
344 B
JavaScript
14 lines
344 B
JavaScript
|
/**
|
||
|
* Listen for clicks on the buttons, and send the appropriate message to
|
||
|
* the content script in the page.
|
||
|
*/
|
||
|
document.addEventListener("click", (e) => {
|
||
|
function applyChange(tabs) {
|
||
|
browser.tabs.sendMessage(tabs[0].id, {
|
||
|
command: e.target.id
|
||
|
});
|
||
|
}
|
||
|
browser.tabs.query({active: true, currentWindow: true})
|
||
|
.then(applyChange);
|
||
|
});
|