Advertisement
uphero

Untitled

Feb 3rd, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ! function() {
  2.     var SelectParser;
  3.     SelectParser = function() {
  4.         function SelectParser() {
  5.             this.options_index = 0, this.parsed = []
  6.         }
  7.         return SelectParser.prototype.add_node = function(a) {
  8.             return "OPTGROUP" === a.nodeName.toUpperCase() ? this.add_group(a) : this.add_option(a)
  9.         }, SelectParser.prototype.add_group = function(a) {
  10.             var b, c, d, e, f, g;
  11.             for (b = this.parsed.length, this.parsed.push({
  12.                     array_index: b,
  13.                     group: !0,
  14.                     label: this.escapeExpression(a.label),
  15.                     children: 0,
  16.                     disabled: a.disabled
  17.                 }), f = a.childNodes, g = [], d = 0, e = f.length; e > d; d++) c = f[d], g.push(this.add_option(c, b, a.disabled));
  18.             return g
  19.         }, SelectParser.prototype.add_option = function(a, b, c) {
  20.             return "OPTION" === a.nodeName.toUpperCase() ? ("" !== a.text ? (null != b && (this.parsed[b].children += 1), this.parsed.push({
  21.                 array_index: this.parsed.length,
  22.                 options_index: this.options_index,
  23.                 value: a.value,
  24.                 text: a.text,
  25.                 html: a.innerHTML,
  26.                 selected: a.selected,
  27.                 disabled: c === !0 ? c : a.disabled,
  28.                 group_array_index: b,
  29.                 classes: a.className,
  30.                 style: a.style.cssText
  31.             })) : this.parsed.push({
  32.                 array_index: this.parsed.length,
  33.                 options_index: this.options_index,
  34.                 empty: !0
  35.             }), this.options_index += 1) : void 0
  36.         }, SelectParser.prototype.escapeExpression = function(a) {
  37.             var b, c;
  38.             return null == a || a === !1 ? "" : /[\&\<\>\"\'\`]/.test(a) ? (b = {
  39.                 "<": "&lt;",
  40.                 ">": "&gt;",
  41.                 '"': "&quot;",
  42.                 "'": "&#x27;",
  43.                 "`": "&#x60;"
  44.             }, c = /&(?!\w+;)|[\<\>\"\'\`]/g, a.replace(c, function(a) {
  45.                 return b[a] || "&amp;"
  46.             })) : a
  47.         }, SelectParser
  48.     }(), SelectParser.select_to_array = function(a) {
  49.         var b, c, d, e, f;
  50.         for (c = new SelectParser, f = a.childNodes, d = 0, e = f.length; e > d; d++) b = f[d], c.add_node(b);
  51.         return c.parsed
  52.     }, this.SelectParser = SelectParser
  53. }.call(this),
  54.     function() {
  55.         var AbstractChosen, a;
  56.         a = this, AbstractChosen = function() {
  57.             function AbstractChosen(a, b) {
  58.                 this.form_field = a, this.options = null != b ? b : {}, AbstractChosen.browser_is_supported() && (this.is_multiple = this.form_field.multiple, this.set_default_text(), this.set_default_values(), this.setup(), this.set_up_html(), this.register_observers(), this.finish_setup())
  59.             }
  60.             return AbstractChosen.prototype.set_default_values = function() {
  61.                 var a = this;
  62.                 return this.click_test_action = function(b) {
  63.                     return a.test_active_click(b)
  64.                 }, this.activate_action = function(b) {
  65.                     return a.activate_field(b)
  66.                 }, this.active_field = !1, this.mouse_on_container = !1, this.results_showing = !1, this.result_highlighted = null, this.result_single_selected = null, this.allow_single_deselect = null != this.options.allow_single_deselect && null != this.form_field.options[0] && "" === this.form_field.options[0].text ? this.options.allow_single_deselect : !1, this.disable_search_threshold = this.options.disable_search_threshold || 0, this.disable_search = this.options.disable_search || !1, this.enable_split_word_search = null != this.options.enable_split_word_search ? this.options.enable_split_word_search : !0, this.group_search = null != this.options.group_search ? this.options.group_search : !0, this.search_contains = this.options.search_contains || !1, this.single_backstroke_delete = this.options.single_backstroke_delete || !1, this.max_selected_options = this.options.max_selected_options || 1 / 0, this.inherit_select_classes = this.options.inherit_select_classes || !1
  67.             }, AbstractChosen.prototype.set_default_text = function() {
  68.                 return this.default_text = this.form_field.getAttribute("data-placeholder") ? this.form_field.getAttribute("data-placeholder") : this.is_multiple ? this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text : this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text, this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text
  69.             }, AbstractChosen.prototype.mouse_enter = function() {
  70.                 return this.mouse_on_container = !0
  71.             }, AbstractChosen.prototype.mouse_leave = function() {
  72.                 return this.mouse_on_container = !1
  73.             }, AbstractChosen.prototype.input_focus = function() {
  74.                 var a = this;
  75.                 if (this.is_multiple) {
  76.                     if (!this.active_field) return setTimeout(function() {
  77.                         return a.container_mousedown()
  78.                     }, 50)
  79.                 } else if (!this.active_field) return this.activate_field()
  80.             }, AbstractChosen.prototype.input_blur = function() {
  81.                 var a = this;
  82.                 return this.mouse_on_container ? void 0 : (this.active_field = !1, setTimeout(function() {
  83.                     return a.blur_test()
  84.                 }, 100))
  85.             }, AbstractChosen.prototype.results_option_build = function(a) {
  86.                 var b, c, d, e, f;
  87.                 for (b = "", f = this.results_data, d = 0, e = f.length; e > d; d++) c = f[d], c.group && (c.search_match || c.group_match) ? b += this.result_add_group(c) : !c.empty && c.search_match && (b += this.result_add_option(c)), (null != a ? a.first : void 0) && (c.selected && this.is_multiple ? this.choice_build(c) : c.selected && !this.is_multiple && this.single_set_selected_text(c.text));
  88.                 return b
  89.             }, AbstractChosen.prototype.result_add_option = function(a) {
  90.                 var b, c;
  91.                 return 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 = "" !== a.style.cssText ? ' style="' + a.style + '"' : "", '<li class="' + b.join(" ") + '"' + c + ' data-option-array-index="' + a.array_index + '">' + a.search_text + "</li>"
  92.             }, AbstractChosen.prototype.result_add_group = function(a) {
  93.                 return '<li class="group-result">' + a.search_text + "</li>"
  94.             }, AbstractChosen.prototype.results_update_field = function() {
  95.                 return this.set_default_text(), this.is_multiple || this.results_reset_cleanup(), this.result_clear_highlight(), this.result_single_selected = null, this.results_build(), this.results_showing ? this.winnow_results() : void 0
  96.             }, AbstractChosen.prototype.results_toggle = function() {
  97.                 return this.results_showing ? this.results_hide() : this.results_show()
  98.             }, AbstractChosen.prototype.results_search = function() {
  99.                 return this.results_showing ? this.winnow_results() : this.results_show()
  100.             }, AbstractChosen.prototype.winnow_results = function() {
  101.                 var a, b, c, d, e, f, g, h, i, j, k;
  102.                 for (this.no_results_clear(), d = 0, e = this.get_search_text(), c = this.search_contains ? "" : "^", b = new RegExp(c + e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "i"), h = new RegExp(e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "i"), k = this.results_data, i = 0, j = k.length; j > i; i++) a = k[i], a.empty || (a.group && (a.group_match = !1), (!a.group || this.group_search) && (a.search_match = !1, a.search_text = a.group ? a.label : a.html, a.search_match = this.search_string_match(a.search_text, b), a.search_match && (d += 1), a.search_match ? (e.length && (f = a.search_text.search(h), g = a.search_text.substr(0, f + e.length) + "</em>" + a.search_text.substr(f + e.length), a.search_text = g.substr(0, f) + "<em>" + g.substr(f)), null != a.group_array_index && (this.results_data[a.group_array_index].group_match = !0)) : null != a.group_array_index && this.results_data[a.group_array_index].search_match && (a.search_match = !0)));
  103.                 return 1 > d && e.length ? (this.update_results_content(""), this.result_clear_highlight(), this.no_results(e)) : (this.update_results_content(this.results_option_build()), this.winnow_results_set_highlight())
  104.             }, AbstractChosen.prototype.search_string_match = function(a, b) {
  105.                 var c, d, e, f;
  106.                 if (b.test(a)) return !0;
  107.                 if (this.enable_split_word_search && (a.indexOf(" ") >= 0 || 0 === a.indexOf("[")) && (d = a.replace(/\[|\]/g, "").split(" "), d.length))
  108.                     for (e = 0, f = d.length; f > e; e++)
  109.                         if (c = d[e], b.test(c)) return !0
  110.             }, AbstractChosen.prototype.choices_count = function() {
  111.                 var a, b, c, d;
  112.                 if (null != this.selected_option_count) return this.selected_option_count;
  113.                 for (this.selected_option_count = 0, d = this.form_field.options, b = 0, c = d.length; c > b; b++) a = d[b], a.selected && (this.selected_option_count += 1);
  114.                 return this.selected_option_count
  115.             }, AbstractChosen.prototype.choices_click = function(a) {
  116.                 return a.preventDefault(), this.results_showing || this.is_disabled ? void 0 : this.results_show()
  117.             }, AbstractChosen.prototype.keyup_checker = function(a) {
  118.                 var b, c;
  119.                 switch (b = null != (c = a.which) ? c : a.keyCode, this.search_field_scale(), b) {
  120.                     case 8:
  121.                         if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) return this.keydown_backstroke();
  122.                         if (!this.pending_backstroke) return this.result_clear_highlight(), this.results_search();
  123.                         break;
  124.                     case 13:
  125.                         if (a.preventDefault(), this.results_showing) return this.result_select(a);
  126.                         break;
  127.                     case 27:
  128.                         return this.results_showing && this.results_hide(), !0;
  129.                     case 9:
  130.                     case 38:
  131.                     case 40:
  132.                     case 16:
  133.                     case 91:
  134.                     case 17:
  135.                         break;
  136.                     default:
  137.                         return this.results_search()
  138.                 }
  139.             }, AbstractChosen.prototype.container_width = function() {
  140.                 return null != this.options.width ? this.options.width : "" + this.form_field.offsetWidth + "px"
  141.             }, AbstractChosen.browser_is_supported = function() {
  142.                 var a;
  143.                 return "Microsoft Internet Explorer" === window.navigator.appName ? null !== (a = document.documentMode) && a >= 8 : !0
  144.             }, AbstractChosen.default_multiple_text = "Select Some Options", AbstractChosen.default_single_text = "Select an Option", AbstractChosen.default_no_result_text = "No results match", AbstractChosen
  145.         }(), a.AbstractChosen = AbstractChosen
  146.     }.call(this),
  147.     function() {
  148.         var a, Chosen, b, c, d = {}.hasOwnProperty,
  149.             e = function(a, b) {
  150.                 function c() {
  151.                     this.constructor = a
  152.                 }
  153.                 for (var e in b) d.call(b, e) && (a[e] = b[e]);
  154.                 return c.prototype = b.prototype, a.prototype = new c, a.__super__ = b.prototype, a
  155.             };
  156.         b = this, a = jQuery, a.fn.extend({
  157.                 chosen: function(b) {
  158.                     return AbstractChosen.browser_is_supported() ? this.each(function() {
  159.                         var c;
  160.                         return c = a(this), c.hasClass("chzn-done") ? void 0 : c.data("chosen", new Chosen(this, b))
  161.                     }) : this
  162.                 }
  163.             }), Chosen = function(d) {
  164.                 function Chosen() {
  165.                     return c = Chosen.__super__.constructor.apply(this, arguments)
  166.                 }
  167.                 return e(Chosen, d), Chosen.prototype.setup = function() {
  168.                         return this.form_field_jq = a(this.form_field), this.current_selectedIndex = this.form_field.selectedIndex, this.is_rtl = this.form_field_jq.hasClass("chzn-rtl")
  169.                     }, Chosen.prototype.finish_setup = function() {
  170.                         return this.form_field_jq.addClass("chzn-done")
  171.                     }, Chosen.prototype.set_up_html = function() {
  172.                         var b, c;
  173.                         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 = {
  174.                                 "class": b.join(" "),
  175.                                 style: "width: " + this.container_width() + ";",
  176.                                 title: this.form_field.title
  177.                             }, this.form_field.id.length && (c.id = this.form_field.id.replace(/[^\w]/g, "_") + "_chzn"), this.container = a("<div />", c), this.is_multiple ? this.container.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop"><ul class="chzn-results"></ul></div>') : this.container.html('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),
  178.                             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", {
  179.                                 chosen: this
  180.                             })
  181.                     }, Chosen.prototype.register_observers = function() {
  182.                         var a = this;
  183.                         return this.container.mousedown(function(b) {
  184.                             a.container_mousedown(b)
  185.                         }), this.container.mouseup(function(b) {
  186.                             a.container_mouseup(b)
  187.                         }), this.container.mouseenter(function(b) {
  188.                             a.mouse_enter(b)
  189.                         }), this.container.mouseleave(function(b) {
  190.                             a.mouse_leave(b)
  191.                         }), this.search_results.mouseup(function(b) {
  192.                             a.search_results_mouseup(b)
  193.                         }), this.search_results.mouseover(function(b) {
  194.                             a.search_results_mouseover(b)
  195.                         }), this.search_results.mouseout(function(b) {
  196.                             a.search_results_mouseout(b)
  197.                         }), this.search_results.bind("mousewheel DOMMouseScroll", function(b) {
  198.                             a.search_results_mousewheel(b)
  199.                         }), this.form_field_jq.bind("liszt:updated", function(b) {
  200.                             a.results_update_field(b)
  201.                         }), this.form_field_jq.bind("liszt:activate", function(b) {
  202.                             a.activate_field(b)
  203.                         }), this.form_field_jq.bind("liszt:open", function(b) {
  204.                             a.container_mousedown(b)
  205.                         }), this.search_field.blur(function(b) {
  206.                             a.input_blur(b)
  207.                         }), this.search_field.keyup(function(b) {
  208.                             a.keyup_checker(b)
  209.                         }), this.search_field.keydown(function(b) {
  210.                             a.keydown_checker(b)
  211.                         }), this.search_field.focus(function(b) {
  212.                             a.input_focus(b)
  213.                         }), this.is_multiple ? this.search_choices.click(function(b) {
  214.                             a.choices_click(b)
  215.                         }) : this.container.click(function(a) {
  216.                             a.preventDefault()
  217.                         })
  218.                     }, Chosen.prototype.search_field_disabled = function() {
  219.                         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", 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", this.activate_action))
  220.                     }, Chosen.prototype.container_mousedown = function(b) {
  221.                         return this.is_disabled || (b && "mousedown" === b.type && !this.results_showing && b.preventDefault(), null != b && a(b.target).hasClass("search-choice-close")) ? void 0 : (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(document).click(this.click_test_action), this.results_show()), this.activate_field())
  222.                     }, Chosen.prototype.container_mouseup = function(a) {
  223.                         return "ABBR" !== a.target.nodeName || this.is_disabled ? void 0 : this.results_reset(a)
  224.                     }, Chosen.prototype.search_results_mousewheel = function(a) {
  225.                         var b, c, d;
  226.                         return b = -(null != (c = a.originalEvent) ? c.wheelDelta : void 0) || (null != (d = a.originialEvent) ? d.detail : void 0), null != b ? (a.preventDefault(), "DOMMouseScroll" === a.type && (b = 40 * b), this.search_results.scrollTop(b + this.search_results.scrollTop())) : void 0
  227.                     }, Chosen.prototype.blur_test = function() {
  228.                         return !this.active_field && this.container.hasClass("chzn-container-active") ? this.close_field() : void 0
  229.                     }, Chosen.prototype.close_field = function() {
  230.                         return a(document).unbind("click", 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()
  231.                     }, Chosen.prototype.activate_field = function() {
  232.                         return this.container.addClass("chzn-container-active"), this.active_field = !0, this.search_field.val(this.search_field.val()), this.search_field.focus()
  233.                     }, Chosen.prototype.test_active_click = function(b) {
  234.                         return this.container.is(a(b.target).closest(".chzn-container")) ? this.active_field = !0 : this.close_field()
  235.                     }, Chosen.prototype.results_build = function() {
  236.                         return this.parsing = !0, this.selected_option_count = null, this.results_data = b.SelectParser.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({
  237.                             first: !0
  238.                         })), this.search_field_disabled(), this.show_search_field_default(), this.search_field_scale(), this.parsing = !1
  239.                     }, Chosen.prototype.result_do_highlight = function(a) {
  240.                         var b, c, d, e, f;
  241.                         if (a.length) {
  242.                             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);
  243.                             if (f > c) return this.search_results.scrollTop(c)
  244.                         }
  245.                     }, Chosen.prototype.result_clear_highlight = function() {
  246.                         return this.result_highlight && this.result_highlight.removeClass("highlighted"), this.result_highlight = null
  247.                     }, Chosen.prototype.results_show = function() {
  248.                         return this.is_multiple && this.max_selected_options <= this.choices_count() ? (this.form_field_jq.trigger("liszt:maxselected", {
  249.                             chosen: this
  250.                         }), !1) : (this.container.addClass("chzn-with-drop"), this.form_field_jq.trigger("liszt:showing_dropdown", {
  251.                             chosen: this
  252.                         }), this.results_showing = !0, this.search_field.focus(), this.search_field.val(this.search_field.val()), this.winnow_results())
  253.                     }, Chosen.prototype.update_results_content = function(a) {
  254.                         return this.search_results.html(a)
  255.                     }, Chosen.prototype.results_hide = function() {
  256.                         return this.results_showing && (this.result_clear_highlight(), this.container.removeClass("chzn-with-drop"), this.form_field_jq.trigger("liszt:hiding_dropdown", {
  257.                             chosen: this
  258.                         })), this.results_showing = !1
  259.                     }, Chosen.prototype.set_tab_index = function() {
  260.                         var a;
  261.                         return this.form_field_jq.attr("tabindex") ? (a = this.form_field_jq.attr("tabindex"), this.form_field_jq.attr("tabindex", -1), this.search_field.attr("tabindex", a)) : void 0
  262.                     }, Chosen.prototype.set_label_behavior = function() {
  263.                         var b = this;
  264.                         return this.form_field_label = this.form_field_jq.parents("label"), !this.form_field_label.length && this.form_field.id.length && (this.form_field_label = a("label[for='" + this.form_field.id + "']")), this.form_field_label.length > 0 ? this.form_field_label.click(function(a) {
  265.                             return b.is_multiple ? b.container_mousedown(a) : b.activate_field()
  266.                         }) : void 0
  267.                     }, Chosen.prototype.show_search_field_default = function() {
  268.                         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"))
  269.                     }, Chosen.prototype.search_results_mouseup = function(b) {
  270.                         var c;
  271.                         return c = a(b.target).hasClass("active-result") ? a(b.target) : a(b.target).parents(".active-result").first(), c.length ? (this.result_highlight = c, this.result_select(b), this.search_field.focus()) : void 0
  272.                     }, Chosen.prototype.search_results_mouseover = function(b) {
  273.                         var c;
  274.                         return c = a(b.target).hasClass("active-result") ? a(b.target) : a(b.target).parents(".active-result").first(), c ? this.result_do_highlight(c) : void 0
  275.                     }, Chosen.prototype.search_results_mouseout = function(b) {
  276.                         return a(b.target).hasClass("active-result") ? this.result_clear_highlight() : void 0
  277.                     }, Chosen.prototype.choice_build = function(b) {
  278.                         var c, d, e = this;
  279.                         return c = a("<li />", {
  280.                             "class": "search-choice"
  281.                         }).html("<span>" + b.html + "</span>"), b.disabled ? c.addClass("search-choice-disabled") : (d = a("<a />", {
  282.                             href: "#",
  283.                             "class": "search-choice-close",
  284.                             rel: b.array_index
  285.                         }), d.click(function(a) {
  286.                             return e.choice_destroy_link_click(a)
  287.                         }), c.append(d)), this.search_container.before(c)
  288.                     }, Chosen.prototype.choice_destroy_link_click = function(b) {
  289.                         return b.preventDefault(), b.stopPropagation(), this.is_disabled ? void 0 : this.choice_destroy(a(b.target))
  290.                     }, Chosen.prototype.choice_destroy = function(a) {
  291.                         return this.result_deselect(a.attr("rel")) ? (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()) : void 0
  292.                     }, Chosen.prototype.results_reset = function() {
  293.                         return 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"), this.active_field ? this.results_hide() : void 0
  294.                     }, Chosen.prototype.results_reset_cleanup = function() {
  295.                         return this.current_selectedIndex = this.form_field.selectedIndex, this.selected_item.find("abbr").remove()
  296.                     }, Chosen.prototype.result_select = function(a) {
  297.                         var b, c;
  298.                         return this.result_highlight ? (b = this.result_highlight, this.result_clear_highlight(), this.is_multiple && this.max_selected_options <= this.choices_count() ? (this.form_field_jq.trigger("liszt:maxselected", {
  299.                             chosen: this
  300.                         }), !1) : (this.is_multiple ? b.removeClass("active-result") : (this.search_results.find(".result-selected").removeClass("result-selected"), this.result_single_selected = b), b.addClass("result-selected"), c = this.results_data[b[0].getAttribute("data-option-array-index")], c.selected = !0, this.form_field.options[c.options_index].selected = !0, this.selected_option_count = null, this.is_multiple ? this.choice_build(c) : this.single_set_selected_text(c.text), (a.metaKey || a.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", {
  301.                             selected: this.form_field.options[c.options_index].value
  302.                         }), this.current_selectedIndex = this.form_field.selectedIndex, this.search_field_scale())) : void 0
  303.                     }, Chosen.prototype.single_set_selected_text = function(a) {
  304.                         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").text(a)
  305.                     }, Chosen.prototype.result_deselect = function(a) {
  306.                         var b;
  307.                         return b = this.results_data[a], this.form_field.options[b.options_index].disabled ? !1 : (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", {
  308.                             deselected: this.form_field.options[b.options_index].value
  309.                         }), this.search_field_scale(), !0)
  310.                     }, Chosen.prototype.single_deselect_control_build = function() {
  311.                         return this.allow_single_deselect ? (this.selected_item.find("abbr").length || this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'), this.selected_item.addClass("chzn-single-with-deselect")) : void 0
  312.                     }, Chosen.prototype.get_search_text = function() {
  313.                         return this.search_field.val() === this.default_text ? "" : a("<div/>").text(a.trim(this.search_field.val())).html()
  314.                     }, Chosen.prototype.winnow_results_set_highlight = function() {
  315.                         var a, b;
  316.                         return 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 ? this.result_do_highlight(a) : void 0
  317.                     }, Chosen.prototype.no_results = function(b) {
  318.                         var c;
  319.                         return c = a('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>'), c.find("span").first().html(b), this.search_results.append(c)
  320.                     }, Chosen.prototype.no_results_clear = function() {
  321.                         return this.search_results.find(".no-results").remove()
  322.                     }, Chosen.prototype.keydown_arrow = function() {
  323.                         var a;
  324.                         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()
  325.                     }, Chosen.prototype.keyup_arrow = function() {
  326.                         var a;
  327.                         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()
  328.                     }, Chosen.prototype.keydown_backstroke = function() {
  329.                         var a;
  330.                         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)
  331.                     }, Chosen.prototype.clear_backstroke = function() {
  332.                         return this.pending_backstroke && this.pending_backstroke.removeClass("search-choice-focus"), this.pending_backstroke = null
  333.                     }, Chosen.prototype.keydown_checker = function(a) {
  334.                         var b, c;
  335.                         switch (b = null != (c = a.which) ? c : a.keyCode, this.search_field_scale(), 8 !== b && this.pending_backstroke && this.clear_backstroke(), b) {
  336.                             case 8:
  337.                                 this.backstroke_length = this.search_field.val().length;
  338.                                 break;
  339.                             case 9:
  340.                                 this.results_showing && !this.is_multiple && this.result_select(a), this.mouse_on_container = !1;
  341.                                 break;
  342.                             case 13:
  343.                                 a.preventDefault();
  344.                                 break;
  345.                             case 38:
  346.                                 a.preventDefault(), this.keyup_arrow();
  347.                                 break;
  348.                             case 40:
  349.                                 a.preventDefault(), this.keydown_arrow()
  350.                         }
  351.                     }, Chosen.prototype.search_field_scale = function() {
  352.                         var b, c, d, e, f, g, h, i, j;
  353.                         if (this.is_multiple) {
  354.                             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; j > i; i++) e = g[i], f += e + ":" + this.search_field.css(e) + ";";
  355.                             return b = a("<div />",
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement