()
| 38 | }, |
| 39 | |
| 40 | init() { |
| 41 | if (this.dialogElement != null) { |
| 42 | return; |
| 43 | } |
| 44 | this.dialogElement = document.querySelector("#dialog"); |
| 45 | |
| 46 | const closeButton = this.dialogElement.querySelector("#close"); |
| 47 | closeButton.addEventListener("click", (event) => { |
| 48 | event.preventDefault(); |
| 49 | this.hide(); |
| 50 | }, false); |
| 51 | |
| 52 | // "auxclick" handles a click with the middle mouse button. |
| 53 | const optionsLink = document.querySelector("#options-page"); |
| 54 | for (const eventName of ["click", "auxclick"]) { |
| 55 | optionsLink.addEventListener(eventName, (event) => { |
| 56 | event.preventDefault(); |
| 57 | chrome.runtime.sendMessage({ handler: "openOptionsPageInNewTab" }); |
| 58 | }, false); |
| 59 | } |
| 60 | |
| 61 | document.querySelector("#toggle-advanced a").addEventListener( |
| 62 | "click", |
| 63 | HelpDialogPage.toggleAdvancedCommands.bind(HelpDialogPage), |
| 64 | false, |
| 65 | ); |
| 66 | |
| 67 | document.documentElement.addEventListener("click", (event) => { |
| 68 | if (!this.dialogElement.contains(event.target)) { |
| 69 | this.hide(); |
| 70 | } |
| 71 | }, false); |
| 72 | }, |
| 73 | |
| 74 | // Returns the rows to show in the help dialog, grouped by command group. |
| 75 | // Returns: { group: [[command, args, keys], ...], ... } |
no test coverage detected