| 467 | }, |
| 468 | |
| 469 | async toggle(request) { |
| 470 | // If we're in the help dialog page already and the user has typed a key to show the help |
| 471 | // dialog, then we should hide it. |
| 472 | if (globalThis.isVimiumHelpDialogPage) return HelpDialogPage.hide(); |
| 473 | |
| 474 | if (this.helpUI == null) { |
| 475 | await DomUtils.documentComplete(); |
| 476 | this.helpUI = new UIComponent(); |
| 477 | this.helpUI.load("pages/help_dialog_page.html", "vimium-help-dialog-frame"); |
| 478 | } |
| 479 | if (this.isShowing()) { |
| 480 | this.helpUI.hide(); |
| 481 | } else { |
| 482 | return this.helpUI.show( |
| 483 | { name: "show" }, |
| 484 | { focus: true, sourceFrameId: request.sourceFrameId }, |
| 485 | ); |
| 486 | } |
| 487 | }, |
| 488 | }; |
| 489 | |
| 490 | const testEnv = globalThis.window == null; |