| 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 = -1; | 9 var totalPageCount = -1; |
| 10 | 10 |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 resetPageRangeFieldTimer(); | 578 resetPageRangeFieldTimer(); |
| 579 updatePrintButtonState(); | 579 updatePrintButtonState(); |
| 580 updatePrintSummary(); | 580 updatePrintSummary(); |
| 581 } | 581 } |
| 582 | 582 |
| 583 /** | 583 /** |
| 584 * Updates the state of the increment/decrement buttons based on the current | 584 * Updates the state of the increment/decrement buttons based on the current |
| 585 * 'copies' value. | 585 * 'copies' value. |
| 586 */ | 586 */ |
| 587 function updateCopiesButtonsState() { | 587 function updateCopiesButtonsState() { |
| 588 var copiesField = $('copies'); |
| 588 if (!isNumberOfCopiesValid()) { | 589 if (!isNumberOfCopiesValid()) { |
| 589 $('copies').classList.add('invalid'); | 590 copiesField.classList.add('invalid'); |
| 590 $('increment').disabled = true; | 591 $('increment').disabled = false; |
| 591 $('decrement').disabled = true; | 592 $('decrement').disabled = false; |
| 592 showInvalidHint($('copies-hint')); | 593 showInvalidHint($('copies-hint')); |
| 593 } | 594 } |
| 594 else { | 595 else { |
| 595 $('copies').classList.remove('invalid'); | 596 copiesField.classList.remove('invalid'); |
| 596 $('increment').disabled = false; | 597 $('increment').disabled = (getCopies() == copiesField.max) ? true : false; |
| 597 $('decrement').disabled = false; | 598 $('decrement').disabled = (getCopies() == copiesField.min) ? true : false; |
| 598 hideInvalidHint($('copies-hint')); | 599 hideInvalidHint($('copies-hint')); |
| 599 } | 600 } |
| 600 } | 601 } |
| 601 | 602 |
| 602 /** | 603 /** |
| 603 * Updates the print summary based on the currently selected user options. | 604 * Updates the print summary based on the currently selected user options. |
| 604 * | 605 * |
| 605 */ | 606 */ |
| 606 function updatePrintSummary() { | 607 function updatePrintSummary() { |
| 607 var copies = getCopies(); | 608 var copies = getCopies(); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 for (var i = 0; i < array1.length; i++) | 886 for (var i = 0; i < array1.length; i++) |
| 886 if(array1[i] != array2[i]) | 887 if(array1[i] != array2[i]) |
| 887 return false; | 888 return false; |
| 888 return true; | 889 return true; |
| 889 } | 890 } |
| 890 | 891 |
| 891 /** | 892 /** |
| 892 * Executed when the 'increment' or 'decrement' button is clicked. | 893 * Executed when the 'increment' or 'decrement' button is clicked. |
| 893 */ | 894 */ |
| 894 function onCopiesButtonsClicked(sign) { | 895 function onCopiesButtonsClicked(sign) { |
| 895 if($('copies').value == 1 && (sign == -1)) | 896 var copiesField = $('copies'); |
| 896 return; | 897 if (!isNumberOfCopiesValid()) |
| 897 $('copies').value = getCopies() + sign * 1; | 898 copiesField.value = 1; |
| 899 else { |
| 900 var newValue = getCopies() + sign * 1; |
| 901 if (newValue < copiesField.min || newValue > copiesField.max) |
| 902 return; |
| 903 copiesField.value = newValue; |
| 904 } |
| 898 copiesFieldChanged(); | 905 copiesFieldChanged(); |
| 899 } | 906 } |
| 900 | 907 |
| OLD | NEW |