Revision 751327d2
Added by Andreas Kohlbecker over 7 years ago
modules/cdm_dataportal/js/search_area_filter.js | ||
---|---|---|
146 | 146 |
|
147 | 147 |
if(entered_text.length > 0){ |
148 | 148 |
|
149 |
var rexgexp = new RegExp(entered_text , 'i'); |
|
150 |
|
|
149 | 151 |
var matching_items = form_items.filter(function(){ |
150 |
return $(this).text().toLowerCase().contains(entered_text.toLowerCase());
|
|
152 |
return $(this).text().match(rexgexp);
|
|
151 | 153 |
}); |
152 | 154 |
|
153 | 155 |
// --- highlite the matching text |
154 |
var rexgexp = new RegExp(entered_text, 'i'); |
|
155 | 156 |
matching_items.each(function(){ |
156 | 157 |
var matching_label = $(this).find('.child-label'); |
157 | 158 |
var matching_snippet = matching_label.text().match(rexgexp); |
... | ... | |
159 | 160 |
// NOTE this will only highlite the first match in the string |
160 | 161 |
matching_label.html(matching_label.text().replace(matching_snippet[0], '<span class="highlite">' + matching_snippet[0] + '</span>')); |
161 | 162 |
} |
163 |
var matching_label_abbrev = $(this).find('.child-label-abbreviated'); |
|
164 |
matching_snippet = matching_label_abbrev.text().match(rexgexp); |
|
165 |
if(matching_snippet.length > 0){ |
|
166 |
// NOTE this will only highlite the first match in the string |
|
167 |
matching_label_abbrev.html(matching_label_abbrev.text().replace(matching_snippet[0], '<span class="highlite">' + matching_snippet[0] + '</span>')); |
|
168 |
} |
|
162 | 169 |
}); |
163 | 170 |
matching_items.show(); |
164 | 171 |
|
Also available in: Unified diff
fixing bug in taxon search area filter widget + improvement