mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 06:18:35 +02:00
Added example for the highlight method. (#126)
* Made corrections about support and code intent
This commit is contained in:
committed by
wbamberg
parent
c42a263968
commit
a3782445bf
@@ -30,7 +30,11 @@
|
||||
|
||||
<a href="#" id="tabs-add-zoom">Zoom in</a><br>
|
||||
<a href="#" id="tabs-default-zoom">Reset zoom</a><br>
|
||||
<a href="#" id="tabs-decrease-zoom">Zoom out</a>
|
||||
<a href="#" id="tabs-decrease-zoom">Zoom out</a><br>
|
||||
|
||||
<div class="panel-section-separator"></div>
|
||||
|
||||
<a href="#" id="tabs-highlight">Highlight (only supported by Chrome)</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -121,6 +121,13 @@ document.addEventListener("click", function(e) {
|
||||
});
|
||||
});
|
||||
}
|
||||
// Currently (11/2/2016) only supported by Chrome
|
||||
else if (e.target.id === "tabs-highlight") { // highlights current tab and next tab (cycles back to first tab if current tab is the last one)
|
||||
callOnActiveTab((tab, tabs) => {
|
||||
next = (tab.index+1) % tabs.length;
|
||||
chrome.tabs.highlight({tabs:[tab.index, next]});
|
||||
});
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user