mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 06:18:35 +02:00
Add an item to group the active tab in a new group. (#592)
* Add an item to group the active tab in a new group. * Text update --------- Co-authored-by: rebloor <git@sherpa.co.nz>
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
<a href="#" id="tabs-create">Create a tab</a><br>
|
<a href="#" id="tabs-create">Create a tab</a><br>
|
||||||
<a href="#" id="tabs-remove">Remove active tab</a><br>
|
<a href="#" id="tabs-remove">Remove active tab</a><br>
|
||||||
|
<a href="#" id="tabs-group">Add active tab to a new group</a><br>
|
||||||
|
|
||||||
<div class="panel-section-separator"></div>
|
<div class="panel-section-separator"></div>
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,12 @@ document.addEventListener("click", (e) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (e.target.id === "tabs-group") {
|
||||||
|
callOnActiveTab((tab) => {
|
||||||
|
browser.tabs.group({ tabIds: [tab.id] });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
else if (e.target.id === "tabs-create") {
|
else if (e.target.id === "tabs-create") {
|
||||||
browser.tabs.create({url: "https://developer.mozilla.org/en-US/Add-ons/WebExtensions"});
|
browser.tabs.create({url: "https://developer.mozilla.org/en-US/Add-ons/WebExtensions"});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user