Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Unified Diff: chrome/browser/resources/print_preview/print_preview_utils.js

Issue 10108001: Refactor print preview web ui (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/print_preview/print_preview_utils.js
diff --git a/chrome/browser/resources/print_preview/print_preview_utils.js b/chrome/browser/resources/print_preview/print_preview_utils.js
index c761650726ca5bbda8a2f0cc251d56fcdde84297..bee66b693ec9c771ccb754849893ec4c824c36d1 100644
--- a/chrome/browser/resources/print_preview/print_preview_utils.js
+++ b/chrome/browser/resources/print_preview/print_preview_utils.js
@@ -251,17 +251,19 @@ function convertPointsToMillimeters(value) {
}
/**
- * Parses |numberFormat| and extracts the symbols used for the thousands point
- * and decimal point.
- * @param {string} numberFormat The formatted version of the number 12345678.
- * @return {!Array.<string>} The extracted symbols in the order
- * [thousandsSymbol, decimalSymbol]]. For example
- * parseNumberFormat("123,456.78") returns [",", "."].
+ * Shows or hides an element.
+ * @param {Element} element Element to show or hide.
+ * @param {boolean} isVisible Whether the element should be visible or not.
*/
-function parseNumberFormat(numberFormat) {
- if (!numberFormat)
- numberFormat = '';
- var regex = /^(\d+)(\W{0,1})(\d+)(\W{0,1})(\d+)$/;
- var matches = numberFormat.match(regex) || ['', '', ',', '', '.'];
- return [matches[2], matches[4]];
+function setIsVisible(element, isVisible) {
+ element.style.display = isVisible ? '' : 'none';
+}
+
+/**
+ * @param {Array.<object>} array Array to check for item.
+ * @param {object} item Item to look for in array.
+ * @return {boolean} Whether the item is in the array.
+ */
+function arrayContains(array, item) {
+ return array.indexOf(item) != -1;
}

Powered by Google App Engine
This is Rietveld 408576698