mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-27 13:29:34 +07:00
* Add pin sample * Add README.md * Add screenshot sample * Add README.md * Add zoom sample * Add README.md * Add inspector sample * Add README.md * Fix typo * Remove wrapper * Remove inline style * Update api-samples/tabs/pin/README.md Co-authored-by: Joe Medley <jmedley@google.com> * Update api-samples/tabs/screenshot/README.md Co-authored-by: Joe Medley <jmedley@google.com> * Update api-samples/tabs/zoom/README.md Co-authored-by: Joe Medley <jmedley@google.com> * Update api-samples/tabs/zoom/README.md Co-authored-by: Joe Medley <jmedley@google.com> * Update api-samples/tabs/zoom/README.md Co-authored-by: Joe Medley <jmedley@google.com> * Update api-samples/tabs/zoom/README.md Co-authored-by: Joe Medley <jmedley@google.com> * Update api-samples/tabs/inspector/README.md Co-authored-by: Joe Medley <jmedley@google.com> * Update api-samples/tabs/zoom/README.md Co-authored-by: Joe Medley <jmedley@google.com> * Update README * Update for loop * Remove children select * Change selected to active * Fix event listener * Set checkboxs to disabled * Fix layout * Fix wrong input data in create tab function * Update api-samples/tabs/zoom/README.md Co-authored-by: Joe Medley <jmedley@google.com> * Update description * Update description * Update description * Fix typo * Update description * Rename * Fix file name * Update active check box * Update code style * Update api-samples/tabs/zoom/README.md Co-authored-by: Joe Medley <jmedley@google.com> * Update api-samples/tabs/pin/README.md Co-authored-by: Joe Medley <jmedley@google.com> * Update api-samples/tabs/pin/README.md Co-authored-by: Joe Medley <jmedley@google.com> * Apply suggestions from code review Co-authored-by: Joe Medley <jmedley@google.com> * Update api-samples/tabs/inspector/manifest.json Co-authored-by: Joe Medley <jmedley@google.com> * Fix case issues * Update api-samples/tabs/inspector/manifest.json --------- Co-authored-by: Joe Medley <jmedley@google.com> Co-authored-by: Oliver Dunk <oliver@oliverdunk.com>
10 lines
351 B
JavaScript
10 lines
351 B
JavaScript
chrome.commands.onCommand.addListener(async function (command) {
|
|
if (command == 'toggle-pin') {
|
|
// Get the currently selected tab
|
|
const tabs = await chrome.tabs.query({ active: true, currentWindow: true });
|
|
// Toggle the pinned status
|
|
const current = tabs[0];
|
|
chrome.tabs.update(current.id, { pinned: !current.pinned });
|
|
}
|
|
});
|