|
3 | 3 | // License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
4 | 4 | // You can obtain one at https://mozilla.org/MPL/2.0/.
|
5 | 5 |
|
6 |
| -import { RegisterPolymerTemplateModifications } from 'chrome://resources/brave/polymer_overriding.js' |
| 6 | +import { |
| 7 | + RegisterPolymerTemplateModifications |
| 8 | +} from 'chrome://resources/brave/polymer_overriding.js' |
7 | 9 |
|
8 | 10 | RegisterPolymerTemplateModifications({
|
9 | 11 | 'settings-a11y-page': (templateContent) => {
|
| 12 | + |
10 | 13 | // We remove all the templates related to captions - there are two modes
|
11 | 14 | // depending on whether `captionSettingsOpensExternally_` is set. We remove
|
12 | 15 | // both.
|
13 |
| - const captionsLinkTemplates = templateContent.querySelectorAll('template[if*="captionSettingsOpensExternally_"]') |
| 16 | + const captionsLinkTemplates = templateContent. |
| 17 | + querySelectorAll('template[if*="captionSettingsOpensExternally_"]') |
14 | 18 | if (captionsLinkTemplates.length !== 3) {
|
15 |
| - console.error(`Expected 3 captionsLinkTemplates, got ${captionsLinkTemplates.length} - this indicates something upstream has changed. The override may need to be updated.`) |
| 19 | + console.error( |
| 20 | + `Expected 3 captionsLinkTemplates, got ${captionsLinkTemplates.length}` |
| 21 | + + ' - this indicates something upstream has changed.' |
| 22 | + + ' The override may need to be updated.') |
16 | 23 | }
|
17 | 24 | for (const link of captionsLinkTemplates) {
|
18 | 25 | link.remove()
|
19 | 26 | }
|
| 27 | + |
| 28 | + // We hide the image labels toggle button as we don't support this service |
| 29 | + const imageLabelsToggle = templateContent.querySelector( |
| 30 | + 'settings-toggle-button[on-change="onA11yImageLabelsChange_"]') |
| 31 | + if (imageLabelsToggle) { |
| 32 | + imageLabelsToggle.setAttribute('hidden', 'true') |
| 33 | + } else { |
| 34 | + console.error('[Settings] missing image labels toggle button') |
| 35 | + } |
20 | 36 | }
|
21 | 37 | })
|
0 commit comments