Highlight the selected result only if it's active (matches the current search)

This commit is contained in:
Nagyman 2011-09-17 07:56:53 -04:00
parent ada808db43
commit 93dbe8efec
6 changed files with 10 additions and 8 deletions

View file

@ -11,7 +11,8 @@
/*
Chosen source: generate output using 'cake build'
Copyright (c) 2011 by Harvest
*/ var $, Chosen, get_side_border_padding, root;
*/
var $, Chosen, get_side_border_padding, root;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
root = this;
$ = jQuery;
@ -542,7 +543,7 @@
Chosen.prototype.winnow_results_set_highlight = function() {
var do_high, selected_results;
if (!this.result_highlight) {
selected_results = !this.is_multiple ? this.search_results.find(".result-selected") : [];
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
if (do_high != null) {
return this.result_do_highlight(do_high);

File diff suppressed because one or more lines are too long

View file

@ -11,7 +11,8 @@
/*
Chosen source: generate output using 'cake build'
Copyright (c) 2011 by Harvest
*/ var Chosen, get_side_border_padding, root;
*/
var Chosen, get_side_border_padding, root;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
root = this;
Chosen = (function() {
@ -535,7 +536,7 @@
var do_high;
if (!this.result_highlight) {
if (!this.is_multiple) {
do_high = this.search_results.down(".result-selected");
do_high = this.search_results.down(".result-selected.active-result");
}
if (!(do_high != null)) {
do_high = this.search_results.down(".active-result");

File diff suppressed because one or more lines are too long

View file

@ -462,7 +462,7 @@ class Chosen
winnow_results_set_highlight: ->
if not @result_highlight
selected_results = if not @is_multiple then @search_results.find(".result-selected") else []
selected_results = if not @is_multiple then @search_results.find(".result-selected.active-result") else []
do_high = if selected_results.length then selected_results.first() else @search_results.find(".active-result").first()
this.result_do_highlight do_high if do_high?

View file

@ -458,7 +458,7 @@ class Chosen
if not @result_highlight
if not @is_multiple
do_high = @search_results.down(".result-selected")
do_high = @search_results.down(".result-selected.active-result")
if not do_high?
do_high = @search_results.down(".active-result")