OLD | NEW |
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 | 5 |
6 /** | 6 /** |
7 * @fileoverview Uses ChromeVox API to enhance the search experience. | 7 * @fileoverview Uses ChromeVox API to enhance the search experience. |
8 */ | 8 */ |
9 | 9 |
10 goog.provide('cvox.Search'); | 10 goog.provide('cvox.Search'); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 * has focus. | 231 * has focus. |
232 */ | 232 */ |
233 if (document.activeElement !== searchInput && | 233 if (document.activeElement !== searchInput && |
234 !cvox.SearchUtil.isSearchWidgetActive()) { | 234 !cvox.SearchUtil.isSearchWidgetActive()) { |
235 switch (evt.keyCode) { | 235 switch (evt.keyCode) { |
236 case cvox.SearchConstants.KeyCode.UP: | 236 case cvox.SearchConstants.KeyCode.UP: |
237 /* Add results.length because JS Modulo is silly. */ | 237 /* Add results.length because JS Modulo is silly. */ |
238 cvox.Search.index = cvox.SearchUtil.subOneWrap(cvox.Search.index, | 238 cvox.Search.index = cvox.SearchUtil.subOneWrap(cvox.Search.index, |
239 cvox.Search.results.length); | 239 cvox.Search.results.length); |
240 if (cvox.Search.index === cvox.Search.results.length - 1) { | 240 if (cvox.Search.index === cvox.Search.results.length - 1) { |
241 cvox.ChromeVox.earcons.playEarconByName('WRAP'); | 241 cvox.ChromeVox.earcons.playEarcon(cvox.Earcon.WRAP); |
242 } | 242 } |
243 cvox.Search.syncToIndex(); | 243 cvox.Search.syncToIndex(); |
244 break; | 244 break; |
245 | 245 |
246 case cvox.SearchConstants.KeyCode.DOWN: | 246 case cvox.SearchConstants.KeyCode.DOWN: |
247 cvox.Search.index = cvox.SearchUtil.addOneWrap(cvox.Search.index, | 247 cvox.Search.index = cvox.SearchUtil.addOneWrap(cvox.Search.index, |
248 cvox.Search.results.length); | 248 cvox.Search.results.length); |
249 if (cvox.Search.index === 0) { | 249 if (cvox.Search.index === 0) { |
250 cvox.ChromeVox.earcons.playEarconByName('WRAP'); | 250 cvox.ChromeVox.earcons.playEarcon(cvox.Earcon.WRAP); |
251 } | 251 } |
252 cvox.Search.syncToIndex(); | 252 cvox.Search.syncToIndex(); |
253 break; | 253 break; |
254 | 254 |
255 case cvox.SearchConstants.KeyCode.PAGE_UP: | 255 case cvox.SearchConstants.KeyCode.PAGE_UP: |
256 cvox.Search.navigatePage(false); | 256 cvox.Search.navigatePage(false); |
257 break; | 257 break; |
258 | 258 |
259 case cvox.SearchConstants.KeyCode.PAGE_DOWN: | 259 case cvox.SearchConstants.KeyCode.PAGE_DOWN: |
260 cvox.Search.navigatePage(true); | 260 cvox.Search.navigatePage(true); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 return; | 432 return; |
433 } | 433 } |
434 | 434 |
435 cvox.Search.populateResults(); | 435 cvox.Search.populateResults(); |
436 cvox.Search.populatePanes(); | 436 cvox.Search.populatePanes(); |
437 cvox.Search.paneIndex = cvox.Search.getSelectedPaneIndex(); | 437 cvox.Search.paneIndex = cvox.Search.getSelectedPaneIndex(); |
438 | 438 |
439 cvox.Search.initialSync(); | 439 cvox.Search.initialSync(); |
440 | 440 |
441 }; | 441 }; |
OLD | NEW |