woocommerce/assets/js/chosen.jquery.min.js

9 lines
22 KiB
JavaScript
Raw Normal View History

// Chosen, a Select Box Enhancer for jQuery and Protoype
// by Patrick Filler for Harvest, http://getharvest.com
//
// Version 0.9.8
// 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 `cake build`, do not edit it by hand.
((function(){var a;a=function(){function a(){this.options_index=0;this.parsed=[]}a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)};a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length;this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled});f=a.childNodes;g=[];for(d=0,e=f.length;d<e;d++){c=f[d];g.push(this.add_option(c,b,a.disabled))}return g};a.prototype.add_option=function(a,b,c){if(a.nodeName==="OPTION"){if(a.text!==""){b!=null&&(this.parsed[b].children+=1);this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})}else this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0});return this.options_index+=1}};return a}();a.select_to_array=function(b){var c,d,e,f,g;d=new a;g=b.childNodes;for(e=0,f=g.length;e<f;e++){c=g[e];d.add_node(c)}return d.parsed};this.SelectParser=a})).call(this);((function(){var a,b;b=this;a=function(){function a(a,b){this.form_field=a;this.options=b!=null?b:{};this.set_default_values();this.is_multiple=this.form_field.multiple;this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option";this.setup();this.set_up_html();this.register_observers();this.finish_setup()}a.prototype.set_default_values=function(){var a=this;this.click_test_action=function(b){return a.test_active_click(b)};this.activate_action=function(b){return a.activate_field(b)};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=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1;this.disable_search_threshold=this.options.disable_search_threshold||0;this.search_contains=this.options.search_contains||!1;this.choices=0;return this.results_none_found=this.options.no_results_text||"No results match"};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.active_field)return setTimeout(function(){return b.container_mousedown()},50)};a.prototype.input_blur=function(a){var b=this;if(!this.mouse_on_container){this.active_field=!1;return setTimeout(function(){return b.blur_test()},100)}};a.prototype.result_add_option=function(a){var b,c;if(!a.disabled){a.dom_id=this.container_id+"_o_"+a.array_index;b=a.selected&&this.is_multiple?[]:["active-result"];a.selected&&b.push("result-selected");a.group_array_index!=null&&b.push("group-option");a.classes!==""&&b.push(a.classes);c=a.style.cssText!==""?' style="'+a.style+'"':"";return'<li id="'+a.dom_id+'" class="'+b.join(" ")+'"'+c+">"+a.html+"</li>"}return""};a.prototype.results_update_field=function(){this.result_clear_highlight();this.result_single_selected=null;return this.results_build()};a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()};a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()};a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode;this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke){this.result_clear_highlight();return this.results_search()}break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:this.results_showing&&this.results_hide();return!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}};a.prototype.generate_field_id=function(){var a;a=this.generate_random_id();this.form_field.id=a;return a};a.prototype.generate_random_char=function(){var a,b,c;a="0123456789ABCDEFGHIJKLMNOP