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

Side by Side Diff: chrome/browser/resources/print_preview/settings/copies_settings.js

Issue 171433002: Listen for all input events on copies capability text field. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 the copies settings UI. 9 * Component that renders the copies settings UI.
10 * @param {!print_preview.ticket_items.Copies} copiesTicketItem Used to read 10 * @param {!print_preview.ticket_items.Copies} copiesTicketItem Used to read
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 this.getChildElement('button.decrement').disabled = true; 68 this.getChildElement('button.decrement').disabled = true;
69 } 69 }
70 }, 70 },
71 71
72 /** @override */ 72 /** @override */
73 enterDocument: function() { 73 enterDocument: function() {
74 print_preview.Component.prototype.enterDocument.call(this); 74 print_preview.Component.prototype.enterDocument.call(this);
75 75
76 this.tracker.add( 76 this.tracker.add(
77 this.getChildElement('input.copies'), 77 this.getChildElement('input.copies'),
78 'keyup', 78 'input',
79 this.onTextfieldKeyUp_.bind(this)); 79 this.onTextfieldInput_.bind(this));
80 this.tracker.add( 80 this.tracker.add(
81 this.getChildElement('input.copies'), 81 this.getChildElement('input.copies'),
82 'blur', 82 'blur',
83 this.onTextfieldBlur_.bind(this)); 83 this.onTextfieldBlur_.bind(this));
84 this.tracker.add( 84 this.tracker.add(
85 this.getChildElement('button.increment'), 85 this.getChildElement('button.increment'),
86 'click', 86 'click',
87 this.onButtonClicked_.bind(this, 1)); 87 this.onButtonClicked_.bind(this, 1));
88 this.tracker.add( 88 this.tracker.add(
89 this.getChildElement('button.decrement'), 89 this.getChildElement('button.decrement'),
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 * @private 168 * @private
169 */ 169 */
170 onTextfieldTimeout_: function() { 170 onTextfieldTimeout_: function() {
171 var copiesVal = this.getChildElement('input.copies').value; 171 var copiesVal = this.getChildElement('input.copies').value;
172 if (copiesVal != '') { 172 if (copiesVal != '') {
173 this.copiesTicketItem_.updateValue(copiesVal); 173 this.copiesTicketItem_.updateValue(copiesVal);
174 } 174 }
175 }, 175 },
176 176
177 /** 177 /**
178 * Called when a keyup event occurs on the textfield. Starts an input 178 * Called when a input event occurs on the textfield. Starts an input
179 * timeout. 179 * timeout.
180 * @param {Event} event Contains the pressed key.
181 * @private 180 * @private
182 */ 181 */
183 onTextfieldKeyUp_: function(event) { 182 onTextfieldInput_: function() {
184 if (this.textfieldTimeout_) { 183 if (this.textfieldTimeout_) {
185 clearTimeout(this.textfieldTimeout_); 184 clearTimeout(this.textfieldTimeout_);
186 } 185 }
187 this.textfieldTimeout_ = setTimeout( 186 this.textfieldTimeout_ = setTimeout(
188 this.onTextfieldTimeout_.bind(this), CopiesSettings.TEXTFIELD_DELAY_); 187 this.onTextfieldTimeout_.bind(this), CopiesSettings.TEXTFIELD_DELAY_);
189 }, 188 },
190 189
191 /** 190 /**
192 * Called when the focus leaves the textfield. If the textfield is empty, 191 * Called when the focus leaves the textfield. If the textfield is empty,
193 * its value is set to 1. 192 * its value is set to 1.
(...skipping 13 matching lines...) Expand all
207 this.collateTicketItem_.updateValue( 206 this.collateTicketItem_.updateValue(
208 this.getChildElement('input.collate').checked); 207 this.getChildElement('input.collate').checked);
209 } 208 }
210 }; 209 };
211 210
212 // Export 211 // Export
213 return { 212 return {
214 CopiesSettings: CopiesSettings 213 CopiesSettings: CopiesSettings
215 }; 214 };
216 }); 215 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698