mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-05-05 23:27:50 +02:00
12 lines
305 B
JavaScript
12 lines
305 B
JavaScript
|
|
document.addEventListener("click", function(e) {
|
|
if (!e.target.classList.contains("action")) {
|
|
return;
|
|
}
|
|
|
|
var chosenAction = e.target.textContent;
|
|
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
|
|
chrome.tabs.sendMessage(tabs[0].id, {name: chosenAction});
|
|
});
|
|
});
|