From bae74e1eec221b037431a51c571f25b0cced722c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 12 Jan 2017 11:16:25 +0100 Subject: [PATCH] ChartPicker: Strict-Modus & Warnungen von jshint beseitigt --- js/autocomplete_chart.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/autocomplete_chart.js b/js/autocomplete_chart.js index 557b94557..6e389cffc 100644 --- a/js/autocomplete_chart.js +++ b/js/autocomplete_chart.js @@ -1,4 +1,6 @@ namespace('kivi', function(k){ + "use strict"; + k.ChartPicker = function($real, options) { // short circuit in case someone double inits us if ($real.data("chart_picker")) @@ -115,7 +117,7 @@ namespace('kivi', function(k){ if (state == STATES.PICKED) { annotate_state(); return true - } else if (state == STATES.UNDEFINED && $dummy.val() == '') + } else if (state == STATES.UNDEFINED && $dummy.val() === '') set_item({}) else { last_unverified_dummy = $dummy.val(); @@ -127,7 +129,7 @@ namespace('kivi', function(k){ function annotate_state () { if (state == STATES.PICKED) $dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED); - else if (state == STATES.UNDEFINED && $dummy.val() == '') + else if (state == STATES.UNDEFINED && $dummy.val() === '') $dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED); else { last_unverified_dummy = $dummy.val(); @@ -143,7 +145,7 @@ namespace('kivi', function(k){ }, ajax_data(function(){ var val = $('#chart_picker_filter').val(); return val === undefined ? '' : val })), success: function(data){ $('#chart_picker_result').html(data) } }); - }; + } function result_timer (event) { if (!$('hide_chart_details').prop('checked')) { @@ -162,7 +164,7 @@ namespace('kivi', function(k){ function close_popup() { $('#chart_selection').dialog('close'); - }; + } function handle_changed_text(callbacks) { $.ajax({ @@ -183,7 +185,7 @@ namespace('kivi', function(k){ annotate_state(); } }); - }; + } $dummy.autocomplete({ source: function(req, rsp) { @@ -214,7 +216,7 @@ namespace('kivi', function(k){ $dummy.keydown(function(event){ if (event.which == KEY.ENTER || event.which == KEY.TAB) { // if string is empty assume they want to delete - if ($dummy.val() == '') { + if ($dummy.val() === '') { set_item({}); return true; } else if (state == STATES.PICKED) { -- 2.20.1