-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice-worker.js
More file actions
23 lines (20 loc) · 805 Bytes
/
service-worker.js
File metadata and controls
23 lines (20 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if (typeof browser === 'undefined') {
browser = chrome ?? {};
}
browser.runtime?.onInstalled.addListener((details) => {
browser.sidePanel?.setPanelBehavior({ openPanelOnActionClick: true });
if (details.reason === browser.runtime?.OnInstalledReason.INSTALL) {
// browser.tabs?.create({ url: "index.html" });
// browser.runtime?.setUninstallURL('https://programmerg.github.io/quick-access/');
}
});
if (/(Opera|OPR)/i.test(navigator.userAgent)) {
browser.tabs?.onCreated.addListener((tab) => {
if (
(tab.pendingUrl && String(tab.pendingUrl).startsWith('chrome://startpage')) ||
(tab.url && String(tab.url).startsWith('chrome://startpage'))
) {
browser.tabs?.update(tab.id, { url: "index.html" });
}
});
}