diff options
author | Nick White <git@njw.me.uk> | 2011-05-21 12:54:14 +0100 |
---|---|---|
committer | Nick White <git@njw.me.uk> | 2011-05-21 12:54:14 +0100 |
commit | bf340e9f5ed22058877af1878c85c16de1dd8904 (patch) | |
tree | fb1f1cd1ba6d4331645df8ce455b67e91e3ca3ae /chromium/background.html | |
parent | 4cdb10438dad3fd4b9ecc8ef96538f4219b42e5e (diff) |
Make chromium extension a page action
Diffstat (limited to 'chromium/background.html')
-rw-r--r-- | chromium/background.html | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/chromium/background.html b/chromium/background.html index 5343f46..7850bd2 100644 --- a/chromium/background.html +++ b/chromium/background.html @@ -1,5 +1,13 @@ <html><head><script> - chrome.browserAction.onClicked.addListener(function(tab) { - chrome.tabs.executeScript(null, {code:"simplyread();"}); + function onRequest(request, sender, sendResponse) { + chrome.pageAction.show(sender.tab.id); + sendResponse({}); + }; + + /* called on page load if viable */ + chrome.extension.onRequest.addListener(onRequest); + + chrome.pageAction.onClicked.addListener(function(tab) { + chrome.tabs.executeScript(tab.id, {code:"simplyread();"}); }); </script></head></html> |