OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 const OptionsPage = options.OptionsPage; | 6 const OptionsPage = options.OptionsPage; |
7 | 7 |
8 /** | 8 /** |
9 * Encapsulated handling of a search bubble. | 9 * Encapsulated handling of a search bubble. |
10 * @constructor | 10 * @constructor |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 switch(event.keyCode) { | 538 switch(event.keyCode) { |
539 case ESCAPE_KEY_CODE: | 539 case ESCAPE_KEY_CODE: |
540 if (event.target == this.searchField) { | 540 if (event.target == this.searchField) { |
541 this.setSearchText_(''); | 541 this.setSearchText_(''); |
542 this.searchField.blur(); | 542 this.searchField.blur(); |
543 event.stopPropagation(); | 543 event.stopPropagation(); |
544 event.preventDefault(); | 544 event.preventDefault(); |
545 } | 545 } |
546 break; | 546 break; |
547 case FORWARD_SLASH_KEY_CODE: | 547 case FORWARD_SLASH_KEY_CODE: |
548 if (!/INPUT|SELECT|BUTTON|TEXTAREA/.test(event.target.tagName)) { | 548 if (!/INPUT|SELECT|BUTTON|TEXTAREA/.test(event.target.tagName) && |
| 549 !event.ctrlKey && !event.altKey) { |
549 this.searchField.focus(); | 550 this.searchField.focus(); |
550 event.stopPropagation(); | 551 event.stopPropagation(); |
551 event.preventDefault(); | 552 event.preventDefault(); |
552 } | 553 } |
553 break; | 554 break; |
554 } | 555 } |
555 }, | 556 }, |
556 }; | 557 }; |
557 | 558 |
558 /** | 559 /** |
559 * Standardizes a user-entered text query by removing extra whitespace. | 560 * Standardizes a user-entered text query by removing extra whitespace. |
560 * @param {string} The user-entered text. | 561 * @param {string} The user-entered text. |
561 * @return {string} The trimmed query. | 562 * @return {string} The trimmed query. |
562 */ | 563 */ |
563 SearchPage.canonicalizeQuery = function(text) { | 564 SearchPage.canonicalizeQuery = function(text) { |
564 // Trim beginning and ending whitespace. | 565 // Trim beginning and ending whitespace. |
565 return text.replace(/^\s+|\s+$/g, ''); | 566 return text.replace(/^\s+|\s+$/g, ''); |
566 }; | 567 }; |
567 | 568 |
568 // Export | 569 // Export |
569 return { | 570 return { |
570 SearchPage: SearchPage | 571 SearchPage: SearchPage |
571 }; | 572 }; |
572 | 573 |
573 }); | 574 }); |
OLD | NEW |