| OLD | NEW |
| 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 * Creates a PageSettings object. This object encapsulates all settings and | 9 * Creates a PageSettings object. This object encapsulates all settings and |
| 10 * logic related to page selection. | 10 * logic related to page selection. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 this.customRadio_.disabled = !isEnabled; | 98 this.customRadio_.disabled = !isEnabled; |
| 99 }, | 99 }, |
| 100 | 100 |
| 101 /** @override */ | 101 /** @override */ |
| 102 enterDocument: function() { | 102 enterDocument: function() { |
| 103 print_preview.SettingsSection.prototype.enterDocument.call(this); | 103 print_preview.SettingsSection.prototype.enterDocument.call(this); |
| 104 var customInput = assert(this.customInput_); | 104 var customInput = assert(this.customInput_); |
| 105 this.tracker.add( | 105 this.tracker.add( |
| 106 assert(this.allRadio_), 'click', this.onAllRadioClick_.bind(this)); | 106 assert(this.allRadio_), 'click', this.onAllRadioClick_.bind(this)); |
| 107 this.tracker.add( | 107 this.tracker.add( |
| 108 assert(this.customRadio_), | 108 assert(this.customRadio_), 'click', |
| 109 'click', | |
| 110 this.onCustomRadioClick_.bind(this)); | 109 this.onCustomRadioClick_.bind(this)); |
| 110 this.tracker.add(customInput, 'blur', this.onCustomInputBlur_.bind(this)); |
| 111 this.tracker.add( | 111 this.tracker.add( |
| 112 customInput, | 112 customInput, 'focus', this.onCustomInputFocus_.bind(this)); |
| 113 'blur', | |
| 114 this.onCustomInputBlur_.bind(this)); | |
| 115 this.tracker.add( | 113 this.tracker.add( |
| 116 customInput, | 114 customInput, 'keydown', this.onCustomInputKeyDown_.bind(this)); |
| 117 'focus', | |
| 118 this.onCustomInputFocus_.bind(this)); | |
| 119 this.tracker.add( | 115 this.tracker.add( |
| 120 customInput, | 116 customInput, 'input', this.onCustomInputChange_.bind(this)); |
| 121 'keydown', | |
| 122 this.onCustomInputKeyDown_.bind(this)); | |
| 123 this.tracker.add( | |
| 124 customInput, | |
| 125 'input', | |
| 126 this.onCustomInputChange_.bind(this)); | |
| 127 this.tracker.add( | 117 this.tracker.add( |
| 128 this.pageRangeTicketItem_, | 118 this.pageRangeTicketItem_, |
| 129 print_preview.ticket_items.TicketItem.EventType.CHANGE, | 119 print_preview.ticket_items.TicketItem.EventType.CHANGE, |
| 130 this.onPageRangeTicketItemChange_.bind(this)); | 120 this.onPageRangeTicketItemChange_.bind(this)); |
| 131 }, | 121 }, |
| 132 | 122 |
| 133 /** @override */ | 123 /** @override */ |
| 134 exitDocument: function() { | 124 exitDocument: function() { |
| 135 print_preview.SettingsSection.prototype.exitDocument.call(this); | 125 print_preview.SettingsSection.prototype.exitDocument.call(this); |
| 136 this.customInput_ = null; | 126 this.customInput_ = null; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 157 */ | 147 */ |
| 158 setInvalidStateVisible_: function(validity) { | 148 setInvalidStateVisible_: function(validity) { |
| 159 if (validity !== PageRangeStatus.NO_ERROR) { | 149 if (validity !== PageRangeStatus.NO_ERROR) { |
| 160 var message; | 150 var message; |
| 161 if (validity === PageRangeStatus.LIMIT_ERROR) { | 151 if (validity === PageRangeStatus.LIMIT_ERROR) { |
| 162 if (this.pageRangeTicketItem_.getDocumentNumPages()) { | 152 if (this.pageRangeTicketItem_.getDocumentNumPages()) { |
| 163 message = loadTimeData.getStringF( | 153 message = loadTimeData.getStringF( |
| 164 'pageRangeLimitInstructionWithValue', | 154 'pageRangeLimitInstructionWithValue', |
| 165 this.pageRangeTicketItem_.getDocumentNumPages()); | 155 this.pageRangeTicketItem_.getDocumentNumPages()); |
| 166 } else { | 156 } else { |
| 167 message = loadTimeData.getString( | 157 message = loadTimeData.getString('pageRangeLimitInstruction'); |
| 168 'pageRangeLimitInstruction'); | |
| 169 } | 158 } |
| 170 } else { | 159 } else { |
| 171 message = loadTimeData.getStringF( | 160 message = loadTimeData.getStringF( |
| 172 'pageRangeSyntaxInstruction', | 161 'pageRangeSyntaxInstruction', |
| 173 loadTimeData.getString('examplePageRangeText')); | 162 loadTimeData.getString('examplePageRangeText')); |
| 174 } | 163 } |
| 175 this.customHintEl_.textContent = message; | 164 this.customHintEl_.textContent = message; |
| 176 this.customInput_.classList.add('invalid'); | 165 this.customInput_.classList.add('invalid'); |
| 177 fadeInElement(this.customHintEl_); | 166 fadeInElement(this.customHintEl_); |
| 178 } else { | 167 } else { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 } else { | 265 } else { |
| 277 this.allRadio_.checked = true; | 266 this.allRadio_.checked = true; |
| 278 this.setInvalidStateVisible_(PageRangeStatus.NO_ERROR); | 267 this.setInvalidStateVisible_(PageRangeStatus.NO_ERROR); |
| 279 } | 268 } |
| 280 } | 269 } |
| 281 this.updateUiStateInternal(); | 270 this.updateUiStateInternal(); |
| 282 } | 271 } |
| 283 }; | 272 }; |
| 284 | 273 |
| 285 // Export | 274 // Export |
| 286 return { | 275 return {PageSettings: PageSettings}; |
| 287 PageSettings: PageSettings | |
| 288 }; | |
| 289 }); | 276 }); |
| OLD | NEW |