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('print_preview', function() { | 5 cr.define('print_preview', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Creates a PrintHeader object. This object encapsulates all the elements | 9 * Creates a PrintHeader object. This object encapsulates all the elements |
10 * and logic related to the top part of the left pane in print_preview.html. | 10 * and logic related to the top part of the left pane in print_preview.html. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 var pagesLabel = localStrings.getString('printPreviewPageLabelPlural'); | 134 var pagesLabel = localStrings.getString('printPreviewPageLabelPlural'); |
135 | 135 |
136 if (printToPDF) | 136 if (printToPDF) |
137 summaryLabel = localStrings.getString('printPreviewPageLabelSingular'); | 137 summaryLabel = localStrings.getString('printPreviewPageLabelSingular'); |
138 | 138 |
139 if (!printToPDF && copiesSettings.twoSidedCheckbox.checked) | 139 if (!printToPDF && copiesSettings.twoSidedCheckbox.checked) |
140 numOfSheets = Math.ceil(numOfSheets / 2); | 140 numOfSheets = Math.ceil(numOfSheets / 2); |
141 numOfSheets *= copies; | 141 numOfSheets *= copies; |
142 | 142 |
143 if (numOfSheets > 1) { | 143 if (numOfSheets > 1) { |
144 summaryLabel = printToPDF ? pagesLabel : | 144 summaryLabel = printToPDF ? pagesLabel : |
145 localStrings.getString('printPreviewSheetsLabelPlural'); | 145 localStrings.getString('printPreviewSheetsLabelPlural'); |
146 } | 146 } |
147 | 147 |
148 var html = ''; | 148 var html = ''; |
149 if (pageSet.length * copies != numOfSheets) { | 149 if (pageSet.length * copies != numOfSheets) { |
150 numOfPagesText = pageSet.length * copies; | 150 numOfPagesText = pageSet.length * copies; |
151 html = localStrings.getStringF('printPreviewSummaryFormatLong', | 151 html = localStrings.getStringF('printPreviewSummaryFormatLong', |
152 '<b>' + numOfSheets + '</b>', | 152 '<b>' + numOfSheets + '</b>', |
153 '<b>' + summaryLabel + '</b>', | 153 '<b>' + summaryLabel + '</b>', |
154 numOfPagesText, pagesLabel); | 154 numOfPagesText, pagesLabel); |
155 } else { | 155 } else { |
156 html = localStrings.getStringF('printPreviewSummaryFormatShort', | 156 html = localStrings.getStringF('printPreviewSummaryFormatShort', |
157 '<b>' + numOfSheets + '</b>', | 157 '<b>' + numOfSheets + '</b>', |
158 '<b>' + summaryLabel + '</b>'); | 158 '<b>' + summaryLabel + '</b>'); |
159 } | 159 } |
160 | 160 |
161 // Removing extra spaces from within the string. | 161 // Removing extra spaces from within the string. |
162 html = html.replace(/\s{2,}/g, ' '); | 162 html = html.replace(/\s{2,}/g, ' '); |
163 this.summary_.innerHTML = html; | 163 this.summary_.innerHTML = html; |
164 }, | 164 }, |
165 }; | 165 }; |
166 | 166 |
167 return { | 167 return { |
168 PrintHeader: PrintHeader, | 168 PrintHeader: PrintHeader, |
169 }; | 169 }; |
170 }); | 170 }); |
OLD | NEW |