From 83b0c192191d484d9909fc7041a534572d07c983 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Tue, 22 Jan 2013 14:35:37 -0500 Subject: [PATCH] lint checks mostly pass --- dygraph-options.js | 8 +++++--- dygraph-tickers.js | 2 +- dygraph-utils.js | 2 +- dygraph.js | 9 +++++---- plugins/axes.js | 4 ++-- plugins/range-selector.js | 2 +- plugins/unzoom.js | 16 ++++++++-------- 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/dygraph-options.js b/dygraph-options.js index 27d5efe..8ad5509 100644 --- a/dygraph-options.js +++ b/dygraph-options.js @@ -4,6 +4,8 @@ * Still tightly coupled to Dygraphs, we could remove some of that, you know. */ +/*jshint globalstrict:true, sub:true */ +/*global Dygraph:false */ "use strict"; /* @@ -68,8 +70,8 @@ DygraphOptions.axisToIndex_ = function(axis) { throw "Dygraphs only supports two y-axes, indexed from 0-1."; } if (typeof(axis) == "object") { - throw "Using objects for axis specification " - + "is not supported inside the 'series' option."; + throw "Using objects for axis specification " + + "is not supported inside the 'series' option."; } if (axis) { throw "Unknown axis : " + axis; @@ -216,7 +218,7 @@ DygraphOptions.prototype.getGlobalDefault_ = function(name) { return Dygraph.DEFAULT_ATTRS[name]; } return null; -} +}; /** * Get a value for a specific axis. If there is no specific value for the axis, diff --git a/dygraph-tickers.js b/dygraph-tickers.js index 80eb291..918d442 100644 --- a/dygraph-tickers.js +++ b/dygraph-tickers.js @@ -58,7 +58,7 @@ * middle of the years. */ -/*jshint globalstrict: true */ +/*jshint globalstrict:true, sub:true */ /*global Dygraph:false */ "use strict"; diff --git a/dygraph-utils.js b/dygraph-utils.js index 6ca025f..9f836e2 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -873,7 +873,7 @@ Dygraph.repeatAndCleanup = function(repeatFn, maxFrames, framePeriodInMillis, repeatFn(maxFrameArg); // Ensure final call with maxFrameArg. cleanupFn(); } else { - if (frameDelta != 0) { // Don't call repeatFn with duplicate frames. + if (frameDelta !== 0) { // Don't call repeatFn with duplicate frames. repeatFn(frameNumber); } loop(); diff --git a/dygraph.js b/dygraph.js index f0ced90..bcfd52f 100644 --- a/dygraph.js +++ b/dygraph.js @@ -44,7 +44,7 @@ */ /*jshint globalstrict: true */ -/*global DygraphLayout:false, DygraphCanvasRenderer:false, G_vmlCanvasManager:false */ +/*global DygraphLayout:false, DygraphCanvasRenderer:false, DygraphOptions:false, G_vmlCanvasManager:false */ "use strict"; /** @@ -599,7 +599,8 @@ Dygraph.prototype.getOption = function(name, opt_seriesName) { Dygraph.prototype.getOptionForAxis = function(name, axis) { return this.attributes_.getForAxis(name, axis); -} +}; + /** * @private * @param String} axis The name of the axis (i.e. 'x', 'y' or 'y2') @@ -2499,7 +2500,7 @@ Dygraph.prototype.computeYAxisRanges_ = function(extremes) { var includeZero = this.attributes_.getForAxis("includeZero", i); series = this.attributes_.seriesForAxis(i); - if (series.length == 0) { + if (series.length === 0) { // If no series are defined or visible then use a reasonable default axis.extremeRange = [0, 1]; } else { @@ -2804,7 +2805,7 @@ Dygraph.prototype.setXAxisOptions_ = function(isDate) { this.attrs_.axes.x.ticker = Dygraph.numericLinearTicks; this.attrs_.axes.x.axisLabelFormatter = this.attrs_.axes.x.valueFormatter; } -} +}; /** * Parses the value as a floating point number. This is like the parseFloat() diff --git a/plugins/axes.js b/plugins/axes.js index e74f289..15bb8f5 100644 --- a/plugins/axes.js +++ b/plugins/axes.js @@ -123,12 +123,12 @@ axes.prototype.willDrawChart = function(e) { lineHeight: "normal", // Something other than "normal" line-height screws up label positioning. overflow: "hidden" }; - } + }; var labelStyles = { x : makeLabelStyle('x'), y : makeLabelStyle('y'), - y2 : makeLabelStyle('y2'), + y2 : makeLabelStyle('y2') }; var makeDiv = function(txt, axis, prec_axis) { diff --git a/plugins/range-selector.js b/plugins/range-selector.js index e8c3efb..2c32fa5 100644 --- a/plugins/range-selector.js +++ b/plugins/range-selector.js @@ -166,7 +166,7 @@ rangeSelector.prototype.updateInterfaceStatus_ = function() { setTimeout(function() { dygraph.width_ = 0; dygraph.resize(); }, 1); } return enabled; -} +}; /** * @private diff --git a/plugins/unzoom.js b/plugins/unzoom.js index d81413a..726a1f6 100644 --- a/plugins/unzoom.js +++ b/plugins/unzoom.js @@ -19,15 +19,15 @@ // THE SOFTWARE. -/** +/** * @fileoverview Plug-in for providing unzoom-on-hover. * * @author konigsberg@google.com (Robert Konigsberg) */ Dygraph.Plugins.Unzoom = (function() { - + "use strict"; - + /** * Create a new instance. * @@ -40,10 +40,10 @@ Dygraph.Plugins.Unzoom = (function() { // because the unzoom button state can change even when the // mouse-over state hasn't. this.over_ = false; - }; - + }; + unzoom.prototype.toString = function() { - return 'Unzoom Plugin'; + return 'Unzoom Plugin'; }; unzoom.prototype.activate = function(g) { @@ -55,7 +55,7 @@ Dygraph.Plugins.Unzoom = (function() { unzoom.prototype.willDrawChart = function(e) { var g = e.dygraph; - if (this.button_ != null) { + if (this.button_ !== null) { // short-circuit: show the button only when we're moused over, and zoomed in. var showButton = g.isZoomed() && this.over_; this.show(showButton); @@ -76,7 +76,7 @@ Dygraph.Plugins.Unzoom = (function() { var self = this; this.button_.onclick = function() { g.resetZoom(); - } + }; g.addEvent(parent, 'mouseover', function() { if (g.isZoomed()) { -- 2.7.4