Skip to content
This repository was archived by the owner on Feb 9, 2020. It is now read-only.

Commit a219e1c

Browse files
committed
feat(pageAction): show page action when instrumentation is active
Closes #199
1 parent 68b72bf commit a219e1c

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

background.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ function bufferOrForward(message, sender) {
1111

1212
if (!data[tabId] || message === 'refresh') {
1313
resetState(tabId);
14+
15+
// TODO: this is kind of a hack-y spot to put this
16+
showPageAction(tabId);
1417
}
1518

1619
// TODO: not sure how I feel about special-casing `refresh`
@@ -97,3 +100,12 @@ chrome.tabs.onRemoved.addListener(function (tabId) {
97100
delete data[tabId];
98101
}
99102
});
103+
104+
105+
function showPageAction(tabId) {
106+
chrome.pageAction.show(tabId);
107+
chrome.pageAction.setTitle({
108+
tabId: tabId,
109+
title: 'Batarang Active'
110+
});
111+
}

img/icon19.png

3.82 KB
Loading

img/icon38.png

5.95 KB
Loading

manifest.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,30 @@
88
"tabs",
99
"<all_urls>"
1010
],
11+
1112
"content_scripts": [
1213
{
1314
"matches": ["<all_urls>"],
1415
"js": ["inject.js"],
1516
"run_at": "document_start"
1617
}
1718
],
19+
1820
"background": {
1921
"scripts": [
2022
"background.js"
2123
]
2224
},
25+
26+
"page_action": {
27+
"default_icon": {
28+
"19": "img/icon19.png",
29+
"38": "img/icon38.png"
30+
},
31+
32+
"default_title": "AngularJS Super-Powered"
33+
},
34+
2335
"web_accessible_resources": [
2436
"dist/hint.js"
2537
],

0 commit comments

Comments
 (0)