Spade
Mini Shell
(function(u,f,h){u.fn.jchosen=function(_){return
h.browser_is_supported()?this.each(function(p){var
i,o;if(i=u(this),o=i.data("chosen"),_==="destroy"){o
instanceof JoomlaChosen&&o.destroy();return}o instanceof
JoomlaChosen||i.data("chosen",new
JoomlaChosen(this,_))}):this},JoomlaChosen=function(_){var
p={}.hasOwnProperty,i=function(t,e){for(var s in
e)p.call(e,s)&&(t[s]=e[s]);function r(){this.constructor=t}return
r.prototype=e.prototype,t.prototype=new
r,t.__super__=e.prototype,t};i(o,_);function o(){return
_ref=o.__super__.constructor.apply(this,arguments),_ref}return
o.prototype.setup=function(){var t;return
t=o.__super__.setup.apply(this,arguments),this.allow_custom_value=this.form_field_jq.hasClass("chosen-custom-value")||this.options.allow_custom_value,this.custom_value_prefix=this.form_field_jq.attr("data-custom_value_prefix")||this.custom_value_prefix,t},o.prototype.set_default_text=function(){return
this.custom_group_text=this.form_field.getAttribute("data-custom_group_text")||this.options.custom_group_text||"Custom
Value",o.__super__.set_default_text.apply(this,arguments)},o.prototype.result_select=function(t){var
e,s,r;return!this.result_highlight&&!this.is_multiple&&this.allow_custom_value?(r=this.search_field.val(),e=this.add_unique_custom_group(),s=u('<option
value="'+this.custom_value_prefix+r+'">'+r+"</option>"),e.append(s),this.form_field_jq.append(e),this.form_field.options[this.form_field.options.length-1].selected=!0,t.metaKey||this.results_hide(),this.results_build()):o.__super__.result_select.apply(this,arguments)},o.prototype.find_custom_group=function(){var
t,e,s,r,n;for(n=u("optgroup",this.form_field),s=0,r=n.length;s<r;s++)e=n[s],e.getAttribute("label")===this.custom_group_text&&(t=e);return
t},o.prototype.add_unique_custom_group=function(){var t;return
t=this.find_custom_group(),t||(t=u('<optgroup
label="'+this.custom_group_text+'"></optgroup>')),u(t)},o.prototype.container_width=function(){return
this.options.width!=null?this.options.width:this.form_field_jq.css("width")||""+this.form_field.offsetWidth+"px"},o}(f)})(jQuery,document.Chosen,document.AbstractChosen);