diff options
11 files changed, 58 insertions, 49 deletions
diff --git a/chrome/browser/resources/print_preview/color_settings.js b/chrome/browser/resources/print_preview/color_settings.js index 37741ed..b389d6b 100644 --- a/chrome/browser/resources/print_preview/color_settings.js +++ b/chrome/browser/resources/print_preview/color_settings.js @@ -46,7 +46,7 @@ cr.define('print_preview', function() { */ get colorMode() { return this.bwRadioButton_.checked ? - this.printerColorModelForBlack_: + this.printerColorModelForBlack_ : this.printerColorModelForColor_; }, diff --git a/chrome/browser/resources/print_preview/layout_settings.js b/chrome/browser/resources/print_preview/layout_settings.js index 7f84e14..a341ce8 100644 --- a/chrome/browser/resources/print_preview/layout_settings.js +++ b/chrome/browser/resources/print_preview/layout_settings.js @@ -50,14 +50,14 @@ cr.define('print_preview', function() { * @return {boolean} true if the chosen layout mode has changed since last * time the state was updated. */ - hasChanged_ : function() { - return this.isLandscape() != this.wasLandscape_; + hasChanged_: function() { + return this.isLandscape() != this.wasLandscape_; }, /** * Saves the currently selected layout mode. Used in |this.hasChanged_|. */ - updateState : function() { + updateState: function() { this.wasLandscape_ = this.isLandscape(); }, diff --git a/chrome/browser/resources/print_preview/margin_settings.js b/chrome/browser/resources/print_preview/margin_settings.js index 1bfed18..92ba9cb 100644 --- a/chrome/browser/resources/print_preview/margin_settings.js +++ b/chrome/browser/resources/print_preview/margin_settings.js @@ -169,7 +169,7 @@ cr.define('print_preview', function() { * locale. * @param {string} numberFormat Is the formatted version of a sample number, * sent from the backend. - * @oaram {number} measurementSystem 0 for SI (aka metric system), 1 for the + * @param {number} measurementSystem 0 for SI (aka metric system), 1 for the * system used in the US. Note: Mathces UMeasurementSystem enum in * third_party/icu/public/i18n/unicode/ulocdata.h. */ @@ -228,7 +228,7 @@ cr.define('print_preview', function() { * |margin{Top|Bottom|Left|Right}| attributes are missing. */ setLastUsedMargins: function(lastUsedMarginsSettings) { - var lastUsedMarginsType = lastUsedMarginsSettings['marginsType'] + var lastUsedMarginsType = lastUsedMarginsSettings['marginsType']; this.forceMarginsUIOnPDFLoad_ = lastUsedMarginsType == MarginSettings.MARGINS_VALUE_CUSTOM; this.marginList_.selectedIndex = diff --git a/chrome/browser/resources/print_preview/margin_utils.js b/chrome/browser/resources/print_preview/margin_utils.js index 78dba89..08feb94 100644 --- a/chrome/browser/resources/print_preview/margin_utils.js +++ b/chrome/browser/resources/print_preview/margin_utils.js @@ -50,7 +50,7 @@ cr.define('print_preview', function() { WITHIN_RANGE: 1, TOO_BIG: 2, NOT_A_NUMBER: 3 - } + }; /** * Checks whether |value| is within range [0, limit]. diff --git a/chrome/browser/resources/print_preview/margins_ui.js b/chrome/browser/resources/print_preview/margins_ui.js index 5378663..994c4660 100644 --- a/chrome/browser/resources/print_preview/margins_ui.js +++ b/chrome/browser/resources/print_preview/margins_ui.js @@ -79,7 +79,7 @@ cr.define('print_preview', function() { /** * Updates the state of the margins UI. - * @param {print_preview.Rect} + * @param {print_preview.Rect} marginsRectangle * @param {Margins} marginValues * @param {array} valueLimits */ @@ -129,7 +129,7 @@ cr.define('print_preview', function() { applyClippingMask_: function() { var bottom = previewArea.height; var right = previewArea.width; - this.style.clip = "rect(0, " + right + "px, " + bottom + "px, 0)"; + this.style.clip = 'rect(0, ' + right + 'px, ' + bottom + 'px, 0)'; }, /** diff --git a/chrome/browser/resources/print_preview/margins_ui_pair.js b/chrome/browser/resources/print_preview/margins_ui_pair.js index 8794eb8..0d0eb4b 100644 --- a/chrome/browser/resources/print_preview/margins_ui_pair.js +++ b/chrome/browser/resources/print_preview/margins_ui_pair.js @@ -165,7 +165,7 @@ cr.define('print_preview', function() { /** * Executes whenever a mousedown event occurs on |this| or its child nodes. - * @parameter {MouseEvent} e The event that occured. + * @param {MouseEvent} e The event that occured. */ onMouseDown_: function(e) { if (e.button != 0) @@ -193,7 +193,7 @@ cr.define('print_preview', function() { */ moveTo: function(point) { if (this.isTop_() || this.isBottom_()) - this.style.top = point.y - this.mousePointerOffset.y + 'px'; + this.style.top = point.y - this.mousePointerOffset.y + 'px'; else this.style.left = point.x - this.mousePointerOffset.x + 'px'; }, diff --git a/chrome/browser/resources/print_preview/print_header.js b/chrome/browser/resources/print_preview/print_header.js index 6443b59..977a649 100644 --- a/chrome/browser/resources/print_preview/print_header.js +++ b/chrome/browser/resources/print_preview/print_header.js @@ -141,7 +141,7 @@ cr.define('print_preview', function() { numOfSheets *= copies; if (numOfSheets > 1) { - summaryLabel = printToPDF ? pagesLabel : + summaryLabel = printToPDF ? pagesLabel : localStrings.getString('printPreviewSheetsLabelPlural'); } diff --git a/chrome/browser/resources/print_preview/print_preview.js b/chrome/browser/resources/print_preview/print_preview.js index 824b5dc..837e2c0 100644 --- a/chrome/browser/resources/print_preview/print_preview.js +++ b/chrome/browser/resources/print_preview/print_preview.js @@ -125,8 +125,8 @@ var customEvents = { // Fired when the print button needs to be updated. UPDATE_PRINT_BUTTON: 'updatePrintButton', // Fired when the print summary needs to be updated. - UPDATE_SUMMARY: 'updateSummary', -} + UPDATE_SUMMARY: 'updateSummary' +}; /** * Window onload handler, sets up the page and starts print preview by getting @@ -175,7 +175,6 @@ function onLoad() { } /** - * @param {string} initiatorTabTitle The title of the initiator tab. * @param {object} initialSettings An object containing all the initial * settings. */ @@ -348,7 +347,7 @@ function reloadPrintersList() { /** * Turn on the integration of Cloud Print. - * @param {string} cloudPrintUrl The URL to use for cloud print servers. + * @param {string} cloudPrintURL The URL to use for cloud print servers. */ function setUseCloudPrint(cloudPrintURL) { useCloudPrint = true; @@ -476,7 +475,7 @@ function isExpectedPreviewResponse(previewResponseId) { * @return {string} The name of the currently selected printer. */ function getSelectedPrinterName() { - var printerList = $('printer-list') + var printerList = $('printer-list'); var selectedPrinter = printerList.selectedIndex; if (selectedPrinter < 0) return ''; @@ -611,7 +610,7 @@ function fileSelectionCompleted() { /** * Set the default printer. If there is one, generate a print preview. - * @param {string} printer Name of the default printer. Empty if none. + * @param {string} printerName Name of the default printer. Empty if none. * @param {string} cloudPrintData Cloud print related data to restore if * the default printer is a cloud printer. */ @@ -715,6 +714,8 @@ function createDestinationListOption(optionText, optionValue, isDefault, * @param {string} optionValue specifies the option value. * @param {boolean} isDefault is true if the option needs to be selected. * @param {boolean} isDisabled is true if the option needs to be disabled. + * @param {boolean} isSeparator is true if the option serves just as a + * separator. * @return {Object} The created option. */ function addDestinationListOption(optionText, optionValue, isDefault, @@ -736,6 +737,8 @@ function addDestinationListOption(optionText, optionValue, isDefault, * @param {string} optionValue specifies the option value. * @param {boolean} isDefault is true if the option needs to be selected. * @param {boolean} isDisabled is true if the option needs to be disabled. + * @param {boolean} isSeparator is true if the option is a visual separator and + * needs to be disabled. * @return {Object} The created option. */ function addDestinationListOptionAtPosition(position, @@ -877,8 +880,10 @@ function reloadPreviewPages(previewUid, previewResponseId) { cr.dispatchSimpleEvent(document, customEvents.UPDATE_PRINT_BUTTON); checkAndHideOverlayLayerIfValid(); var pageSet = pageSettings.previouslySelectedPages; - for (var i = 0; i < pageSet.length; i++) - $('pdf-viewer').loadPreviewPage(getPageSrcURL(previewUid, pageSet[i]-1), i); + for (var i = 0; i < pageSet.length; i++) { + $('pdf-viewer').loadPreviewPage( + getPageSrcURL(previewUid, pageSet[i] - 1), i); + } hasPendingPreviewRequest = false; isPrintReadyMetafileReady = true; @@ -928,7 +933,6 @@ function onDidPreviewPage(pageNumber, previewUid, previewResponseId) { * Update the print preview when new preview data is available. * Create the PDF plugin as needed. * Called from PrintPreviewUI::PreviewDataIsAvailable(). - * @param {boolean} modifiable If the preview is modifiable. * @param {string} previewUid Preview unique identifier. * @param {number} previewResponseId The preview request id that resulted in * this response. @@ -1069,6 +1073,7 @@ function checkCompatiblePluginExists() { /** * Sets the default values and sends a request to regenerate preview data. * Resets the margin options only if |resetMargins| is true. + * @param {boolean} resetMargins True if margin settings should be resetted. */ function setDefaultValuesAndRegeneratePreview(resetMargins) { if (resetMargins) @@ -1093,7 +1098,7 @@ PrintSettings.prototype.save = function() { this.deviceName = getSelectedPrinterName(); this.isLandscape = layoutSettings.isLandscape(); this.hasHeaderFooter = headerFooterSettings.hasHeaderFooter(); -} +}; /** * Updates the title of the print preview tab according to |initiatorTabTitle|. diff --git a/chrome/browser/resources/print_preview/print_preview_animations.js b/chrome/browser/resources/print_preview/print_preview_animations.js index 87752c6..46aac35 100644 --- a/chrome/browser/resources/print_preview/print_preview_animations.js +++ b/chrome/browser/resources/print_preview/print_preview_animations.js @@ -26,7 +26,7 @@ function addAnimation(code) { * @return {string} The css code for the fade in animation. */ function getFadeInAnimationCode(targetHeight) { - return '0% { opacity: 0; height: 0; } ' + + return '0% { opacity: 0; height: 0; } ' + '80% { height: ' + (targetHeight + 4) + 'px; }' + '100% { opacity: 1; height: ' + targetHeight + 'px; }'; } @@ -68,7 +68,7 @@ function fadeOutElement(el) { var eventTracker = new EventTracker(); eventTracker.add(el, 'webkitTransitionEnd', onFadeOutTransitionEnd.bind(el, animName, eventTracker), - false ); + false); el.classList.add('closing'); el.classList.remove('visible'); } @@ -76,8 +76,8 @@ function fadeOutElement(el) { /** * Executes when a fade out animation ends. * @param {string} animationName The name of the animation to be removed. - * @param {EventTracker} The |EventTracker| object that was used for adding this - * listener. + * @param {EventTracker} eventTracker The |EventTracker| object that was used + * for adding this listener. * @param {WebkitTransitionEvent} event The event that triggered this listener. */ function onFadeOutTransitionEnd(animationName, eventTracker, event) { @@ -90,8 +90,8 @@ function onFadeOutTransitionEnd(animationName, eventTracker, event) { /** * Executes when a fade in animation ends. - * @param{EventTracker} The |EventTracker| object that was used for adding this - * listener. + * @param {EventTracker} eventTracker The |EventTracker| object that was used + * for adding this listener. * @param {WebkitAnimationEvent} event The event that triggered this listener. */ function onFadeInAnimationEnd(eventTracker, event) { diff --git a/chrome/browser/resources/print_preview/print_preview_cloud.js b/chrome/browser/resources/print_preview/print_preview_cloud.js index 87878f4e..3c8a10f 100644 --- a/chrome/browser/resources/print_preview/print_preview_cloud.js +++ b/chrome/browser/resources/print_preview/print_preview_cloud.js @@ -88,12 +88,12 @@ cr.define('cloudprint', function() { params = new Array; } if (lastXSRFToken.length != 0) { - params.push("xsrf=" + lastXSRFToken); + params.push('xsrf=' + lastXSRFToken); } if (params.length != 0) { - url = url + "?"; + url = url + '?'; for (param in params) { - url = url + params[param] + "&"; + url = url + params[param] + '&'; } } xhr.open(method, url, true); @@ -215,10 +215,10 @@ cr.define('cloudprint', function() { printer.cloudPrintOptions.colorOption.type = cap.type; for (var option in cap.options) { var opt = cap.options[option]; - if (opt.name == "Color") { + if (opt.name == 'Color') { printer.cloudPrintOptions.colorOnOption = opt; } - if (opt.name == "Grey_K") { + if (opt.name == 'Grey_K') { printer.cloudPrintOptions.colorOffOption = opt; } if (opt.default) { @@ -323,7 +323,7 @@ cr.define('cloudprint', function() { if (isCloudPrint(printer)) { return JSON.stringify(printer.cloudPrintOptions); } else { - return ""; + return ''; } } diff --git a/chrome/browser/resources/print_preview/print_preview_utils.js b/chrome/browser/resources/print_preview/print_preview_utils.js index e16c445..9c19241 100644 --- a/chrome/browser/resources/print_preview/print_preview_utils.js +++ b/chrome/browser/resources/print_preview/print_preview_utils.js @@ -3,9 +3,9 @@ // found in the LICENSE file. /** - * Returns true if |toTest| contains only digits. Leading and trailing - * whitespace is allowed. * @param {string} toTest The string to be tested. + * @return {boolean} True if |toTest| contains only digits. Leading and trailing + * whitespace is allowed. */ function isInteger(toTest) { var numericExp = /^\s*[0-9]+\s*$/; @@ -25,7 +25,7 @@ function isPositiveInteger(value) { /** * Returns true if the contents of the two arrays are equal. * @param {Array} array1 The first array. - * @param {Array} array1 The second array. + * @param {Array} array2 The second array. * * @return {boolean} true if the arrays are equal. */ @@ -33,7 +33,7 @@ function areArraysEqual(array1, array2) { if (array1.length != array2.length) return false; for (var i = 0; i < array1.length; i++) - if(array1[i] != array2[i]) + if (array1[i] != array2[i]) return false; return true; } @@ -41,18 +41,18 @@ function areArraysEqual(array1, array2) { /** * Removes duplicate elements from |inArray| and returns a new array. * |inArray| is not affected. It assumes that |inArray| is already sorted. - * - * @param {Array} inArray The array to be processed. + * @param {array} inArray The array to be processed. + * @return {array} The array after processing. */ function removeDuplicates(inArray) { var out = []; - if(inArray.length == 0) + if (inArray.length == 0) return out; out.push(inArray[0]); for (var i = 1; i < inArray.length; ++i) - if(inArray[i] != inArray[i - 1]) + if (inArray[i] != inArray[i - 1]) out.push(inArray[i]); return out; } @@ -75,6 +75,8 @@ function removeDuplicates(inArray) { * Example: "34853253" is valid. * Example: "1-4, 9, 3-6, 10, 11" is valid. * + * @param {string} pageRangeText The text to be checked. + * @param {number} totalPageCount The total number of pages. * @return {boolean} true if the |pageRangeText| is valid. */ function isPageRangeTextValid(pageRangeText, totalPageCount) { @@ -112,8 +114,9 @@ function isPageRangeTextValid(pageRangeText, totalPageCount) { * eliminated. If |pageRangeText| is not valid according to * isPageRangeTextValid(), or |totalPageCount| is undefined an empty list is * returned. - * - * @return {Array} + * @param {string} pageRangeText The text to be checked. + * @param {number} totalPageCount The total number of pages. + * @return {array} A list of all pages. */ function pageRangeTextToPageList(pageRangeText, totalPageCount) { var pageList = []; @@ -146,17 +149,16 @@ function pageRangeTextToPageList(pageRangeText, totalPageCount) { } /** - * Returns the contents of |pageList| in ascending order and without any - * duplicates. |pageList| is not affected. - * - * @return {Array} + * @param {array} pageList The list to be processed. + * @return {array} The contents of |pageList| in ascending order and without any + * duplicates. |pageList| is not affected. */ function pageListToPageSet(pageList) { var pageSet = []; if (pageList.length == 0) return pageSet; pageSet = pageList.slice(0); - pageSet.sort(function(a,b) { return a - b; }); + pageSet.sort(function(a, b) { return a - b; }); pageSet = removeDuplicates(pageSet); return pageSet; } @@ -165,6 +167,8 @@ function pageListToPageSet(pageList) { * Converts |pageSet| to page ranges. It squashes whenever possible. * Example: '1-2,3,5-7' becomes 1-3,5-7. * + * @param {array} pageSet The set of pages to be processed. Callers should + * ensure that no duplicates exist. * @return {Array} an array of page range objects. A page range object has * fields 'from' and 'to'. */ |