diff options
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/presenters/ConsoleFramePresenter.ts | 6 | ||||
-rw-r--r-- | src/content/usecases/AddonEnabledUseCase.ts | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/content/presenters/ConsoleFramePresenter.ts b/src/content/presenters/ConsoleFramePresenter.ts index 9c4b3f1..0db58f0 100644 --- a/src/content/presenters/ConsoleFramePresenter.ts +++ b/src/content/presenters/ConsoleFramePresenter.ts @@ -6,6 +6,8 @@ export default interface ConsoleFramePresenter { blur(): void; resize(width: number, height: number): void; + + isTopWindow(): boolean; } export class ConsoleFramePresenterImpl implements ConsoleFramePresenter { @@ -47,4 +49,8 @@ export class ConsoleFramePresenterImpl implements ConsoleFramePresenter { } ele.style.height = `${height}px`; } + + isTopWindow(): boolean { + return window.top === window; + } } diff --git a/src/content/usecases/AddonEnabledUseCase.ts b/src/content/usecases/AddonEnabledUseCase.ts index b45c47f..f49fde5 100644 --- a/src/content/usecases/AddonEnabledUseCase.ts +++ b/src/content/usecases/AddonEnabledUseCase.ts @@ -34,10 +34,12 @@ export default class AddonEnabledUseCase { private async setEnabled(on: boolean): Promise<void> { this.repository.set(on); - if (on) { - this.consoleFramePresenter.attach(); - } else { - this.consoleFramePresenter.detach(); + if (this.consoleFramePresenter.isTopWindow()) { + if (on) { + this.consoleFramePresenter.attach(); + } else { + this.consoleFramePresenter.detach(); + } } await this.indicator.setEnabled(on); } |