OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview ChromeVox panel. | 6 * @fileoverview ChromeVox panel. |
7 * | 7 * |
8 */ | 8 */ |
9 | 9 |
10 goog.provide('Panel'); | 10 goog.provide('Panel'); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 if (event.key == 'brailleCaptions') { | 47 if (event.key == 'brailleCaptions') { |
48 Panel.updateFromPrefs(); | 48 Panel.updateFromPrefs(); |
49 } | 49 } |
50 }, false); | 50 }, false); |
51 | 51 |
52 window.addEventListener('message', function(message) { | 52 window.addEventListener('message', function(message) { |
53 var command = JSON.parse(message.data); | 53 var command = JSON.parse(message.data); |
54 Panel.exec(/** @type {PanelCommand} */(command)); | 54 Panel.exec(/** @type {PanelCommand} */(command)); |
55 }, false); | 55 }, false); |
56 | 56 |
57 $('menu').addEventListener('click', Panel.onMenu, false); | |
58 $('options').addEventListener('click', Panel.onOptions, false); | 57 $('options').addEventListener('click', Panel.onOptions, false); |
59 $('close').addEventListener('click', Panel.onClose, false); | 58 $('close').addEventListener('click', Panel.onClose, false); |
60 | 59 |
| 60 // The ChromeVox menu isn't fully implemented yet, disable it. |
| 61 $('menu').disabled = true; |
| 62 $('triangle').style.display = 'none'; |
| 63 |
61 Msgs.addTranslatedMessagesToDom(document); | 64 Msgs.addTranslatedMessagesToDom(document); |
62 }; | 65 }; |
63 | 66 |
64 /** | 67 /** |
65 * Update the display based on prefs. | 68 * Update the display based on prefs. |
66 */ | 69 */ |
67 Panel.updateFromPrefs = function() { | 70 Panel.updateFromPrefs = function() { |
68 if (localStorage['brailleCaptions'] === String(true)) { | 71 if (localStorage['brailleCaptions'] === String(true)) { |
69 this.speechContainer_.style.visibility = 'hidden'; | 72 this.speechContainer_.style.visibility = 'hidden'; |
70 this.brailleContainer_.style.visibility = 'visible'; | 73 this.brailleContainer_.style.visibility = 'visible'; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 this.speechElement_.innerHTML += escapeForHtml(command.data); | 117 this.speechElement_.innerHTML += escapeForHtml(command.data); |
115 break; | 118 break; |
116 case PanelCommandType.UPDATE_BRAILLE: | 119 case PanelCommandType.UPDATE_BRAILLE: |
117 this.brailleTextElement_.textContent = command.data.text; | 120 this.brailleTextElement_.textContent = command.data.text; |
118 this.brailleCellsElement_.textContent = command.data.braille; | 121 this.brailleCellsElement_.textContent = command.data.braille; |
119 break; | 122 break; |
120 } | 123 } |
121 }; | 124 }; |
122 | 125 |
123 /** | 126 /** |
124 * Open the ChromeVox Menu. | |
125 */ | |
126 Panel.onMenu = function() { | |
127 window.location = '#fullscreen'; | |
128 // TODO(dmazzoni): implement the menu UI here. | |
129 }; | |
130 | |
131 /** | |
132 * Open the ChromeVox Options. | 127 * Open the ChromeVox Options. |
133 */ | 128 */ |
134 Panel.onOptions = function() { | 129 Panel.onOptions = function() { |
135 var bkgnd = | 130 var bkgnd = |
136 chrome.extension.getBackgroundPage()['global']['backgroundObj']; | 131 chrome.extension.getBackgroundPage()['global']['backgroundObj']; |
137 bkgnd['showOptionsPage'](); | 132 bkgnd['showOptionsPage'](); |
138 window.location = '#'; | 133 window.location = '#'; |
139 }; | 134 }; |
140 | 135 |
141 /** | 136 /** |
142 * Exit ChromeVox. | 137 * Exit ChromeVox. |
143 */ | 138 */ |
144 Panel.onClose = function() { | 139 Panel.onClose = function() { |
145 window.location = '#close'; | 140 window.location = '#close'; |
146 }; | 141 }; |
147 | 142 |
148 window.addEventListener('load', function() { | 143 window.addEventListener('load', function() { |
149 Panel.init(); | 144 Panel.init(); |
150 }, false); | 145 }, false); |
OLD | NEW |