Skip to content

Commit a020a47

Browse files
committed
Updated to manifest version 3.
1 parent 1ce3fab commit a020a47

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

background.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
function saveBookmark() {
2-
browser.tabs.query({ active: true, currentWindow: true }, function(tabs) {
3-
let tab = tabs[0];
4-
let url = tab.url;
5-
6-
browser.tabs.create({
7-
url: "https://micro.blog/bookmarks?go=" + encodeURIComponent(url)
8-
});
9-
});
1+
function saveBookmark(tab) {
2+
// browser.tabs.query({ active: true, currentWindow: true }, function(tabs) {
3+
// let tab = tabs[0];
4+
// let url = tab.url;
5+
//
6+
// browser.tabs.create({
7+
// url: "https://micro.blog/bookmarks?go=" + encodeURIComponent(url)
8+
// });
9+
// });
10+
11+
let url= tab.url;
12+
chrome.tabs.create({
13+
url: "https://micro.blog/bookmarks?go=" + encodeURIComponent(url)
14+
});
1015
}
1116

12-
browser.browserAction.onClicked.addListener(saveBookmark);
17+
// browser.browserAction.onClicked.addListener(saveBookmark);
18+
19+
chrome.action.onClicked.addListener((tab) => {
20+
saveBookmark(tab);
21+
});

manifest.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
22
"name": "Micro.blog",
33
"description": "Save bookmarks to Micro.blog.",
4-
"manifest_version": 2,
5-
"version": "1.0",
4+
"manifest_version": 3,
5+
"version": "1.0.1",
66
"permissions": [ "activeTab" ],
77
"background": {
8-
"scripts": [ "background.js" ]
8+
"service_worker": "background.js"
99
},
1010
"icons": {
1111
"16": "icons/icon-16.png",
1212
"32": "icons/icon-32.png",
1313
"64": "icons/icon-64.png",
1414
"128": "icons/icon-128.png"
1515
},
16-
"browser_action": {
16+
"action": {
1717
"default_icon": {
1818
"16": "icons/icon-16.png",
1919
"32": "icons/icon-32.png",

0 commit comments

Comments
 (0)