-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault-page.js
More file actions
27 lines (24 loc) · 871 Bytes
/
default-page.js
File metadata and controls
27 lines (24 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// ===== File: default-page.js =====
(function () {
if (!window.defaultPageInitialized) {
const currentPath = window.location.pathname;
const body = document.body;
if (currentPath === '/popup.html') {
const urlParams = new URLSearchParams(window.location.search);
const fromDash = urlParams.get('fromDash');
chrome.storage.local.get(['defaultPage'], result => {
if (result.defaultPage && !fromDash) {
// Don't show popup content, redirect immediately
window.location.replace(result.defaultPage);
} else {
// No redirect needed, show popup
body.classList.remove('hidden');
}
});
} else {
// If not on popup.html, show body immediately
body.classList.remove('hidden');
}
window.defaultPageInitialized = true;
}
})();