bookmark-stack

web extension to save pages in a stack for reading them later  https://addons.mozilla.org/firefox/addon/bookmark-stack/
git clone https://git.ce9e.org/bookmark-stack.git

commit
14c626384afc8d1728798d22661a04b1f0d20837
parent
686b649b3b83c8213d5d7024a6abbfe3f26d675f
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2022-10-15 10:01
make compatible with event pages

see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Background_scripts#convert_to_non-persistent
and https://extensionworkshop.com/documentation/develop/manifest-v3-migration-guide/

Diffstat

M bg.js 32 +++++++++++++++++++-------------
M manifest.json 2 +-

2 files changed, 20 insertions, 14 deletions


diff --git a/bg.js b/bg.js

@@ -1,21 +1,27 @@
    1    -1 chrome.contextMenus.create({
    2    -1 	title: 'read later',
    3    -1 	contexts: ['page', 'selection', 'editable', 'image', 'tab'],
    4    -1 	onclick: function(info, tab) {
    5    -1 		pushBookmark(tab, function() {
    6    -1 			chrome.tabs.remove(tab.id);
    7    -1 		});
    8    -1 	},
   -1     1  chrome.runtime.onInstalled.addListener(function() {
   -1     2 	chrome.contextMenus.create({
   -1     3 		id: 'read-later',
   -1     4 		title: 'read later',
   -1     5 		contexts: ['page', 'selection', 'editable', 'image', 'tab'],
   -1     6 	});
   -1     7 
   -1     8 	chrome.contextMenus.create({
   -1     9 		id: 'read-later-link',
   -1    10 		title: 'read link later',
   -1    11 		contexts: ['link'],
   -1    12 	});
    9    13 });
   10    14 
   11    -1 chrome.contextMenus.create({
   12    -1 	title: 'read link later',
   13    -1 	contexts: ['link'],
   14    -1 	onclick: function(info) {
   -1    15 chrome.contextMenus.onClicked.addListener(function(info, tab) {
   -1    16 	if (info.menuItemId === 'read-later-link') {
   15    17 		pushBookmark({
   16    18 			url: info.linkUrl,
   17    19 		});
   18    -1 	},
   -1    20 	} else {
   -1    21 		pushBookmark(tab, function() {
   -1    22 			chrome.tabs.remove(tab.id);
   -1    23 		});
   -1    24 	}
   19    25 });
   20    26 
   21    27 updateCount();

diff --git a/manifest.json b/manifest.json

@@ -24,7 +24,7 @@
   24    24       "shared.js",
   25    25       "bg.js"
   26    26     ],
   27    -1     "persistent": true
   -1    27     "persistent": false
   28    28   },
   29    29   "permissions": [
   30    30     "bookmarks",