| 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 * @fileoverview The entry point for all ChromeVox2 related code for the | 6 * @fileoverview The entry point for all ChromeVox2 related code for the |
| 7 * background page. | 7 * background page. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 goog.provide('Background'); | 10 goog.provide('Background'); |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 * the start of the current range. | 345 * the start of the current range. |
| 346 * @param {boolean=} opt_setValue Directly set to force next (true) or | 346 * @param {boolean=} opt_setValue Directly set to force next (true) or |
| 347 * classic/compat (false). | 347 * classic/compat (false). |
| 348 * @return {boolean} True to announce current position. | 348 * @return {boolean} True to announce current position. |
| 349 */ | 349 */ |
| 350 toggleNext: function(opt_setValue) { | 350 toggleNext: function(opt_setValue) { |
| 351 var useNext; | 351 var useNext; |
| 352 if (opt_setValue !== undefined) | 352 if (opt_setValue !== undefined) |
| 353 useNext = opt_setValue; | 353 useNext = opt_setValue; |
| 354 else | 354 else |
| 355 useNext = localStorage['useNext'] !== 'true'; | 355 useNext = localStorage['useNext'] != 'true'; |
| 356 | 356 |
| 357 localStorage['useNext'] = useNext; | 357 localStorage['useNext'] = useNext; |
| 358 if (useNext) | 358 if (useNext) |
| 359 this.setCurrentRangeToFocus_(); | 359 this.setCurrentRangeToFocus_(); |
| 360 else | 360 else |
| 361 this.setCurrentRange(null); | 361 this.setCurrentRange(null); |
| 362 | 362 |
| 363 var announce = Msgs.getMsg(useNext ? | 363 var announce = Msgs.getMsg(useNext ? |
| 364 'switch_to_next' : 'switch_to_classic'); | 364 'switch_to_next' : 'switch_to_classic'); |
| 365 cvox.ChromeVox.tts.speak( | 365 cvox.ChromeVox.tts.speak( |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 return new RegExp('^(' + globs.map(function(glob) { | 769 return new RegExp('^(' + globs.map(function(glob) { |
| 770 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') | 770 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') |
| 771 .replace(/\*/g, '.*') | 771 .replace(/\*/g, '.*') |
| 772 .replace(/\?/g, '.'); | 772 .replace(/\?/g, '.'); |
| 773 }).join('|') + ')$'); | 773 }).join('|') + ')$'); |
| 774 }; | 774 }; |
| 775 | 775 |
| 776 new Background(); | 776 new Background(); |
| 777 | 777 |
| 778 }); // goog.scope | 778 }); // goog.scope |
| OLD | NEW |