diff --git a/media/jui/css/chosen-sprite.png b/media/jui/css/chosen-sprite.png index ebaf1b6c39303..c57da70b4b5b1 100644 Binary files a/media/jui/css/chosen-sprite.png and b/media/jui/css/chosen-sprite.png differ diff --git a/media/jui/css/chosen-sprite@2x.png b/media/jui/css/chosen-sprite@2x.png index 301e388525a3a..6b50545202cb4 100644 Binary files a/media/jui/css/chosen-sprite@2x.png and b/media/jui/css/chosen-sprite@2x.png differ diff --git a/media/jui/css/chosen.css b/media/jui/css/chosen.css index 50ae2d942bc5d..5a6037aec51dc 100644 --- a/media/jui/css/chosen.css +++ b/media/jui/css/chosen.css @@ -1,23 +1,35 @@ +/*! +Chosen, a Select Box Enhancer for jQuery and Prototype +by Patrick Filler for Harvest, http://getharvest.com + +Version 1.6.2 +Full source at https://github.com/harvesthq/chosen +Copyright (c) 2011-2016 Harvest http://getharvest.com + +MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md +This file is generated by `grunt build`, do not edit it by hand. +*/ + /* @group Base */ .chzn-container { position: relative; display: inline-block; vertical-align: middle; font-size: 13px; - zoom: 1; - *display: inline; -webkit-user-select: none; -moz-user-select: none; user-select: none; } +.chzn-container * { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} .chzn-container .chzn-drop { position: absolute; top: 100%; left: -9999px; z-index: 1010; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; width: 100%; border: 1px solid #aaa; border-top: 0; @@ -30,6 +42,19 @@ .chzn-container a { cursor: pointer; } +.chzn-container .search-choice .group-name, .chzn-container .chzn-single .group-name { + margin-right: 4px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + font-weight: normal; + color: #999999; +} +.chzn-container .search-choice .group-name:after, .chzn-container .chzn-single .group-name:after { + content: ":"; + padding-left: 2px; + vertical-align: top; +} /* @end */ /* @group Single Chosen */ @@ -38,15 +63,15 @@ display: block; overflow: hidden; padding: 0 0 0 8px; - height: 23px; + height: 25px; border: 1px solid #aaa; border-radius: 5px; background-color: #fff; background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4)); - background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); - background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); - background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); - background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: -webkit-linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: -moz-linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: -o-linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); background-clip: padding-box; box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1); color: #444; @@ -105,9 +130,6 @@ white-space: nowrap; } .chzn-container-single .chzn-search input[type="text"] { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; margin: 1px 0; padding: 4px 20px 4px 5px; width: 100%; @@ -115,11 +137,7 @@ outline: 0; border: 1px solid #aaa; background: white url('chosen-sprite.png') no-repeat 100% -20px; - background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); - background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%); - background: url('chosen-sprite.png') no-repeat 100% -20px, -moz-linear-gradient(#eeeeee 1%, #ffffff 15%); - background: url('chosen-sprite.png') no-repeat 100% -20px, -o-linear-gradient(#eeeeee 1%, #ffffff 15%); - background: url('chosen-sprite.png') no-repeat 100% -20px, linear-gradient(#eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat 100% -20px; font-size: 1em; font-family: sans-serif; line-height: normal; @@ -138,6 +156,7 @@ /* @end */ /* @group Results */ .chzn-container .chzn-results { + color: #444; position: relative; overflow-x: hidden; overflow-y: auto; @@ -152,6 +171,8 @@ padding: 5px 6px; list-style: none; line-height: 15px; + word-wrap: break-word; + -webkit-touch-callout: none; } .chzn-container .chzn-results li.active-result { display: list-item; @@ -172,6 +193,7 @@ color: #fff; } .chzn-container .chzn-results li.no-results { + color: #777; display: list-item; background: #f4f4f4; } @@ -193,14 +215,10 @@ .chzn-container-multi .chzn-choices { position: relative; overflow: hidden; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; margin: 0; - padding: 0; + padding: 0 5px; width: 100%; - height: auto !important; - height: 1%; + height: auto; border: 1px solid #aaa; background-color: #fff; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); @@ -221,39 +239,42 @@ } .chzn-container-multi .chzn-choices li.search-field input[type="text"] { margin: 1px 0; - padding: 5px; - height: 15px; + padding: 0; + height: 25px; outline: 0; border: 0 !important; background: transparent !important; box-shadow: none; - color: #666; + color: #999; font-size: 100%; font-family: sans-serif; line-height: normal; border-radius: 0; } -.chzn-container-multi .chzn-choices li.search-field .default { - color: #999; -} .chzn-container-multi .chzn-choices li.search-choice { position: relative; - margin: 3px 0 3px 5px; + margin: 3px 5px 3px 0; padding: 3px 20px 3px 5px; border: 1px solid #aaa; + max-width: 100%; border-radius: 3px; - background-color: #e4e4e4; + background-color: #eeeeee; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-size: 100% 19px; + background-repeat: repeat-x; background-clip: padding-box; box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05); color: #333; line-height: 13px; cursor: default; } +.chzn-container-multi .chzn-choices li.search-choice span { + word-wrap: break-word; +} .chzn-container-multi .chzn-choices li.search-choice .search-choice-close { position: absolute; top: 4px; @@ -272,10 +293,10 @@ border: 1px solid #ccc; background-color: #e4e4e4; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); - background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); - background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); - background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); - background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); color: #666; } .chzn-container-multi .chzn-choices li.search-choice-focus { @@ -311,6 +332,8 @@ background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%); background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%); background-image: linear-gradient(#eeeeee 20%, #ffffff 80%); + /* JUI remove next line */ + /* box-shadow: 0 1px 0 #fff inset; */ } .chzn-container-active.chzn-with-drop .chzn-single div { border-left: none; @@ -324,7 +347,7 @@ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); } .chzn-container-active .chzn-choices li.search-field input[type="text"] { - color: #111 !important; + color: #222 !important; } /* @end */ @@ -379,6 +402,7 @@ right: auto; left: 4px; } +.chzn-rtl.chzn-container-single-nosearch .chzn-search, .chzn-rtl .chzn-drop { left: 9999px; } @@ -396,11 +420,7 @@ .chzn-rtl .chzn-search input[type="text"] { padding: 4px 5px 4px 20px; background: white url('chosen-sprite.png') no-repeat -30px -20px; - background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); - background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%); - background: url('chosen-sprite.png') no-repeat -30px -20px, -moz-linear-gradient(#eeeeee 1%, #ffffff 15%); - background: url('chosen-sprite.png') no-repeat -30px -20px, -o-linear-gradient(#eeeeee 1%, #ffffff 15%); - background: url('chosen-sprite.png') no-repeat -30px -20px, linear-gradient(#eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -30px -20px; direction: rtl; } .chzn-rtl.chzn-container-single .chzn-single div b { @@ -409,18 +429,10 @@ .chzn-rtl.chzn-container-single.chzn-with-drop .chzn-single div b { background-position: -12px 2px; } -[dir="rtl"] .chzn-container .chzn-drop, -[dir="rtl"] .chzn-container-single.chzn-container-single-nosearch .chzn-search { - left: auto; - right: -9999px; -} -[dir="rtl"] .chzn-container.chzn-with-drop .chzn-drop { - right: 0; -} /* @end */ /* @group Retina compatibility */ -@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) { +@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.5dppx) { .chzn-rtl .chzn-search input[type="text"], .chzn-container-single .chzn-single abbr, .chzn-container-single .chzn-single div b, diff --git a/media/jui/js/chosen.jquery.js b/media/jui/js/chosen.jquery.js index d72b6becaeca0..efc65967c594a 100644 --- a/media/jui/js/chosen.jquery.js +++ b/media/jui/js/chosen.jquery.js @@ -1,18 +1,19 @@ -// Chosen, a Select Box Enhancer for jQuery and Prototype -// by Patrick Filler for Harvest, http://getharvest.com -// -// Version 0.14.0 -// Full source at https://github.com/harvesthq/chosen -// Copyright (c) 2011 Harvest http://getharvest.com - -// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md -// This file is generated by `grunt build`, do not edit it by hand. - -// -// Modified for Joomla! UI: -// - fix zero width, based on https://github.com/harvesthq/chosen/pull/1439 -// - allow to add a custom value on fly, based on https://github.com/harvesthq/chosen/pull/749 -// +/*! +Chosen, a Select Box Enhancer for jQuery and Prototype +by Patrick Filler for Harvest, http://getharvest.com + +Version 1.6.2 +Full source at https://github.com/harvesthq/chosen +Copyright (c) 2011-2016 Harvest http://getharvest.com + + Modified for Joomla! UI: + - rename the css and javascript classes and functions to revert back to using chzn and liszt + - fix zero width, based on https://github.com/harvesthq/chosen/pull/1439 + - allow to add a custom value on fly, based on https://github.com/harvesthq/chosen/pull/749 + +MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md +This file is generated by `grunt build`, do not edit it by hand. +*/ (function() { var $, AbstractChosen, Chosen, SelectParser, _ref, @@ -35,14 +36,15 @@ SelectParser.prototype.add_group = function(group) { var group_position, option, _i, _len, _ref, _results; - group_position = this.parsed.length; this.parsed.push({ array_index: group_position, group: true, label: this.escapeExpression(group.label), + title: group.title ? group.title : void 0, children: 0, - disabled: group.disabled + disabled: group.disabled, + classes: group.className }); _ref = group.childNodes; _results = []; @@ -65,9 +67,11 @@ value: option.value, text: option.text, html: option.innerHTML, + title: option.title ? option.title : void 0, selected: option.selected, disabled: group_disabled === true ? group_disabled : option.disabled, group_array_index: group_position, + group_label: group_position != null ? this.parsed[group_position].label : null, classes: option.className, style: option.style.cssText }); @@ -84,7 +88,6 @@ SelectParser.prototype.escapeExpression = function(text) { var map, unsafe_chars; - if ((text == null) || text === false) { return ""; } @@ -110,7 +113,6 @@ SelectParser.select_to_array = function(select) { var child, parser, _i, _len, _ref; - parser = new SelectParser(); _ref = select.childNodes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { @@ -133,12 +135,11 @@ this.setup(); this.set_up_html(); this.register_observers(); - this.finish_setup(); + this.on_ready(); } AbstractChosen.prototype.set_default_values = function() { var _this = this; - this.click_test_action = function(evt) { return _this.test_active_click(evt); }; @@ -149,7 +150,6 @@ this.mouse_on_container = false; this.results_showing = false; this.result_highlighted = null; - this.result_single_selected = null; /**/ /* Original: not exist */ this.allow_custom_value = false; @@ -164,7 +164,10 @@ this.max_selected_options = this.options.max_selected_options || Infinity; this.inherit_select_classes = this.options.inherit_select_classes || false; this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true; - return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true; + this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true; + this.include_group_label_in_selected = this.options.include_group_label_in_selected || false; + this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY; + return this.case_sensitive_search = this.options.case_sensitive_search || false; }; AbstractChosen.prototype.set_default_text = function() { @@ -182,6 +185,14 @@ return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text; }; + AbstractChosen.prototype.choice_label = function(item) { + if (this.include_group_label_in_selected && (item.group_label != null)) { + return "" + item.group_label + "" + item.html; + } else { + return item.html; + } + }; + AbstractChosen.prototype.mouse_enter = function() { return this.mouse_on_container = true; }; @@ -192,7 +203,6 @@ AbstractChosen.prototype.input_focus = function(evt) { var _this = this; - if (this.is_multiple) { if (!this.active_field) { return setTimeout((function() { @@ -208,7 +218,6 @@ AbstractChosen.prototype.input_blur = function(evt) { var _this = this; - if (!this.mouse_on_container) { this.active_field = false; return setTimeout((function() { @@ -218,31 +227,38 @@ }; AbstractChosen.prototype.results_option_build = function(options) { - var content, data, _i, _len, _ref; - + var content, data, data_content, shown_results, _i, _len, _ref; content = ''; + shown_results = 0; _ref = this.results_data; for (_i = 0, _len = _ref.length; _i < _len; _i++) { data = _ref[_i]; + data_content = ''; if (data.group) { - content += this.result_add_group(data); + data_content = this.result_add_group(data); } else { - content += this.result_add_option(data); + data_content = this.result_add_option(data); + } + if (data_content !== '') { + shown_results++; + content += data_content; } if (options != null ? options.first : void 0) { if (data.selected && this.is_multiple) { this.choice_build(data); } else if (data.selected && !this.is_multiple) { - this.single_set_selected_text(data.text); + this.single_set_selected_text(this.choice_label(data)); } } + if (shown_results >= this.max_shown_results) { + break; + } } return content; }; AbstractChosen.prototype.result_add_option = function(option) { - var classes, style; - + var classes, option_el; if (!option.search_match) { return ''; } @@ -265,18 +281,37 @@ if (option.classes !== "") { classes.push(option.classes); } - style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : ""; - return "
  • " + option.search_text + "
  • "; + option_el = document.createElement("li"); + option_el.className = classes.join(" "); + option_el.style.cssText = option.style; + option_el.setAttribute("data-option-array-index", option.array_index); + option_el.innerHTML = option.search_text; + if (option.title) { + option_el.title = option.title; + } + return this.outerHTML(option_el); }; AbstractChosen.prototype.result_add_group = function(group) { + var classes, group_el; if (!(group.search_match || group.group_match)) { return ''; } if (!(group.active_options > 0)) { return ''; } - return "
  • " + group.search_text + "
  • "; + classes = []; + classes.push("group-result"); + if (group.classes) { + classes.push(group.classes); + } + group_el = document.createElement("li"); + group_el.className = classes.join(" "); + group_el.innerHTML = group.search_text; + if (group.title) { + group_el.title = group.title; + } + return this.outerHTML(group_el); }; AbstractChosen.prototype.results_update_field = function() { @@ -285,13 +320,27 @@ this.results_reset_cleanup(); } this.result_clear_highlight(); - this.result_single_selected = null; this.results_build(); if (this.results_showing) { return this.winnow_results(); } }; + AbstractChosen.prototype.reset_single_select_options = function() { + var result, _i, _len, _ref, _results; + _ref = this.results_data; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + result = _ref[_i]; + if (result.selected) { + _results.push(result.selected = false); + } else { + _results.push(void 0); + } + } + return _results; + }; + AbstractChosen.prototype.results_toggle = function() { if (this.results_showing) { return this.results_hide(); @@ -309,15 +358,13 @@ }; AbstractChosen.prototype.winnow_results = function() { - var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref; - + var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref; this.no_results_clear(); results = 0; searchText = this.get_search_text(); escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - regexAnchor = this.search_contains ? "" : "^"; - regex = new RegExp(regexAnchor + escapedSearchText, 'i'); zregex = new RegExp(escapedSearchText, 'i'); + regex = this.get_search_regex(escapedSearchText); _ref = this.results_data; for (_i = 0, _len = _ref.length; _i < _len; _i++) { option = _ref[_i]; @@ -335,8 +382,8 @@ } results_group.active_options += 1; } + option.search_text = option.group ? option.label : option.html; if (!(option.group && !this.group_search)) { - option.search_text = option.group ? option.label : option.html; option.search_match = this.search_string_match(option.search_text, regex); if (option.search_match && !option.group) { results += 1; @@ -366,9 +413,15 @@ } }; + AbstractChosen.prototype.get_search_regex = function(escaped_search_string) { + var regex_anchor, regex_flag; + regex_anchor = this.search_contains ? "" : "^"; + regex_flag = this.case_sensitive_search ? "" : "i"; + return new RegExp(regex_anchor + escaped_search_string, regex_flag); + }; + AbstractChosen.prototype.search_string_match = function(search_string, regex) { var part, parts, _i, _len; - if (regex.test(search_string)) { return true; } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) { @@ -386,7 +439,6 @@ AbstractChosen.prototype.choices_count = function() { var option, _i, _len, _ref; - if (this.selected_option_count != null) { return this.selected_option_count; } @@ -410,7 +462,6 @@ AbstractChosen.prototype.keyup_checker = function(evt) { var stroke, _ref; - stroke = (_ref = evt.which) != null ? _ref : evt.keyCode; this.search_field_scale(); switch (stroke) { @@ -439,12 +490,20 @@ case 16: case 91: case 17: + case 18: break; default: return this.results_search(); } }; + AbstractChosen.prototype.clipboard_event_checker = function(evt) { + var _this = this; + return setTimeout((function() { + return _this.results_search(); + }), 50); + }; + AbstractChosen.prototype.container_width = function() { if (this.options.width != null) { return this.options.width; @@ -471,18 +530,39 @@ return true; }; + AbstractChosen.prototype.search_results_touchstart = function(evt) { + this.touch_started = true; + return this.search_results_mouseover(evt); + }; + + AbstractChosen.prototype.search_results_touchmove = function(evt) { + this.touch_started = false; + return this.search_results_mouseout(evt); + }; + + AbstractChosen.prototype.search_results_touchend = function(evt) { + if (this.touch_started) { + return this.search_results_mouseup(evt); + } + }; + + AbstractChosen.prototype.outerHTML = function(element) { + var tmp; + if (element.outerHTML) { + return element.outerHTML; + } + tmp = document.createElement("div"); + tmp.appendChild(element); + return tmp.innerHTML; + }; + AbstractChosen.browser_is_supported = function() { - if (window.navigator.appName === "Microsoft Internet Explorer") { + if ("Microsoft Internet Explorer" === window.navigator.appName) { return document.documentMode >= 8; } - if (/iP(od|hone)/i.test(window.navigator.userAgent)) { + if (/iP(od|hone)/i.test(window.navigator.userAgent) || /IEMobile/i.test(window.navigator.userAgent) || /Windows Phone/i.test(window.navigator.userAgent) || /BlackBerry/i.test(window.navigator.userAgent) || /BB10/i.test(window.navigator.userAgent) || /Android.*Mobile/i.test(window.navigator.userAgent)) { return false; } - if (/Android/i.test(window.navigator.userAgent)) { - if (/Mobile/i.test(window.navigator.userAgent)) { - return false; - } - } return true; }; @@ -505,12 +585,15 @@ } return this.each(function(input_field) { var $this, chosen; - $this = $(this); chosen = $this.data('chosen'); - if (options === 'destroy' && chosen) { - chosen.destroy(); - } else if (!chosen) { + if (options === 'destroy') { + if (chosen instanceof Chosen) { + chosen.destroy(); + } + return; + } + if (!(chosen instanceof Chosen)) { $this.data('chosen', new Chosen(this, options)); } }); @@ -535,13 +618,8 @@ return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl"); }; - Chosen.prototype.finish_setup = function() { - return this.form_field_jq.addClass("chzn-done"); - }; - Chosen.prototype.set_up_html = function() { var container_classes, container_props; - container_classes = ["chzn-container"]; container_classes.push("chzn-container-" + (this.is_multiple ? "multi" : "single")); if (this.inherit_select_classes && this.form_field.className) { @@ -562,7 +640,7 @@ if (this.is_multiple) { this.container.html('
    '); } else { - this.container.html('' + this.default_text + '
    '); + this.container.html('' + this.default_text + '
    '); } this.form_field_jq.hide().after(this.container); this.dropdown = this.container.find('div.chzn-drop').first(); @@ -579,7 +657,10 @@ } this.results_build(); this.set_tab_index(); - this.set_label_behavior(); + return this.set_label_behavior(); + }; + + Chosen.prototype.on_ready = function() { return this.form_field_jq.trigger("liszt:ready", { chosen: this }); @@ -587,7 +668,14 @@ Chosen.prototype.register_observers = function() { var _this = this; - + this.container.bind('touchstart.chosen', function(evt) { + _this.container_mousedown(evt); + return evt.preventDefault(); + }); + this.container.bind('touchend.chosen', function(evt) { + _this.container_mouseup(evt); + return evt.preventDefault(); + }); this.container.bind('mousedown.chosen', function(evt) { _this.container_mousedown(evt); }); @@ -612,6 +700,15 @@ this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) { _this.search_results_mousewheel(evt); }); + this.search_results.bind('touchstart.chosen', function(evt) { + _this.search_results_touchstart(evt); + }); + this.search_results.bind('touchmove.chosen', function(evt) { + _this.search_results_touchmove(evt); + }); + this.search_results.bind('touchend.chosen', function(evt) { + _this.search_results_touchend(evt); + }); this.form_field_jq.bind("liszt:updated.chosen", function(evt) { _this.results_update_field(evt); }); @@ -621,6 +718,9 @@ this.form_field_jq.bind("liszt:open.chosen", function(evt) { _this.container_mousedown(evt); }); + this.form_field_jq.bind("liszt:close.chosen", function(evt) { + _this.input_blur(evt); + }); this.search_field.bind('blur.chosen', function(evt) { _this.input_blur(evt); }); @@ -633,6 +733,12 @@ this.search_field.bind('focus.chosen', function(evt) { _this.input_focus(evt); }); + this.search_field.bind('cut.chosen', function(evt) { + _this.clipboard_event_checker(evt); + }); + this.search_field.bind('paste.chosen', function(evt) { + _this.clipboard_event_checker(evt); + }); if (this.is_multiple) { return this.search_choices.bind('click.chosen', function(evt) { _this.choices_click(evt); @@ -645,7 +751,7 @@ }; Chosen.prototype.destroy = function() { - $(document).unbind("click.chosen", this.click_test_action); + $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action); if (this.search_field[0].tabIndex) { this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex; } @@ -682,7 +788,7 @@ if (this.is_multiple) { this.search_field.val(""); } - $(document).bind('click.chosen', this.click_test_action); + $(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action); this.results_show(); } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chzn-single").length)) { evt.preventDefault(); @@ -700,9 +806,10 @@ }; Chosen.prototype.search_results_mousewheel = function(evt) { - var delta, _ref1, _ref2; - - delta = -((_ref1 = evt.originalEvent) != null ? _ref1.wheelDelta : void 0) || ((_ref2 = evt.originialEvent) != null ? _ref2.detail : void 0); + var delta; + if (evt.originalEvent) { + delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail; + } if (delta != null) { evt.preventDefault(); if (evt.type === 'DOMMouseScroll') { @@ -719,7 +826,7 @@ }; Chosen.prototype.close_field = function() { - $(document).unbind("click.chosen", this.click_test_action); + $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action); this.active_field = false; this.results_hide(); this.container.removeClass("chzn-container-active"); @@ -736,7 +843,9 @@ }; Chosen.prototype.test_active_click = function(evt) { - if (this.container.is($(evt.target).closest('.chzn-container'))) { + var active_container; + active_container = $(evt.target).closest('.chzn-container'); + if (active_container.length && this.container[0] === active_container[0]) { return this.active_field = true; } else { return this.close_field(); @@ -770,7 +879,6 @@ Chosen.prototype.result_do_highlight = function(el) { var high_bottom, high_top, maxHeight, visible_bottom, visible_top; - if (el.length) { this.result_clear_highlight(); this.result_highlight = el; @@ -803,13 +911,13 @@ return false; } this.container.addClass("chzn-with-drop"); - this.form_field_jq.trigger("liszt:showing_dropdown", { - chosen: this - }); this.results_showing = true; this.search_field.focus(); this.search_field.val(this.search_field.val()); - return this.winnow_results(); + this.winnow_results(); + return this.form_field_jq.trigger("liszt:showing_dropdown", { + chosen: this + }); }; Chosen.prototype.update_results_content = function(content) { @@ -829,7 +937,6 @@ Chosen.prototype.set_tab_index = function(el) { var ti; - if (this.form_field.tabIndex) { ti = this.form_field.tabIndex; this.form_field.tabIndex = -1; @@ -839,7 +946,6 @@ Chosen.prototype.set_label_behavior = function() { var _this = this; - this.form_field_label = this.form_field_jq.parents("label"); if (!this.form_field_label.length && this.form_field.id.length) { this.form_field_label = $("label[for='" + this.form_field.id + "']"); @@ -867,7 +973,6 @@ Chosen.prototype.search_results_mouseup = function(evt) { var target; - target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); if (target.length) { this.result_highlight = target; @@ -878,7 +983,6 @@ Chosen.prototype.search_results_mouseover = function(evt) { var target; - target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); if (target) { return this.result_do_highlight(target); @@ -894,10 +998,9 @@ Chosen.prototype.choice_build = function(item) { var choice, close_link, _this = this; - choice = $('
  • ', { "class": "search-choice" - }).html("" + item.html + ""); + }).html("" + (this.choice_label(item)) + ""); if (item.disabled) { choice.addClass('search-choice-disabled'); } else { @@ -933,8 +1036,8 @@ }; Chosen.prototype.results_reset = function() { + this.reset_single_select_options(); this.form_field.options[0].selected = true; - this.selected_option_count = null; this.single_set_selected_text(); this.show_search_field_default(); this.results_reset_cleanup(); @@ -969,12 +1072,7 @@ if (this.is_multiple) { high.removeClass("active-result"); } else { - if (this.result_single_selected) { - this.result_single_selected.removeClass("result-selected"); - selected_index = this.result_single_selected[0].getAttribute('data-option-array-index'); - this.results_data[selected_index].selected = false; - } - this.result_single_selected = high; + this.reset_single_select_options(); } high.addClass("result-selected"); item = this.results_data[high[0].getAttribute("data-option-array-index")]; @@ -984,18 +1082,19 @@ if (this.is_multiple) { this.choice_build(item); } else { - this.single_set_selected_text(item.text); + this.single_set_selected_text(this.choice_label(item)); } if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) { this.results_hide(); } - this.search_field.val(""); + this.show_search_field_default(); if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) { this.form_field_jq.trigger("change", { 'selected': this.form_field.options[item.options_index].value }); } this.current_selectedIndex = this.form_field.selectedIndex; + evt.preventDefault(); return this.search_field_scale(); } /**/ @@ -1049,12 +1148,11 @@ this.single_deselect_control_build(); this.selected_item.removeClass("chzn-default"); } - return this.selected_item.find("span").text(text); + return this.selected_item.find("span").html(text); }; Chosen.prototype.result_deselect = function(pos) { var result_data; - result_data = this.results_data[pos]; if (!this.form_field.options[result_data.options_index].disabled) { result_data.selected = false; @@ -1085,16 +1183,11 @@ }; Chosen.prototype.get_search_text = function() { - if (this.search_field.val() === this.default_text) { - return ""; - } else { - return $('
    ').text($.trim(this.search_field.val())).html(); - } + return $('
    ').text($.trim(this.search_field.val())).html(); }; Chosen.prototype.winnow_results_set_highlight = function() { var do_high, selected_results; - 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) { @@ -1104,10 +1197,12 @@ Chosen.prototype.no_results = function(terms) { var no_results_html; - no_results_html = $('
  • ' + this.results_none_found + ' ""
  • '); no_results_html.find("span").first().html(terms); - return this.search_results.append(no_results_html); + this.search_results.append(no_results_html); + return this.form_field_jq.trigger("liszt:no_results", { + chosen: this + }); }; Chosen.prototype.no_results_clear = function() { @@ -1116,7 +1211,6 @@ Chosen.prototype.keydown_arrow = function() { var next_sib; - if (this.results_showing && this.result_highlight) { next_sib = this.result_highlight.nextAll("li.active-result").first(); if (next_sib) { @@ -1129,7 +1223,6 @@ Chosen.prototype.keyup_arrow = function() { var prev_sibs; - if (!this.results_showing && !this.is_multiple) { return this.results_show(); } else if (this.result_highlight) { @@ -1147,7 +1240,6 @@ Chosen.prototype.keydown_backstroke = function() { var next_available_destroy; - if (this.pending_backstroke) { this.choice_destroy(this.pending_backstroke.find("a").first()); return this.clear_backstroke(); @@ -1173,7 +1265,6 @@ Chosen.prototype.keydown_checker = function(evt) { var stroke, _ref1; - stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode; this.search_field_scale(); if (stroke !== 8 && this.pending_backstroke) { @@ -1190,7 +1281,14 @@ this.mouse_on_container = false; break; case 13: - evt.preventDefault(); + if (this.results_showing) { + evt.preventDefault(); + } + break; + case 32: + if (this.disable_search) { + evt.preventDefault(); + } break; case 38: evt.preventDefault(); @@ -1205,7 +1303,6 @@ Chosen.prototype.search_field_scale = function() { var div, f_width, h, style, style_block, styles, w, _i, _len; - if (this.is_multiple) { h = 0; w = 0; diff --git a/media/jui/js/chosen.jquery.min.js b/media/jui/js/chosen.jquery.min.js index 5be8c12faa9d3..36da67b79f98e 100644 --- a/media/jui/js/chosen.jquery.min.js +++ b/media/jui/js/chosen.jquery.min.js @@ -1 +1 @@ -(function(){var e,t,n,r,i,s={}.hasOwnProperty,o=function(e,t){function r(){this.constructor=e}for(var n in t)s.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};r=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.add_node=function(e){return e.nodeName.toUpperCase()==="OPTGROUP"?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,n,r,i,s,o;t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:this.escapeExpression(e.label),children:0,disabled:e.disabled}),s=e.childNodes,o=[];for(r=0,i=s.length;r\"\'\`]/.test(e)?(t={"<":"<",">":">",'"':""","'":"'","`":"`"},n=/&(?!\w+;)|[\<\>\"\'\`]/g,e.replace(n,function(e){return t[e]||"&"})):e},e}(),r.select_to_array=function(e){var t,n,i,s,o;n=new r,o=e.childNodes;for(i=0,s=o.length;i'+e.search_text+""):"":""},e.prototype.result_add_group=function(e){return!e.search_match&&!e.group_match?"":e.active_options>0?'
  • '+e.search_text+"
  • ":""},e.prototype.results_update_field=function(){this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.result_single_selected=null,this.results_build();if(this.results_showing)return this.winnow_results()},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.winnow_results=function(){var e,t,n,r,i,s,o,u,a,f,l,c,h;this.no_results_clear(),i=0,o=this.get_search_text(),e=o.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),r=this.search_contains?"":"^",n=new RegExp(r+e,"i"),f=new RegExp(e,"i"),h=this.results_data;for(l=0,c=h.length;l"+t.search_text.substr(u+o.length),t.search_text=a.substr(0,u)+""+a.substr(u)),s!=null&&(s.group_match=!0)):t.group_array_index!=null&&this.results_data[t.group_array_index].search_match&&(t.search_match=!0)}}return this.result_clear_highlight(),i<1&&o.length?(this.update_results_content(""),this.no_results(o)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},e.prototype.search_string_match=function(e,t){var n,r,i,s;if(t.test(e))return!0;if(this.enable_split_word_search&&(e.indexOf(" ")>=0||e.indexOf("[")===0)){r=e.replace(/\[|\]/g,"").split(" ");if(r.length)for(i=0,s=r.length;i0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:e.preventDefault();if(this.results_showing)return this.result_select(e);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},e.prototype.container_width=function(){return this.options.width!=null?this.options.width:this.form_field_jq.css("width")||""+this.form_field.offsetWidth+"px"},e.prototype.include_option_in_results=function(e){return this.is_multiple&&!this.display_selected_options&&e.selected?!1:!this.display_disabled_options&&e.disabled?!1:e.empty?!1:!0},e.browser_is_supported=function(){return window.navigator.appName==="Microsoft Internet Explorer"?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},e.default_multiple_text="Select Some Options",e.default_single_text="Select an Option",e.default_no_result_text="No results match",e}(),e=jQuery,e.fn.extend({chosen:function(r){return t.browser_is_supported()?this.each(function(t){var i,s;i=e(this),s=i.data("chosen"),r==="destroy"&&s?s.destroy():s||i.data("chosen",new n(this,r))}):this}}),n=function(t){function n(){return i=n.__super__.constructor.apply(this,arguments),i}return o(n,t),n.prototype.setup=function(){return this.form_field_jq=e(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.allow_custom_value=this.form_field_jq.hasClass("chzn-custom-value")||this.options.allow_custom_value,this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},n.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},n.prototype.set_up_html=function(){var t,n;return t=["chzn-container"],t.push("chzn-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&t.push(this.form_field.className),this.is_rtl&&t.push("chzn-rtl"),n={"class":t.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(n.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chzn"),this.container=e("
    ",n),this.is_multiple?this.container.html('
      '):this.container.html(''+this.default_text+'
        '),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chzn-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},n.prototype.register_observers=function(){var e=this;return this.container.bind("mousedown.chosen",function(t){e.container_mousedown(t)}),this.container.bind("mouseup.chosen",function(t){e.container_mouseup(t)}),this.container.bind("mouseenter.chosen",function(t){e.mouse_enter(t)}),this.container.bind("mouseleave.chosen",function(t){e.mouse_leave(t)}),this.search_results.bind("mouseup.chosen",function(t){e.search_results_mouseup(t)}),this.search_results.bind("mouseover.chosen",function(t){e.search_results_mouseover(t)}),this.search_results.bind("mouseout.chosen",function(t){e.search_results_mouseout(t)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(t){e.search_results_mousewheel(t)}),this.form_field_jq.bind("liszt:updated.chosen",function(t){e.results_update_field(t)}),this.form_field_jq.bind("liszt:activate.chosen",function(t){e.activate_field(t)}),this.form_field_jq.bind("liszt:open.chosen",function(t){e.container_mousedown(t)}),this.search_field.bind("blur.chosen",function(t){e.input_blur(t)}),this.search_field.bind("keyup.chosen",function(t){e.keyup_checker(t)}),this.search_field.bind("keydown.chosen",function(t){e.keydown_checker(t)}),this.search_field.bind("focus.chosen",function(t){e.input_focus(t)}),this.is_multiple?this.search_choices.bind("click.chosen",function(t){e.choices_click(t)}):this.container.bind("click.chosen",function(e){e.preventDefault()})},n.prototype.destroy=function(){return e(document).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus.chosen",this.activate_action)},n.prototype.container_mousedown=function(t){if(!this.is_disabled){t&&t.type==="mousedown"&&!this.results_showing&&t.preventDefault();if(t==null||!e(t.target).hasClass("search-choice-close"))return this.active_field?!this.is_multiple&&t&&(e(t.target)[0]===this.selected_item[0]||e(t.target).parents("a.chzn-single").length)&&(t.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),e(document).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field()}},n.prototype.container_mouseup=function(e){if(e.target.nodeName==="ABBR"&&!this.is_disabled)return this.results_reset(e)},n.prototype.search_results_mousewheel=function(e){var t,n,r;t=-((n=e.originalEvent)!=null?n.wheelDelta:void 0)||((r=e.originialEvent)!=null?r.detail:void 0);if(t!=null)return e.preventDefault(),e.type==="DOMMouseScroll"&&(t*=40),this.search_results.scrollTop(t+this.search_results.scrollTop())},n.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},n.prototype.close_field=function(){return e(document).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},n.prototype.activate_field=function(){return this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(t){return this.container.is(e(t.target).closest(".chzn-container"))?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=r.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chzn-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chzn-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(e){var t,n,r,i,s;if(e.length){this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClass("highlighted"),r=parseInt(this.search_results.css("maxHeight"),10),s=this.search_results.scrollTop(),i=r+s,n=this.result_highlight.position().top+this.search_results.scrollTop(),t=n+this.result_highlight.outerHeight();if(t>=i)return this.search_results.scrollTop(t-r>0?t-r:0);if(n0)return this.form_field_label.bind("click.chosen",function(e){return t.is_multiple?t.container_mousedown(e):t.activate_field()})},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n.length)return this.result_highlight=n,this.result_select(t),this.search_field.focus()},n.prototype.search_results_mouseover=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n)return this.result_do_highlight(n)},n.prototype.search_results_mouseout=function(t){if(e(t.target).hasClass("active-result"))return this.result_clear_highlight()},n.prototype.choice_build=function(t){var n,r,i=this;return n=e("
      • ",{"class":"search-choice"}).html(""+t.html+""),t.disabled?n.addClass("search-choice-disabled"):(r=e("",{"class":"search-choice-close","data-option-array-index":t.array_index}),r.bind("click.chosen",function(e){return i.choice_destroy_link_click(e)}),n.append(r)),this.search_container.before(n)},n.prototype.choice_destroy_link_click=function(t){t.preventDefault(),t.stopPropagation();if(!this.is_disabled)return this.choice_destroy(e(t.target))},n.prototype.choice_destroy=function(e){if(this.result_deselect(e[0].getAttribute("data-option-array-index")))return this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),e.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){this.form_field.options[0].selected=!0,this.selected_option_count=null,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var n,r,i,s,o,u,a;if(this.result_highlight)return r=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1):(this.is_multiple?r.removeClass("active-result"):(this.result_single_selected&&(this.result_single_selected.removeClass("result-selected"),selected_index=this.result_single_selected[0].getAttribute("data-option-array-index"),this.results_data[selected_index].selected=!1),this.result_single_selected=r),r.addClass("result-selected"),s=this.results_data[r[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(s.text),(!t.metaKey&&!t.ctrlKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,this.search_field_scale());if(!this.is_multiple&&this.allow_custom_value)return a=this.search_field.val(),n=this.add_unique_custom_group(),o=e('"),n.append(o),this.form_field_jq.append(n),this.form_field.options[this.form_field.options.length-1].selected=!0,t.metaKey||this.results_hide(),this.results_build()},n.prototype.find_custom_group=function(){var t,n,r,i,s;s=e("optgroup",this.form_field);for(r=0,i=s.length;r')),e(t)},n.prototype.single_set_selected_text=function(e){return e==null&&(e=this.default_text),e===this.default_text?this.selected_item.addClass("chzn-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chzn-default")),this.selected_item.find("span").text(e)},n.prototype.result_deselect=function(e){var t;return t=this.results_data[e],this.form_field.options[t.options_index].disabled?!1:(t.selected=!1,this.form_field.options[t.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[t.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(!this.allow_single_deselect)return;return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after(''),this.selected_item.addClass("chzn-single-with-deselect")},n.prototype.get_search_text=function(){return this.search_field.val()===this.default_text?"":e("
        ").text(e.trim(this.search_field.val())).html()},n.prototype.winnow_results_set_highlight=function(){var e,t;t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),e=t.length?t.first():this.search_results.find(".active-result").first();if(e!=null)return this.result_do_highlight(e)},n.prototype.no_results=function(t){var n;return n=e('
      • '+this.results_none_found+' ""
      • '),n.find("span").first().html(t),this.search_results.append(n)},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var e;if(!this.results_showing||!this.result_highlight)return this.results_show();e=this.result_highlight.nextAll("li.active-result").first();if(e)return this.result_do_highlight(e)},n.prototype.keyup_arrow=function(){var e;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return e=this.result_highlight.prevAll("li.active-result"),e.length?this.result_do_highlight(e.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())},n.prototype.keydown_backstroke=function(){var e;if(this.pending_backstroke)return this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke();e=this.search_container.siblings("li.search-choice").last();if(e.length&&!e.hasClass("search-choice-disabled"))return this.pending_backstroke=e,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.keydown_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale(),t!==8&&this.pending_backstroke&&this.clear_backstroke();switch(t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:e.preventDefault(),this.keydown_arrow()}},n.prototype.search_field_scale=function(){var t,n,r,i,s,o,u,a,f;if(this.is_multiple){r=0,u=0,s="position:absolute; left: -1000px; top: -1000px; display:none;",o=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(a=0,f=o.length;a",{style:s}),t.text(this.search_field.val()),e("body").append(t),u=t.width()+25,t.remove(),n=this.container.outerWidth(),u>n-10&&(u=n-10),this.search_field.css({width:u+"px"})}},n}(t)}).call(this); \ No newline at end of file +(function(){var a,b,c,d,e,f={}.hasOwnProperty,g=function(a,b){function d(){this.constructor=a}for(var c in b)f.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=function(){function a(){this.options_index=0,this.parsed=[]}return a.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;d\"\'\`]/.test(a)?(b={"<":"<",">":">",'"':""","'":"'","`":"`"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&"})):a},a}(),d.select_to_array=function(a){var b,c,e,f,g;for(c=new d,g=a.childNodes,e=0,f=g.length;e"+a.group_label+""+a.html:a.html},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){var b=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},a.prototype.input_blur=function(a){var b=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return b.blur_test()},100)},a.prototype.results_option_build=function(a){var b,c,d,e,f,g,h;for(b="",e=0,h=this.results_data,f=0,g=h.length;f=this.max_shown_results));f++);return b},a.prototype.result_add_option=function(a){var b,c;return a.search_match&&this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):""},a.prototype.result_add_group=function(a){var b,c;return(a.search_match||a.group_match)&&a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):""},a.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},a.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;b"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+""+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),d<1&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},a.prototype.get_search_regex=function(a){var b,c;return b=this.search_contains?"":"^",c=this.case_sensitive_search?"":"i",new RegExp(b+a,c)},a.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;e0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:case 18:break;default:return this.results_search()}},a.prototype.clipboard_event_checker=function(a){var b=this;return setTimeout(function(){return b.results_search()},50)},a.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field_jq.css("width")||""+this.form_field.offsetWidth+"px"},a.prototype.include_option_in_results=function(a){return!(this.is_multiple&&!this.display_selected_options&&a.selected)&&(!(!this.display_disabled_options&&a.disabled)&&!a.empty)},a.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},a.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},a.prototype.search_results_touchend=function(a){if(this.touch_started)return this.search_results_mouseup(a)},a.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},a.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},a.default_multiple_text="Select Some Options",a.default_single_text="Select an Option",a.default_no_result_text="No results match",a}(),a=jQuery,a.fn.extend({chosen:function(d){return b.browser_is_supported()?this.each(function(b){var e,f;return e=a(this),f=e.data("chosen"),"destroy"===d?void(f instanceof c&&f.destroy()):void(f instanceof c||e.data("chosen",new c(this,d)))}):this}}),c=function(b){function c(){return e=c.__super__.constructor.apply(this,arguments)}return g(c,b),c.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.allow_custom_value=this.form_field_jq.hasClass("chzn-custom-value")||this.options.allow_custom_value,this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},c.prototype.set_up_html=function(){var b,c;return b=["chzn-container"],b.push("chzn-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chzn-rtl"),c={class:b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chzn"),this.container=a("
        ",c),this.is_multiple?this.container.html('
          '):this.container.html('
          '+this.default_text+'
            '),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chzn-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},c.prototype.on_ready=function(){return this.form_field_jq.trigger("liszt:ready",{chosen:this})},c.prototype.register_observers=function(){var a=this;return this.container.bind("touchstart.chosen",function(b){return a.container_mousedown(b),b.preventDefault()}),this.container.bind("touchend.chosen",function(b){return a.container_mouseup(b),b.preventDefault()}),this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("liszt:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("liszt:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("liszt:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("liszt:close.chosen",function(b){a.input_blur(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},c.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},c.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},c.prototype.container_mousedown=function(b){if(!this.is_disabled&&(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null==b||!a(b.target).hasClass("search-choice-close")))return this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chzn-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field()},c.prototype.container_mouseup=function(a){if("ABBR"===a.target.nodeName&&!this.is_disabled)return this.results_reset(a)},c.prototype.search_results_mousewheel=function(a){var b;if(a.originalEvent&&(b=a.originalEvent.deltaY||-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b)return a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())},c.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},c.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},c.prototype.activate_field=function(){return this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},c.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chzn-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},c.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=d.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chzn-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chzn-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},c.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c0)return this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()})},c.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},c.prototype.search_results_mouseup=function(b){var c;if(c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length)return this.result_highlight=c,this.result_select(b),this.search_field.focus()},c.prototype.search_results_mouseover=function(b){var c;if(c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first())return this.result_do_highlight(c)},c.prototype.search_results_mouseout=function(b){if(a(b.target).hasClass("active-result"))return this.result_clear_highlight()},c.prototype.choice_build=function(b){var c,d,e=this;return c=a("
          • ",{class:"search-choice"}).html(""+this.choice_label(b)+""),b.disabled?c.addClass("search-choice-disabled"):(d=a("",{class:"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},c.prototype.choice_destroy_link_click=function(b){if(b.preventDefault(),b.stopPropagation(),!this.is_disabled)return this.choice_destroy(a(b.target))},c.prototype.choice_destroy=function(a){if(this.result_deselect(a[0].getAttribute("data-option-array-index")))return this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()},c.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field)return this.results_hide()},c.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},c.prototype.result_select=function(b){var c,d,f,g,i;return this.result_highlight?(d=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1):(this.is_multiple?d.removeClass("active-result"):this.reset_single_select_options(),d.addClass("result-selected"),f=this.results_data[d[0].getAttribute("data-option-array-index")],f.selected=!0,this.form_field.options[f.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(f):this.single_set_selected_text(this.choice_label(f)),(b.metaKey||b.ctrlKey)&&this.is_multiple||this.results_hide(),this.show_search_field_default(),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[f.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,b.preventDefault(),this.search_field_scale())):!this.is_multiple&&this.allow_custom_value?(i=this.search_field.val(),c=this.add_unique_custom_group(),g=a('"),c.append(g),this.form_field_jq.append(c),this.form_field.options[this.form_field.options.length-1].selected=!0,b.metaKey||this.results_hide(),this.results_build()):void 0},c.prototype.find_custom_group=function(){var b,c,d,e,f;for(f=a("optgroup",this.form_field),d=0,e=f.length;d')),a(b)},c.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chzn-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chzn-default")),this.selected_item.find("span").html(a)},c.prototype.result_deselect=function(a){var b;return b=this.results_data[a],!this.form_field.options[b.options_index].disabled&&(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},c.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after(''),this.selected_item.addClass("chzn-single-with-deselect")},c.prototype.get_search_text=function(){return a("
            ").text(a.trim(this.search_field.val())).html()},c.prototype.winnow_results_set_highlight=function(){var a,b;if(b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a)return this.result_do_highlight(a)},c.prototype.no_results=function(b){var c;return c=a('
          • '+this.results_none_found+' ""
          • '),c.find("span").first().html(b),this.search_results.append(c),this.form_field_jq.trigger("liszt:no_results",{chosen:this})},c.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},c.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},c.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},c.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},c.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},c.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},c.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;i",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},c}(b)}).call(this); \ No newline at end of file