Skip to content

Commit

Permalink
feat: add a manifest version 3 version of the extension, tested on ch…
Browse files Browse the repository at this point in the history
…rome and edge
  • Loading branch information
VehpuS committed Jul 24, 2021
1 parent 4b4fe80 commit 4cd5808
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 0 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Binary file not shown.
File renamed without changes
5 changes: 5 additions & 0 deletions manifest-v3/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
try {
importScripts("./pageSuspender.js");
} catch (err) {
console.error(err);
}
Binary file added manifest-v3/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added manifest-v3/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added manifest-v3/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added manifest-v3/icon24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added manifest-v3/icon32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added manifest-v3/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions manifest-v3/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "Simple Suspender",
"version": "1.0",
"manifest_version": 3,
"description": "Suspend / unsuspend a tab, with minimal privacy concerns by design",
"background": {
"service_worker": "background.js"
},
"action": {
"default_icon": {
"16": "icon16.png",
"24": "icon24.png",
"32": "icon32.png",
"48": "icon48.png"
},
"default_title": "Suspend"
},
"icons": {
"16": "icon16.png",
"32": "icon32.png",
"48": "icon48.png",
"128": "icon128.png"
},
"permissions": [
"activeTab"
]
}
16 changes: 16 additions & 0 deletions manifest-v3/pageSuspender.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const suspendPrefix = "https://localhost:0/#";

const toggleSuspendUrl = (pageUrl) =>
pageUrl.startsWith(suspendPrefix)
? pageUrl.replace(suspendPrefix, "")
: `${suspendPrefix}${pageUrl}`;

if (chrome) {
chrome.action.onClicked.addListener((tab) => {
chrome.tabs.update(tab.id, { url: toggleSuspendUrl(tab.url) });
});
} else if (browser) {
browser.browserAction.onClicked.addListener((tab) => {
browser.tabs.update(tab.id, { url: toggleSuspendUrl(tab.url) });
});
}

0 comments on commit 4cd5808

Please sign in to comment.