Changeset 23232 for branches/2.5/themes
- Timestamp:
- Jun 15, 2013, 5:45:41 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.5/themes/default/js/plugins/jquery.tokeninput.js
r23230 r23232 39 39 onAdd: null, 40 40 onDelete: null, 41 allowCreation: false 41 allowCreation: false, 42 caseSensitive: false 42 43 }; 43 44 … … 577 578 // Highlight the query part of the search term 578 579 function highlight_term(value, term) { 579 return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + escape_regexp_chars(term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<b>$1</b>"); 580 var param = "g"; 581 if (!settings.caseSensitive) param+= "i"; 582 return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + escape_regexp_chars(term) + ")(?![^<>]*>)(?![^&;]+;)", param), "<b>$1</b>"); 580 583 } 581 584 … … 653 656 // than settings.minChars 654 657 function do_search() { 655 var query = input_box.val().toLowerCase(); 658 var query = input_box.val(); 659 if (!settings.caseSensitive) query = query.toLowerCase(); 656 660 657 661 if(query && query.length) { … … 717 721 718 722 // only populate the dropdown if the results are associated with the active search query 719 if(input_box.val().toLowerCase() === query) { 723 var value = input_box.val(); 724 if (!settings.caseSensitive) value = value.toLowerCase(); 725 if(value === query) { 720 726 populate_dropdown(query, settings.jsonContainer ? results[settings.jsonContainer] : results); 721 727 } … … 727 733 // Do the search through local data 728 734 var results = $.grep(settings.local_data, function (row) { 729 return row.name.toLowerCase().indexOf(query.toLowerCase()) > -1; 735 if (settings.caseSensitive) { 736 return row.name.indexOf(query) > -1; 737 } 738 else { 739 return row.name.toLowerCase().indexOf(query.toLowerCase()) > -1; 740 } 730 741 }); 731 742
Note: See TracChangeset
for help on using the changeset viewer.