Skip to content

Commit

Permalink
update content.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
metastable-void committed May 2, 2023
1 parent 5ce5744 commit 25c33ae
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/content/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,27 @@ const setupUaOverrides = (window: Window & typeof globalThis, navigatorPrototype
};

if (gLanguageStore.language !== '') {
setUpLanguageOverrides();
try {
setUpLanguageOverrides();
} catch (e) {
console.error(e);
}
}

gLanguageStore.onLanguagesChanged.addListener(() => {
try {
if (!languageSetupDone && gLanguageStore.language !== '') {
setUpLanguageOverrides();
}
window.dispatchEvent(new Event('languagechange', {
bubbles: false,
cancelable: false,
}));
} catch (e) {
console.error(e);
}
});

setupUaOverrides(window, navigatorPrototypeWrapped);

const visitedIframes = new WeakSet<HTMLIFrameElement>();
Expand Down

0 comments on commit 25c33ae

Please sign in to comment.