Revision bae74e1e
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
js/autocomplete_chart.js | ||
---|---|---|
1 | 1 |
namespace('kivi', function(k){ |
2 |
"use strict"; |
|
3 |
|
|
2 | 4 |
k.ChartPicker = function($real, options) { |
3 | 5 |
// short circuit in case someone double inits us |
4 | 6 |
if ($real.data("chart_picker")) |
... | ... | |
115 | 117 |
if (state == STATES.PICKED) { |
116 | 118 |
annotate_state(); |
117 | 119 |
return true |
118 |
} else if (state == STATES.UNDEFINED && $dummy.val() == '') |
|
120 |
} else if (state == STATES.UNDEFINED && $dummy.val() === '')
|
|
119 | 121 |
set_item({}) |
120 | 122 |
else { |
121 | 123 |
last_unverified_dummy = $dummy.val(); |
... | ... | |
127 | 129 |
function annotate_state () { |
128 | 130 |
if (state == STATES.PICKED) |
129 | 131 |
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED); |
130 |
else if (state == STATES.UNDEFINED && $dummy.val() == '') |
|
132 |
else if (state == STATES.UNDEFINED && $dummy.val() === '')
|
|
131 | 133 |
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED); |
132 | 134 |
else { |
133 | 135 |
last_unverified_dummy = $dummy.val(); |
... | ... | |
143 | 145 |
}, ajax_data(function(){ var val = $('#chart_picker_filter').val(); return val === undefined ? '' : val })), |
144 | 146 |
success: function(data){ $('#chart_picker_result').html(data) } |
145 | 147 |
}); |
146 |
};
|
|
148 |
} |
|
147 | 149 |
|
148 | 150 |
function result_timer (event) { |
149 | 151 |
if (!$('hide_chart_details').prop('checked')) { |
... | ... | |
162 | 164 |
|
163 | 165 |
function close_popup() { |
164 | 166 |
$('#chart_selection').dialog('close'); |
165 |
};
|
|
167 |
} |
|
166 | 168 |
|
167 | 169 |
function handle_changed_text(callbacks) { |
168 | 170 |
$.ajax({ |
... | ... | |
183 | 185 |
annotate_state(); |
184 | 186 |
} |
185 | 187 |
}); |
186 |
};
|
|
188 |
} |
|
187 | 189 |
|
188 | 190 |
$dummy.autocomplete({ |
189 | 191 |
source: function(req, rsp) { |
... | ... | |
214 | 216 |
$dummy.keydown(function(event){ |
215 | 217 |
if (event.which == KEY.ENTER || event.which == KEY.TAB) { |
216 | 218 |
// if string is empty assume they want to delete |
217 |
if ($dummy.val() == '') { |
|
219 |
if ($dummy.val() === '') {
|
|
218 | 220 |
set_item({}); |
219 | 221 |
return true; |
220 | 222 |
} else if (state == STATES.PICKED) { |
Auch abrufbar als: Unified diff
ChartPicker: Strict-Modus & Warnungen von jshint beseitigt