aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/background/background.js24
-rw-r--r--src/pages/background/incognito.html2
-rw-r--r--src/pages/popup/popup.js15
3 files changed, 21 insertions, 20 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index bf992161..933172b6 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -60,15 +60,7 @@ redditHelper.setLibredditCookies();
redditHelper.setTedditCookies();
tiktokHelper.setProxiTokCookies();
-let incognitoInit = false;
-browser.tabs.onCreated.addListener(
- tab => {
- if (!incognitoInit && tab.incognito) {
- browser.tabs.create({ url: browser.runtime.getURL("/pages/background/incognito.html") });
- incognitoInit = true;
- }
- }
-);
+
let BYPASSTABs = [];
browser.webRequest.onBeforeRequest.addListener(
@@ -82,7 +74,6 @@ browser.webRequest.onBeforeRequest.addListener(
}
catch { return null; }
-
let newUrl = youtubeMusicHelper.redirect(url, details.type)
if (!newUrl) newUrl = youtubeHelper.redirect(url, details, initiator)
if (!newUrl) newUrl = twitterHelper.redirect(url, initiator);
@@ -126,8 +117,21 @@ browser.webRequest.onBeforeRequest.addListener(
["blocking"]
);
+
+let incognitoList = [];
+browser.tabs.onCreated.addListener(
+ tab => {
+ if (tab.incognito) {
+ incognitoList.push(tab.id);
+ if (incognitoList.length == 1) browser.tabs.create({ url: browser.runtime.getURL("/pages/background/incognito.html") });
+ }
+ }
+);
+
browser.tabs.onRemoved.addListener(
tabId => {
+ incognitoList.pop(tabId)
+
const i = BYPASSTABs.indexOf(tabId);
if (i > -1) {
BYPASSTABs.splice(i, 1);
diff --git a/src/pages/background/incognito.html b/src/pages/background/incognito.html
index a618cdb6..7b1c0ee1 100644
--- a/src/pages/background/incognito.html
+++ b/src/pages/background/incognito.html
@@ -29,7 +29,7 @@
<body>
<div>
- <p>Initializing Cookies</p>
+ <p>Initializing Cookies...</p>
</div>
<script type="module" src="incognito.js"></script>
</body>
diff --git a/src/pages/popup/popup.js b/src/pages/popup/popup.js
index 5d309f63..d4459917 100644
--- a/src/pages/popup/popup.js
+++ b/src/pages/popup/popup.js
@@ -8,16 +8,13 @@ utils.unify(true).then(r => {
if (!r) document.getElementById('unify_div').style.display = 'none';
else {
const unify = document.getElementById('unify');
- unify.addEventListener("click", () =>
+ const textElement = document.getElementById('unify').getElementsByTagName('h4')[0]
+ unify.addEventListener("click", () => {
+ const oldHtml = textElement.innerHTML;
+ textElement.innerHTML = '...';
browser.runtime.sendMessage({ function: 'unify' },
- response => {
- if (response && response.response) {
- const textElement = document.getElementById('unify').getElementsByTagName('h4')[0]
- const oldHtml = textElement.innerHTML;
- textElement.innerHTML = browser.i18n.getMessage('unified');
- setTimeout(() => textElement.innerHTML = oldHtml, 1000);
- }
- })
+ response => { if (response && response.response) textElement.innerHTML = oldHtml })
+ }
);
}
})