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

Side by Side Diff: chrome/browser/resources/print_preview/common/search_box.js

Issue 542363002: Add search hint bubbles to Print Preview advanced options controls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Component that renders a search box for searching through destinations. 9 * Component that renders a search box for searching through destinations.
10 * @param {string} searchBoxPlaceholderText Search box placeholder text. 10 * @param {string} searchBoxPlaceholderText Search box placeholder text.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 /** 93 /**
94 * Dispatches a SEARCH event. 94 * Dispatches a SEARCH event.
95 * @private 95 * @private
96 */ 96 */
97 dispatchSearchEvent_: function() { 97 dispatchSearchEvent_: function() {
98 this.timeout_ = null; 98 this.timeout_ = null;
99 var searchEvent = new Event(SearchBox.EventType.SEARCH); 99 var searchEvent = new Event(SearchBox.EventType.SEARCH);
100 var query = this.getQuery_(); 100 var query = this.getQuery_();
101 searchEvent.query = query; 101 searchEvent.query = query;
102 // Generate regexp-safe query by escaping metacharacters. 102 if (query) {
103 var safeQuery = query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); 103 // Generate regexp-safe query by escaping metacharacters.
104 searchEvent.queryRegExp = new RegExp('(' + safeQuery + ')', 'ig'); 104 var safeQuery = query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
105 searchEvent.queryRegExp = new RegExp('(' + safeQuery + ')', 'ig');
106 } else {
107 searchEvent.queryRegExp = null;
108 }
105 this.dispatchEvent(searchEvent); 109 this.dispatchEvent(searchEvent);
106 }, 110 },
107 111
108 /** 112 /**
109 * Called when the input element's value changes. Dispatches a search event. 113 * Called when the input element's value changes. Dispatches a search event.
110 * @private 114 * @private
111 */ 115 */
112 onInputInput_: function() { 116 onInputInput_: function() {
113 if (this.timeout_) 117 if (this.timeout_)
114 clearTimeout(this.timeout_); 118 clearTimeout(this.timeout_);
115 this.timeout_ = setTimeout( 119 this.timeout_ = setTimeout(
116 this.dispatchSearchEvent_.bind(this), SearchBox.SEARCH_DELAY_); 120 this.dispatchSearchEvent_.bind(this), SearchBox.SEARCH_DELAY_);
117 } 121 }
118 }; 122 };
119 123
120 // Export 124 // Export
121 return { 125 return {
122 SearchBox: SearchBox 126 SearchBox: SearchBox
123 }; 127 };
124 }); 128 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698