Revision 5debedf3
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
js/autocomplete_part.js | ||
---|---|---|
1 | 1 |
namespace('kivi', function(k){ |
2 |
"use strict"; |
|
3 |
|
|
2 | 4 |
k.PartPicker = function($real, options) { |
3 | 5 |
// short circuit in case someone double inits us |
4 | 6 |
if ($real.data("part_picker")) |
... | ... | |
109 | 111 |
if (state == STATES.PICKED) { |
110 | 112 |
annotate_state(); |
111 | 113 |
return true |
112 |
} else if (state == STATES.UNDEFINED && $dummy.val() == '') |
|
114 |
} else if (state == STATES.UNDEFINED && $dummy.val() === '')
|
|
113 | 115 |
set_item({}) |
114 | 116 |
else { |
115 | 117 |
last_unverified_dummy = $dummy.val(); |
... | ... | |
121 | 123 |
function annotate_state () { |
122 | 124 |
if (state == STATES.PICKED) |
123 | 125 |
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED); |
124 |
else if (state == STATES.UNDEFINED && $dummy.val() == '') |
|
126 |
else if (state == STATES.UNDEFINED && $dummy.val() === '')
|
|
125 | 127 |
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED); |
126 | 128 |
else { |
127 | 129 |
last_unverified_dummy = $dummy.val(); |
... | ... | |
137 | 139 |
}, ajax_data(function(){ var val = $('#part_picker_filter').val(); return val === undefined ? '' : val })), |
138 | 140 |
success: function(data){ $('#part_picker_result').html(data) } |
139 | 141 |
}); |
140 |
};
|
|
142 |
} |
|
141 | 143 |
|
142 | 144 |
function result_timer (event) { |
143 | 145 |
if (!$('no_paginate').prop('checked')) { |
... | ... | |
156 | 158 |
|
157 | 159 |
function close_popup() { |
158 | 160 |
$('#part_selection').dialog('close'); |
159 |
};
|
|
161 |
} |
|
160 | 162 |
|
161 | 163 |
function handle_changed_text(callbacks) { |
162 | 164 |
$.ajax({ |
... | ... | |
177 | 179 |
annotate_state(); |
178 | 180 |
} |
179 | 181 |
}); |
180 |
};
|
|
182 |
} |
|
181 | 183 |
|
182 | 184 |
$dummy.autocomplete({ |
183 | 185 |
source: function(req, rsp) { |
... | ... | |
207 | 209 |
$dummy.keydown(function(event){ |
208 | 210 |
if (event.which == KEY.ENTER || event.which == KEY.TAB) { |
209 | 211 |
// if string is empty assume they want to delete |
210 |
if ($dummy.val() == '') { |
|
212 |
if ($dummy.val() === '') {
|
|
211 | 213 |
set_item({}); |
212 | 214 |
return true; |
213 | 215 |
} else if (state == STATES.PICKED) { |
Auch abrufbar als: Unified diff
PartPicker: Strict-Modus & Warnungen von jshint beseitigt