Skip to content

Instantly share code, notes, and snippets.

@spidergears
Created July 11, 2016 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spidergears/00df8b825f98aa108ab24818e09f399b to your computer and use it in GitHub Desktop.
Save spidergears/00df8b825f98aa108ab24818e09f399b to your computer and use it in GitHub Desktop.
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.query({}, function(tabs){
for (var i=0; i < tabs.length; i++) {
if (/https?:\/\/www\.youtube\.com/.test(tabs[i].url)) {
chrome.tabs.sendMessage(tabs[i].id, {action: "toggle_playback"}, function(response) {});
}
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment