Revision 1d8fe39b
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
js/autocomplete_project.js | ||
---|---|---|
1 | 1 |
namespace('kivi', function(k){ |
2 |
"use strict"; |
|
3 |
|
|
2 | 4 |
k.ProjectPicker = function($real, options) { |
3 | 5 |
// short circuit in case someone double inits us |
4 | 6 |
if ($real.data("project_picker")) |
... | ... | |
71 | 73 |
if (state == STATES.PICKED) { |
72 | 74 |
annotate_state(); |
73 | 75 |
return true |
74 |
} else if (state == STATES.UNDEFINED && $dummy.val() == '') |
|
76 |
} else if (state == STATES.UNDEFINED && $dummy.val() === '')
|
|
75 | 77 |
set_item({}) |
76 | 78 |
else { |
77 | 79 |
last_unverified_dummy = $dummy.val(); |
... | ... | |
83 | 85 |
function annotate_state () { |
84 | 86 |
if (state == STATES.PICKED) |
85 | 87 |
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED); |
86 |
else if (state == STATES.UNDEFINED && $dummy.val() == '') |
|
88 |
else if (state == STATES.UNDEFINED && $dummy.val() === '')
|
|
87 | 89 |
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED); |
88 | 90 |
else { |
89 | 91 |
last_unverified_dummy = $dummy.val(); |
... | ... | |
99 | 101 |
}, ajax_data(function(){ var val = $('#project_picker_filter').val(); return val === undefined ? '' : val })), |
100 | 102 |
success: function(data){ $('#project_picker_result').html(data) } |
101 | 103 |
}); |
102 |
};
|
|
104 |
} |
|
103 | 105 |
|
104 | 106 |
function result_timer (event) { |
105 | 107 |
if (!$('no_paginate').prop('checked')) { |
... | ... | |
135 | 137 |
annotate_state(); |
136 | 138 |
} |
137 | 139 |
}); |
138 |
};
|
|
140 |
} |
|
139 | 141 |
|
140 | 142 |
$dummy.autocomplete({ |
141 | 143 |
source: function(req, rsp) { |
... | ... | |
165 | 167 |
$dummy.keydown(function(event){ |
166 | 168 |
if (event.which == KEY.ENTER || event.which == KEY.TAB) { |
167 | 169 |
// if string is empty assume they want to delete |
168 |
if ($dummy.val() == '') { |
|
170 |
if ($dummy.val() === '') {
|
|
169 | 171 |
set_item({}); |
170 | 172 |
return true; |
171 | 173 |
} else if (state == STATES.PICKED) { |
Auch abrufbar als: Unified diff
ProjectPicker: Strict-Modus & Warnungen von jshint beseitigt