Skip to content

Instantly share code, notes, and snippets.

@nash716
Created December 19, 2011 17:04
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 nash716/1497990 to your computer and use it in GitHub Desktop.
Save nash716/1497990 to your computer and use it in GitHub Desktop.
background_pickup.html
<html><head>
<script>
var url = 'http://localhost:12000/#receive';
var type;
chrome.tabs.onUpdated.addListener(function(id, info, tab) { // タブが更新されたときに呼ばれる
if (tab.url.match(url)) {
// 命令部分だけを取り出す
type = JSON.parse(tab.url.substring(url.length + 1)).type;
chrome.tabs.getAllInWindow(null, function(tabs) {
for (var i=0; i<tabs.length; i++) {
// ニコニコ動画を開いているタブを探す
if (tabs[i].url.match('http://www.nicovideo.jp/watch/sm')) {
var tabId = tabs[i].id;
switch(type) {
more...
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment