Fixed an infinite loop #34

This commit is contained in:
ManeraKai 2022-02-13 18:57:38 +03:00
parent bdfa63acef
commit 9333545ae8
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
3 changed files with 21 additions and 18 deletions

View File

@ -103,6 +103,9 @@ function processDefaultCustomInstances(
let nameDefaultRedirects;
function calcNameCheckBoxes() {
browser.storage.sync.getBytesInUse(null).then(
(result) => console.log(result)
)
let isTrue = true;
for (const item of nameHelper.getRedirects()[name].normal)
if (!nameDefaultRedirects.includes(item)) {

View File

@ -75,12 +75,24 @@ function setLibredditRedirects(val) {
redirects.libreddit = val;
browser.storage.sync.set({ redditRedirects: redirects })
console.log("libredditRedirects:", val)
for (const item of libredditRedirectsChecks)
if (!redirects.libreddit.normal.includes(item)) {
var index = libredditRedirectsChecks.indexOf(item);
if (index !== -1) libredditRedirectsChecks.splice(index, 1);
}
setLibredditRedirectsChecks(libredditRedirectsChecks);
}
function setTedditRedirects(val) {
redirects.teddit = val;
browser.storage.sync.set({ redditRedirects: redirects })
console.log("tedditRedirects:", val)
for (const item of tedditRedirectsChecks)
if (!redirects.teddit.normal.includes(item)) {
var index = tedditRedirectsChecks.indexOf(item);
if (index !== -1) tedditRedirectsChecks.splice(index, 1);
}
setTedditRedirectsChecks(tedditRedirectsChecks);
}
@ -90,12 +102,6 @@ function setLibredditRedirectsChecks(val) {
libredditRedirectsChecks = val;
browser.storage.sync.set({ libredditRedirectsChecks })
console.log("libredditRedirectsChecks: ", val)
for (const item of libredditRedirectsChecks)
if (!redirects.libreddit.normal.includes(item)) {
var index = libredditRedirectsChecks.indexOf(item);
if (index !== -1) libredditRedirectsChecks.splice(index, 1);
}
setLibredditRedirectsChecks(libredditRedirectsChecks);
}
let libredditCustomRedirects = [];
@ -112,12 +118,6 @@ function setTedditRedirectsChecks(val) {
tedditRedirectsChecks = val;
browser.storage.sync.set({ tedditRedirectsChecks })
console.log("tedditRedirectsChecks: ", val)
for (const item of tedditRedirectsChecks)
if (!redirects.teddit.normal.includes(item)) {
var index = tedditRedirectsChecks.indexOf(item);
if (index !== -1) tedditRedirectsChecks.splice(index, 1);
}
setTedditRedirectsChecks(tedditRedirectsChecks);
}
let tedditCustomRedirects = [];

View File

@ -94,6 +94,12 @@ function setRedirects(val) {
redirects.nitter = val;
browser.storage.sync.set({ twitterRedirects: redirects })
console.log("twitterRedirects:", val)
for (const item of nitterRedirectsChecks)
if (!redirects.nitter.normal.includes(item)) {
var index = nitterRedirectsChecks.indexOf(item);
if (index !== -1) nitterRedirectsChecks.splice(index, 1);
}
setNitterRedirectsChecks(nitterRedirectsChecks);
}
let nitterRedirectsChecks;
@ -101,12 +107,6 @@ const getNitterRedirectsChecks = () => nitterRedirectsChecks;
function setNitterRedirectsChecks(val) {
nitterRedirectsChecks = val;
browser.storage.sync.set({ nitterRedirectsChecks })
for (const item of nitterRedirectsChecks)
if (!redirects.nitter.normal.includes(item)) {
var index = nitterRedirectsChecks.indexOf(item);
if (index !== -1) nitterRedirectsChecks.splice(index, 1);
}
setNitterRedirectsChecks(nitterRedirectsChecks);
console.log("nitterRedirectsChecks: ", val)
}