Skip to content

Commit 27740cd

Browse files
committed
Add browser action to open options page
1 parent b465313 commit 27740cd

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

alternates/firefox-manifest.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,25 @@
2121
"96": "icons/96.png",
2222
"128": "icons/128.png"
2323
},
24+
25+
"browser_action": {
26+
"default_icon": {
27+
"16": "icons/16.png",
28+
"32": "icons/32.png",
29+
"48": "icons/48.png",
30+
"64": "icons/64.png",
31+
"96": "icons/96.png",
32+
"128": "icons/128.png"
33+
}
34+
},
2435

2536
"omnibox": {
2637
"keyword" : "s"
2738
},
2839

2940
"background": {
3041
"scripts": [
42+
"background/browserAction.js",
3143
"background/omnibox.js",
3244
"background/contextMenus.js"
3345
]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
chrome.browserAction.onClicked.addListener(()=>{
3+
chrome.tabs.query({
4+
currentWindow: true,
5+
active: true
6+
}, function(tabs) {
7+
if (tabs.length == 0) {
8+
return;
9+
}
10+
11+
let tab = tabs[0];
12+
chrome.tabs.create({url: 'options/options.html', index: tab.index + 1});
13+
});
14+
});

extension/manifest.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
"96": "icons/96.png",
1616
"128": "icons/128.png"
1717
},
18+
19+
"browser_action": {
20+
"default_icon": {
21+
"16": "icons/16.png",
22+
"32": "icons/32.png",
23+
"48": "icons/48.png",
24+
"64": "icons/64.png",
25+
"96": "icons/96.png",
26+
"128": "icons/128.png"
27+
}
28+
},
1829

1930
"omnibox": {
2031
"keyword" : "s",
@@ -25,6 +36,7 @@
2536

2637
"background": {
2738
"scripts": [
39+
"background/browserAction.js",
2840
"background/omnibox.js",
2941
"background/contextMenus.js"
3042
],

0 commit comments

Comments
 (0)