Optional chain for BreezeWiki custom host check
parent
b6c8a9559d
commit
d477317467
|
@ -206,7 +206,7 @@ function displayRedirectBanner(newUrl, id, destinationName, destinationLanguage,
|
||||||
document.body.insertAdjacentElement('beforeBegin', banner);
|
document.body.insertAdjacentElement('beforeBegin', banner);
|
||||||
// Increment banner count
|
// Increment banner count
|
||||||
if (storage.breezewiki === 'on') {
|
if (storage.breezewiki === 'on') {
|
||||||
if (currentURL.hostname.match(breezewikiRegex) || (storage.breezewikiHost === 'CUSTOM' && storage.breezewikiCustomHost.includes(currentURL.hostname))) {
|
if (currentURL.hostname.match(breezewikiRegex) || (storage.breezewikiHost === 'CUSTOM' && storage.breezewikiCustomHost?.includes(currentURL.hostname))) {
|
||||||
chrome.storage.sync.set({ 'countAlerts': (storage.countAlerts ?? 0) + 1 });
|
chrome.storage.sync.set({ 'countAlerts': (storage.countAlerts ?? 0) + 1 });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -233,7 +233,7 @@ function main() {
|
||||||
if (currentURL.pathname.length > 1) {
|
if (currentURL.pathname.length > 1) {
|
||||||
let origin = currentURL;
|
let origin = currentURL;
|
||||||
// If on a BreezeWiki site, convert to Fandom link to match with our list of wikis:
|
// If on a BreezeWiki site, convert to Fandom link to match with our list of wikis:
|
||||||
if (currentURL.hostname.match(breezewikiRegex) || (storage.breezewikiHost === 'CUSTOM' && storage.breezewikiCustomHost.includes(currentURL.hostname))) {
|
if (currentURL.hostname.match(breezewikiRegex) || (storage.breezewikiHost === 'CUSTOM' && storage.breezewikiCustomHost?.includes(currentURL.hostname))) {
|
||||||
origin = String(currentURL.pathname).split('/')[1] + '.fandom.com/wiki/';
|
origin = String(currentURL.pathname).split('/')[1] + '.fandom.com/wiki/';
|
||||||
if (currentURL.search.includes('?q=')) {
|
if (currentURL.search.includes('?q=')) {
|
||||||
origin = origin + currentURL.search.substring(3).split('&')[0];
|
origin = origin + currentURL.search.substring(3).split('&')[0];
|
||||||
|
|
Loading…
Reference in New Issue