diff --git a/src/extension/contentscript-main-override/index.ts b/src/extension/contentscript-main-override/index.ts index 18c2e20..52f7610 100644 --- a/src/extension/contentscript-main-override/index.ts +++ b/src/extension/contentscript-main-override/index.ts @@ -2,10 +2,14 @@ const genericWindow = window as any if (genericWindow.aibrow) { genericWindow.ai = genericWindow.aibrow } else { - console.warn('aibrow not found') + if (genericWindow.ai) { + genericWindow.ai.__aibrowOverride = true + } } if (genericWindow.aibrowTranslation) { genericWindow.translation = genericWindow.aibrowTranslation } else { - console.warn('aibrowTranslation not found') + if (genericWindow.translation) { + genericWindow.translation.__aibrowOverride = true + } } diff --git a/src/extension/contentscript-main/index.ts b/src/extension/contentscript-main/index.ts index 8c32802..4b3853a 100644 --- a/src/extension/contentscript-main/index.ts +++ b/src/extension/contentscript-main/index.ts @@ -6,10 +6,10 @@ export const translation = new Translation(ai, (window as any).translation) if (process.env.BROWSER !== 'extlib') { const genericWindow = window as any - if (!window.ai) { + if (!window.ai || genericWindow.ai?.__aibrowOverride === true) { genericWindow.ai = ai } - if (!genericWindow.translation) { + if (!genericWindow.translation || genericWindow.translation?.__aibrowOverride === true) { genericWindow.translation = translation } genericWindow.aibrow = ai