Skip to content

Commit

Permalink
feat: add browser action button
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Mar 31, 2023
1 parent eef210d commit 3de654c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
14 changes: 12 additions & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,15 @@
"background": {
"page": "bg.html"
},
"web_accessible_resources": ["map.html"]
}
"web_accessible_resources": [
"map.html"
],
"browser_action": {
"default_icon": {
"48": "icons/48.png",
"96": "icons/96.png"
},
"default_area": "navbar",
"default_title": "Replace Maps"
}
}
1 change: 1 addition & 0 deletions src/bg.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<head>
<meta charset="UTF-8" />
<script src="bg/action.ts" type="module"></script>
<script src="bg/bg.ts" type="module"></script>
</head>
5 changes: 5 additions & 0 deletions src/bg/action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import browser from 'webextension-polyfill';

browser.browserAction.onClicked.addListener((tab: browser.Tabs.Tab) => {
console.log(tab.url);
});

0 comments on commit 3de654c

Please sign in to comment.