Revision 3d58a31e
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
js/autocomplete_customer.js | ||
---|---|---|
1 | 1 |
namespace('kivi', function(k){ |
2 |
"use strict"; |
|
3 |
|
|
2 | 4 |
k.CustomerVendorPicker = function($real, options) { |
3 | 5 |
// short circuit in case someone double inits us |
4 | 6 |
if ($real.data("customer_vendor_picker")) |
... | ... | |
80 | 82 |
if (state == STATES.PICKED) { |
81 | 83 |
annotate_state(); |
82 | 84 |
return true |
83 |
} else if (state == STATES.UNDEFINED && $dummy.val() == '') |
|
85 |
} else if (state == STATES.UNDEFINED && $dummy.val() === '')
|
|
84 | 86 |
set_item({}) |
85 | 87 |
else { |
86 | 88 |
last_unverified_dummy = $dummy.val(); |
... | ... | |
92 | 94 |
function annotate_state () { |
93 | 95 |
if (state == STATES.PICKED) |
94 | 96 |
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED); |
95 |
else if (state == STATES.UNDEFINED && $dummy.val() == '') |
|
97 |
else if (state == STATES.UNDEFINED && $dummy.val() === '')
|
|
96 | 98 |
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED); |
97 | 99 |
else { |
98 | 100 |
last_unverified_dummy = $dummy.val(); |
... | ... | |
119 | 121 |
annotate_state(); |
120 | 122 |
} |
121 | 123 |
}); |
122 |
};
|
|
124 |
} |
|
123 | 125 |
|
124 | 126 |
$dummy.autocomplete({ |
125 | 127 |
source: function(req, rsp) { |
... | ... | |
149 | 151 |
$dummy.keydown(function(event){ |
150 | 152 |
if (event.which == KEY.ENTER || event.which == KEY.TAB) { |
151 | 153 |
// if string is empty assume they want to delete |
152 |
if ($dummy.val() == '') { |
|
154 |
if ($dummy.val() === '') {
|
|
153 | 155 |
set_item({}); |
154 | 156 |
return true; |
155 | 157 |
} else if (state == STATES.PICKED) { |
Auch abrufbar als: Unified diff
CustomerVendorPicker: Strict-Modus & Warnungen von jshint beseitigt