Permalink
Browse files

Regenerate js files for performance fix

  • Loading branch information...
1 parent 4b60f9d commit 89cb2c62e04f8d0dee3ba3048af60b287c87a334 @kamal kamal committed Aug 6, 2011
Showing with 26 additions and 42 deletions.
  1. +10 −18 chosen/chosen.jquery.js
  2. +1 −1 chosen/chosen.jquery.min.js
  3. +14 −22 chosen/chosen.proto.js
  4. +1 −1 chosen/chosen.proto.min.js
View
@@ -458,10 +458,11 @@
}
};
Chosen.prototype.winnow_results = function() {
- var found, option, part, parts, regex, result_id, results, searchText, startTime, startpos, text, zregex, _i, _j, _len, _len2, _ref;
+ var found, option, part, parts, regex, result_id, results, searchText, selected, startTime, startpos, text, zregex, _i, _j, _len, _len2, _ref;
startTime = new Date();
this.no_results_clear();
results = 0;
+ selected = false;
searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
@@ -510,11 +511,15 @@
}
this.result_deactivate($("#" + result_id));
}
+ } else if (this.is_multiple && option.selected) {
+ if (regex.test(option.html)) {
+ selected = true;
+ }
}
}
}
if (results < 1 && searchText.length) {
- return this.no_results(searchText);
+ return this.no_results(searchText, selected);
} else {
return this.winnow_results_set_highlight();
}
@@ -541,24 +546,11 @@
}
}
};
- Chosen.prototype.no_results = function(terms) {
- var no_results_html, option, regex, selected;
+ Chosen.prototype.no_results = function(terms, selected) {
+ var no_results_html;
no_results_html = $('<li class="no-results">No results match "<span></span>".</li>');
no_results_html.find("span").first().html(terms);
- regex = new RegExp('^' + terms + '$', 'i');
- selected = (function() {
- var _i, _len, _ref, _results;
- _ref = this.results_data;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- option = _ref[_i];
- if (regex.test(option.value) && option.selected) {
- _results.push(option);
- }
- }
- return _results;
- }).call(this);
- if (selected.length === 0) {
+ if (!selected) {
no_results_html.append(' <a href="javascript:void(0);" class="option-add">Add this item</a>');
no_results_html.find("a.option-add").bind("click", __bind(function(evt) {
return this.select_add_option(terms);
Oops, something went wrong.

0 comments on commit 89cb2c6

Please sign in to comment.