From 14ea2141f073e01b01708740414a17668a6aef3b Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Fri, 29 Mar 2013 22:18:55 -0400 Subject: [PATCH] Closurize rgbcolor.js --- closure-todo.txt | 3 +++ rgbcolor/rgbcolor.js | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/closure-todo.txt b/closure-todo.txt index c9d42b7..9852856 100644 --- a/closure-todo.txt +++ b/closure-todo.txt @@ -30,6 +30,9 @@ Plugins: - plugins/grid.js - plugins/legend.js +Others: +x rgbcolor/rgbcolor.js + Here's a command that can be used to build dygraphs using the closure compiler: java -jar ../../closure-compiler-read-only/build/compiler.jar --js=dygraph-utils.js --js=dashed-canvas.js --js=dygraph-options-reference.js --js=dygraph-tickers.js --js=dygraph-gviz.js --js_output_file=/tmp/out.js --compilation_level ADVANCED_OPTIMIZATIONS --warning_level VERBOSE --externs dygraph-externs.js diff --git a/rgbcolor/rgbcolor.js b/rgbcolor/rgbcolor.js index 5a88244..bcdf94c 100644 --- a/rgbcolor/rgbcolor.js +++ b/rgbcolor/rgbcolor.js @@ -9,12 +9,21 @@ * http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-RGBColor * so renamed to "RGBColorParser" * + * Modifications by konigsberg: + * Make Closure-compatible. + * * @author Stoyan Stefanov * @link http://www.phpied.com/rgb-color-parser-in-javascript/ * @license Use it if you like it */ "use strict"; +/** + * Create a new instance. + * + * @param {string} color_string the string to be parsed. + * @constructor + */ function RGBColorParser(color_string) { this.ok = false; @@ -188,9 +197,9 @@ function RGBColorParser(color_string) example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'], process: function (bits){ return [ - parseInt(bits[1]), - parseInt(bits[2]), - parseInt(bits[3]) + parseInt(bits[1], 10), + parseInt(bits[2], 10), + parseInt(bits[3], 10) ]; } }, -- 2.7.4