Project

General

Profile

Revision 751327d2

ID751327d219a94a8b267ef4da558016bd22fb9433
Parent efa372e9
Child 90fe4c79

Added by Andreas Kohlbecker almost 4 years ago

fixing bug in taxon search area filter widget + improvement

View differences:

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

Add picture from clipboard (Maximum size: 40 MB)