From 1d8fe39b8295a3ab4c00a266eae8fb6c3c98f4d7 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 20 Jan 2017 12:41:50 +0100 Subject: [PATCH] ProjectPicker: Strict-Modus & Warnungen von jshint beseitigt --- js/autocomplete_project.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/js/autocomplete_project.js b/js/autocomplete_project.js index fb2285fb6..923434027 100644 --- a/js/autocomplete_project.js +++ b/js/autocomplete_project.js @@ -1,4 +1,6 @@ namespace('kivi', function(k){ + "use strict"; + k.ProjectPicker = function($real, options) { // short circuit in case someone double inits us if ($real.data("project_picker")) @@ -71,7 +73,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(); @@ -83,7 +85,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(); @@ -99,7 +101,7 @@ namespace('kivi', function(k){ }, ajax_data(function(){ var val = $('#project_picker_filter').val(); return val === undefined ? '' : val })), success: function(data){ $('#project_picker_result').html(data) } }); - }; + } function result_timer (event) { if (!$('no_paginate').prop('checked')) { @@ -135,7 +137,7 @@ namespace('kivi', function(k){ annotate_state(); } }); - }; + } $dummy.autocomplete({ source: function(req, rsp) { @@ -165,7 +167,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