Created
March 12, 2014 07:19
-
-
Save karolmajta/9502296 to your computer and use it in GitHub Desktop.
How to track
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var current = null; | |
chrome.tabs.query({active: true}, function (tabs) { | |
current = tabs[0].id; | |
}) | |
chrome.tabs.onCreated.addListener(function(t) { | |
current = t.id; | |
console.log(current); | |
}); | |
chrome.tabs.onActivated.addListener(function(t) { | |
current = t.tabId; | |
console.log(current); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest_version": 2, | |
"name": "One-click Kittens", | |
"description": "This extension demonstrates a browser action with kittens.", | |
"version": "1.0", | |
"permissions": [ | |
"tabs" | |
], | |
"browser_action": { | |
"default_icon": "favicon.png", | |
"default_popup": "popup.html" | |
}, | |
"background": { | |
"scripts": ["background.js"] | |
}, | |
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<script src="popup.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.write(chrome.extension.getBackgroundPage().current); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment