Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/common/time_widget.js

Issue 1362223003: Improve braille related message descriptions and clean up message handling in Chromevox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@inputtypeexception
Patch Set: Move another braille message to Msgs.Untranslated Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 goog.provide('cvox.ChromeVoxHTMLTimeWidget'); 5 goog.provide('cvox.ChromeVoxHTMLTimeWidget');
6 6
7 /** 7 /**
8 * @fileoverview Gives the user spoken feedback as they interact with the time 8 * @fileoverview Gives the user spoken feedback as they interact with the time
9 * widget (input type=time). 9 * widget (input type=time).
10 * 10 *
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 var splitTime = this.timeElem_.value.split(':'); 129 var splitTime = this.timeElem_.value.split(':');
130 if (splitTime.length < 1) { 130 if (splitTime.length < 1) {
131 this.forceInitTime_(); 131 this.forceInitTime_();
132 return; 132 return;
133 } 133 }
134 134
135 var hours = splitTime[0]; 135 var hours = splitTime[0];
136 var minutes = -1; 136 var minutes = -1;
137 var seconds = 0; 137 var seconds = 0;
138 var milliseconds = 0; 138 var milliseconds = 0;
139 var ampm = cvox.ChromeVox.msgs.getMsg('timewidget_am'); 139 var ampm = Msgs.getMsg('timewidget_am');
140 if (splitTime.length > 1) { 140 if (splitTime.length > 1) {
141 minutes = splitTime[1]; 141 minutes = splitTime[1];
142 } 142 }
143 if (splitTime.length > 2) { 143 if (splitTime.length > 2) {
144 var splitSecondsAndMilliseconds = splitTime[2].split('.'); 144 var splitSecondsAndMilliseconds = splitTime[2].split('.');
145 seconds = splitSecondsAndMilliseconds[0]; 145 seconds = splitSecondsAndMilliseconds[0];
146 if (splitSecondsAndMilliseconds.length > 1) { 146 if (splitSecondsAndMilliseconds.length > 1) {
147 milliseconds = splitSecondsAndMilliseconds[1]; 147 milliseconds = splitSecondsAndMilliseconds[1];
148 } 148 }
149 } 149 }
150 if (hours > 12) { 150 if (hours > 12) {
151 hours = hours - 12; 151 hours = hours - 12;
152 ampm = cvox.ChromeVox.msgs.getMsg('timewidget_pm'); 152 ampm = Msgs.getMsg('timewidget_pm');
153 } 153 }
154 if (hours == 12) { 154 if (hours == 12) {
155 ampm = cvox.ChromeVox.msgs.getMsg('timewidget_pm'); 155 ampm = Msgs.getMsg('timewidget_pm');
156 } 156 }
157 if (hours == 0) { 157 if (hours == 0) {
158 hours = 12; 158 hours = 12;
159 ampm = cvox.ChromeVox.msgs.getMsg('timewidget_am'); 159 ampm = Msgs.getMsg('timewidget_am');
160 } 160 }
161 161
162 var changeMessage = ''; 162 var changeMessage = '';
163 163
164 if (shouldSpeakLabel) { 164 if (shouldSpeakLabel) {
165 changeMessage = cvox.DomUtil.getName(this.timeElem_, true, true) + '\n'; 165 changeMessage = cvox.DomUtil.getName(this.timeElem_, true, true) + '\n';
166 } 166 }
167 167
168 if (hours != this.pHours_) { 168 if (hours != this.pHours_) {
169 changeMessage = changeMessage + hours + ' ' + 169 changeMessage = changeMessage + hours + ' ' +
170 cvox.ChromeVox.msgs.getMsg('timewidget_hours') + '\n'; 170 Msgs.getMsg('timewidget_hours') + '\n';
171 this.pHours_ = hours; 171 this.pHours_ = hours;
172 } 172 }
173 173
174 if (minutes != this.pMinutes_) { 174 if (minutes != this.pMinutes_) {
175 changeMessage = changeMessage + minutes + ' ' + 175 changeMessage = changeMessage + minutes + ' ' +
176 cvox.ChromeVox.msgs.getMsg('timewidget_minutes') + '\n'; 176 Msgs.getMsg('timewidget_minutes') + '\n';
177 this.pMinutes_ = minutes; 177 this.pMinutes_ = minutes;
178 } 178 }
179 179
180 if (seconds != this.pSeconds_) { 180 if (seconds != this.pSeconds_) {
181 changeMessage = changeMessage + seconds + ' ' + 181 changeMessage = changeMessage + seconds + ' ' +
182 cvox.ChromeVox.msgs.getMsg('timewidget_seconds') + '\n'; 182 Msgs.getMsg('timewidget_seconds') + '\n';
183 this.pSeconds_ = seconds; 183 this.pSeconds_ = seconds;
184 } 184 }
185 185
186 if (milliseconds != this.pMilliseconds_) { 186 if (milliseconds != this.pMilliseconds_) {
187 changeMessage = changeMessage + milliseconds + ' ' + 187 changeMessage = changeMessage + milliseconds + ' ' +
188 cvox.ChromeVox.msgs.getMsg('timewidget_milliseconds') + '\n'; 188 Msgs.getMsg('timewidget_milliseconds') + '\n';
189 this.pMilliseconds_ = milliseconds; 189 this.pMilliseconds_ = milliseconds;
190 } 190 }
191 191
192 if (ampm != this.pAmpm_) { 192 if (ampm != this.pAmpm_) {
193 changeMessage = changeMessage + ampm; 193 changeMessage = changeMessage + ampm;
194 this.pAmpm_ = ampm; 194 this.pAmpm_ = ampm;
195 } 195 }
196 196
197 if (changeMessage.length > 0) { 197 if (changeMessage.length > 0) {
198 this.timeTts_.speak(changeMessage, cvox.QueueMode.FLUSH, null); 198 this.timeTts_.speak(changeMessage, cvox.QueueMode.FLUSH, null);
(...skipping 13 matching lines...) Expand all
212 shouldSpeakLabel = true; 212 shouldSpeakLabel = true;
213 } 213 }
214 if (((evt.keyCode == 9) && evt.shiftKey) || (evt.keyCode == 37)) { 214 if (((evt.keyCode == 9) && evt.shiftKey) || (evt.keyCode == 37)) {
215 this.pos_--; 215 this.pos_--;
216 this.handlePosChange_(); 216 this.handlePosChange_();
217 shouldSpeakLabel = true; 217 shouldSpeakLabel = true;
218 } 218 }
219 } 219 }
220 this.update_(shouldSpeakLabel); 220 this.update_(shouldSpeakLabel);
221 }; 221 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698