From 308af741dbc5b5db482290763b755618b3268b80 Mon Sep 17 00:00:00 2001 From: Thai Tran Date: Wed, 20 Aug 2014 13:40:19 -0700 Subject: [PATCH] Fixed jshint gating errors Change-Id: If065b47bc42312918cb65b1f677f6bdfcfb4f709 Closes-Bug: #1359395 --- horizon/static/horizon/js/horizon.d3linechart.js | 2 +- horizon/static/horizon/js/horizon.d3piechart.js | 13 +++++++------ horizon/static/horizon/js/horizon.forms.js | 10 +++++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/horizon/static/horizon/js/horizon.d3linechart.js b/horizon/static/horizon/js/horizon.d3linechart.js index c5c62cc114..27db059c8a 100644 --- a/horizon/static/horizon/js/horizon.d3linechart.js +++ b/horizon/static/horizon/js/horizon.d3linechart.js @@ -419,7 +419,7 @@ horizon.d3_line_chart = { */ self.render = function(){ var self = this; - var last_point = undefined, last_point_color = undefined; + var last_point, last_point_color; $.map(self.series, function (serie) { serie.color = last_point_color = self.color(serie.name); diff --git a/horizon/static/horizon/js/horizon.d3piechart.js b/horizon/static/horizon/js/horizon.d3piechart.js index b0e42a713e..f4a9a45804 100644 --- a/horizon/static/horizon/js/horizon.d3piechart.js +++ b/horizon/static/horizon/js/horizon.d3piechart.js @@ -141,9 +141,10 @@ horizon.d3_pie_chart_distribution = { self.keys = []; for (var j = 0; j < parts.length; j++) { var key_value = parts[j].split("="); - var d = {}; - d["key"] = key_value[0]; - d["value"] = key_value[1]; + var d = { + key: key_value[0], + value: key_value[1] + }; self.data.push(d); self.keys.push(key_value[0]); } @@ -159,7 +160,7 @@ horizon.d3_pie_chart_distribution = { var total = 0; for (var j = 0; j < self.data.length; j++) { - total = total + parseInt(self.data[j]["value"]); + total = total + parseInt(self.data[j].value); } var initial_data = []; @@ -233,8 +234,8 @@ horizon.d3_pie_chart_distribution = { } var value = 0; for (var j = 0; j < self.data.length; j++) { - if (self.data[j]["key"] == d) { - value = self.data[j]["value"]; + if (self.data[j].key == d) { + value = self.data[j].value; break; } } diff --git a/horizon/static/horizon/js/horizon.forms.js b/horizon/static/horizon/js/horizon.forms.js index 2be9692f6e..8b62994217 100644 --- a/horizon/static/horizon/js/horizon.forms.js +++ b/horizon/static/horizon/js/horizon.forms.js @@ -5,7 +5,7 @@ horizon.forms = { var $option = $(this).find("option:selected"); var $form = $(this).closest('form'); var $volName = $form.find('input#id_name'); - if ($volName.val() == "") { + if ($volName.val() === "") { $volName.val($option.data("name")); } var $volSize = $form.find('input#id_size'); @@ -22,7 +22,7 @@ horizon.forms = { var $option = $(this).find("option:selected"); var $form = $(this).closest('form'); var $volName = $form.find('input#id_name'); - if ($volName.val() == "") { + if ($volName.val() === "") { $volName.val($option.data("name")); } var $volSize = $form.find('input#id_size'); @@ -39,7 +39,7 @@ horizon.forms = { var $option = $(this).find("option:selected"); var $form = $(this).closest('form'); var $volName = $form.find('input#id_name'); - if ($volName.val() == "") { + if ($volName.val() === "") { $volName.val($option.data("name")); } var $volSize = $form.find('input#id_size'); @@ -64,7 +64,7 @@ horizon.forms = { */ handle_object_upload_source: function() { $("div.table_wrapper, #modal_wrapper").on("change", "input#id_object_file", function(evt) { - if (typeof($(this).attr("filename")) == 'undefined') { + if (typeof($(this).attr("filename")) === 'undefined') { $(this).attr("filename", ""); } var $form = $(this).closest("form"); @@ -77,7 +77,7 @@ horizon.forms = { $filename = $filename.substring(1); } - if (typeof($obj_name.val()) == 'undefined' || $(this).attr("filename").localeCompare($obj_name.val()) == 0) { + if (typeof($obj_name.val()) === 'undefined' || $(this).attr("filename").localeCompare($obj_name.val()) === 0) { $obj_name.val($filename); $(this).attr("filename", $filename); }