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 var localStrings = new LocalStrings(); | 5 var localStrings = new LocalStrings(); |
6 | 6 |
7 // The total page count of the previewed document regardless of which pages the | 7 // The total page count of the previewed document regardless of which pages the |
8 // user has selected. | 8 // user has selected. |
9 var totalPageCount; | 9 var totalPageCount; |
10 | 10 |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 return; | 780 return; |
781 } | 781 } |
782 | 782 |
783 if (!isSelectedPagesValid()) { | 783 if (!isSelectedPagesValid()) { |
784 printSummary.innerHTML = ''; | 784 printSummary.innerHTML = ''; |
785 return; | 785 return; |
786 } | 786 } |
787 | 787 |
788 var pageSet = getSelectedPagesSet(); | 788 var pageSet = getSelectedPagesSet(); |
789 var numOfSheets = pageSet.length; | 789 var numOfSheets = pageSet.length; |
790 var sheetsLabel = localStrings.getString('printPreviewSheetsLabelSingular'); | 790 var summaryLabel = localStrings.getString('printPreviewSheetsLabelSingular'); |
791 var numOfPagesText = ''; | 791 var numOfPagesText = ''; |
792 var pagesLabel = ''; | 792 var pagesLabel = localStrings.getString('printPreviewPageLabelPlural'); |
| 793 |
| 794 if (printToPDF) |
| 795 summaryLabel = localStrings.getString('printPreviewPageLabelSingular'); |
793 | 796 |
794 if (!printToPDF && isTwoSided()) | 797 if (!printToPDF && isTwoSided()) |
795 numOfSheets = Math.ceil(numOfSheets / 2); | 798 numOfSheets = Math.ceil(numOfSheets / 2); |
796 numOfSheets *= copies; | 799 numOfSheets *= copies; |
797 | 800 |
798 if (numOfSheets > 1) | 801 if (numOfSheets > 1) { |
799 sheetsLabel = localStrings.getString('printPreviewSheetsLabelPlural'); | 802 if (printToPDF) |
| 803 summaryLabel = pagesLabel; |
| 804 else |
| 805 summaryLabel = localStrings.getString('printPreviewSheetsLabelPlural'); |
| 806 } |
800 | 807 |
801 var html = ''; | 808 var html = ''; |
802 if (pageSet.length * copies != numOfSheets) { | 809 if (pageSet.length * copies != numOfSheets) { |
803 numOfPagesText = pageSet.length * copies; | 810 numOfPagesText = pageSet.length * copies; |
804 pagesLabel = localStrings.getString('printPreviewPageLabelPlural'); | |
805 html = localStrings.getStringF('printPreviewSummaryFormatLong', | 811 html = localStrings.getStringF('printPreviewSummaryFormatLong', |
806 '<b>' + numOfSheets + '</b>', | 812 '<b>' + numOfSheets + '</b>', |
807 '<b>' + sheetsLabel + '</b>', | 813 '<b>' + summaryLabel + '</b>', |
808 numOfPagesText, pagesLabel); | 814 numOfPagesText, pagesLabel); |
809 } else | 815 } else |
810 html = localStrings.getStringF('printPreviewSummaryFormatShort', | 816 html = localStrings.getStringF('printPreviewSummaryFormatShort', |
811 '<b>' + numOfSheets + '</b>', | 817 '<b>' + numOfSheets + '</b>', |
812 '<b>' + sheetsLabel + '</b>'); | 818 '<b>' + summaryLabel + '</b>'); |
813 | 819 |
814 // Removing extra spaces from within the string. | 820 // Removing extra spaces from within the string. |
815 html = html.replace(/\s{2,}/g, ' '); | 821 html = html.replace(/\s{2,}/g, ' '); |
816 printSummary.innerHTML = html; | 822 printSummary.innerHTML = html; |
817 } | 823 } |
818 | 824 |
819 /** | 825 /** |
820 * Handles a click event on the two-sided option. | 826 * Handles a click event on the two-sided option. |
821 */ | 827 */ |
822 function handleTwoSidedClick() { | 828 function handleTwoSidedClick() { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 this.isLandscape = ''; | 957 this.isLandscape = ''; |
952 } | 958 } |
953 | 959 |
954 /** | 960 /** |
955 * Takes a snapshot of the print settings. | 961 * Takes a snapshot of the print settings. |
956 */ | 962 */ |
957 PrintSettings.prototype.save = function() { | 963 PrintSettings.prototype.save = function() { |
958 this.deviceName = getSelectedPrinterName(); | 964 this.deviceName = getSelectedPrinterName(); |
959 this.isLandscape = isLandscape(); | 965 this.isLandscape = isLandscape(); |
960 } | 966 } |
OLD | NEW |