[2.3] Remove minimum results for search to prevent issues with state box

Fixes #8002
This commit is contained in:
Mike Jolley 2015-04-23 15:55:18 +01:00
parent 8731c5b0d2
commit 6181a061d6
2 changed files with 1 additions and 2 deletions

View File

@ -62,7 +62,6 @@ jQuery( function( $ ) {
var wc_country_select_select2 = function() {
$( 'select.country_select:visible, select.state_select:visible' ).each( function() {
var select2_args = $.extend({
minimumResultsForSearch: 10,
placeholder: $( this ).attr( 'placeholder' ),
placeholderOption: 'first',
width: '100%'

View File

@ -1 +1 @@
jQuery(function(a){function b(){var a={formatMatches:function(a){return 1===a?wc_country_select_params.i18n_matches_1:wc_country_select_params.i18n_matches_n.replace("%qty%",a)},formatNoMatches:function(){return wc_country_select_params.i18n_no_matches},formatAjaxError:function(){return wc_country_select_params.i18n_ajax_error},formatInputTooShort:function(a,b){var c=b-a.length;return 1===c?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",c)},formatInputTooLong:function(a,b){var c=a.length-b;return 1===c?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",c)},formatSelectionTooBig:function(a){return 1===a?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",a)},formatLoadMore:function(){return wc_country_select_params.i18n_load_more},formatSearching:function(){return wc_country_select_params.i18n_searching}};return a}if("undefined"==typeof wc_country_select_params)return!1;if(a().select2){var c=function(){a("select.country_select:visible, select.state_select:visible").each(function(){var c=a.extend({minimumResultsForSearch:10,placeholder:a(this).attr("placeholder"),placeholderOption:"first",width:"100%"},b());a(this).select2(c)})};c(),a(document.body).bind("country_to_state_changed",function(){c()})}var d=wc_country_select_params.countries.replace(/&quot;/g,'"'),e=a.parseJSON(d);a(document.body).on("change","select.country_to_state, input.country_to_state",function(){var b=a(this).val(),c=a(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state"),d=c.parent(),f=c.attr("name"),g=c.attr("id"),h=c.val(),i=c.attr("placeholder");if(e[b])if(a.isEmptyObject(e[b]))c.parent().hide().find(".select2-container").remove(),c.replaceWith('<input type="hidden" class="hidden" name="'+f+'" id="'+g+'" value="" placeholder="'+i+'" />'),a(document.body).trigger("country_to_state_changed",[b,a(this).closest("div")]);else{var j="",k=e[b];for(var l in k)k.hasOwnProperty(l)&&(j=j+'<option value="'+l+'">'+k[l]+"</option>");c.parent().show(),c.is("input")&&(c.replaceWith('<select name="'+f+'" id="'+g+'" class="state_select" placeholder="'+i+'"></select>'),c=a(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state")),c.html('<option value="">'+wc_country_select_params.i18n_select_state_text+"</option>"+j),c.val(h).change(),a(document.body).trigger("country_to_state_changed",[b,a(this).closest("div")])}else c.is("select")?(d.show().find(".select2-container").remove(),c.replaceWith('<input type="text" class="input-text" name="'+f+'" id="'+g+'" placeholder="'+i+'" />'),a(document.body).trigger("country_to_state_changed",[b,a(this).closest("div")])):c.is(".hidden")&&(d.show().find(".select2-container").remove(),c.replaceWith('<input type="text" class="input-text" name="'+f+'" id="'+g+'" placeholder="'+i+'" />'),a(document.body).trigger("country_to_state_changed",[b,a(this).closest("div")]));a(document.body).trigger("country_to_state_changing",[b,a(this).closest("div")])}),a(function(){a(":input.country_to_state").change()})});
jQuery(function(a){function b(){var a={formatMatches:function(a){return 1===a?wc_country_select_params.i18n_matches_1:wc_country_select_params.i18n_matches_n.replace("%qty%",a)},formatNoMatches:function(){return wc_country_select_params.i18n_no_matches},formatAjaxError:function(){return wc_country_select_params.i18n_ajax_error},formatInputTooShort:function(a,b){var c=b-a.length;return 1===c?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",c)},formatInputTooLong:function(a,b){var c=a.length-b;return 1===c?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",c)},formatSelectionTooBig:function(a){return 1===a?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",a)},formatLoadMore:function(){return wc_country_select_params.i18n_load_more},formatSearching:function(){return wc_country_select_params.i18n_searching}};return a}if("undefined"==typeof wc_country_select_params)return!1;if(a().select2){var c=function(){a("select.country_select:visible, select.state_select:visible").each(function(){var c=a.extend({placeholder:a(this).attr("placeholder"),placeholderOption:"first",width:"100%"},b());a(this).select2(c)})};c(),a(document.body).bind("country_to_state_changed",function(){c()})}var d=wc_country_select_params.countries.replace(/&quot;/g,'"'),e=a.parseJSON(d);a(document.body).on("change","select.country_to_state, input.country_to_state",function(){var b=a(this).val(),c=a(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state"),d=c.parent(),f=c.attr("name"),g=c.attr("id"),h=c.val(),i=c.attr("placeholder");if(e[b])if(a.isEmptyObject(e[b]))c.parent().hide().find(".select2-container").remove(),c.replaceWith('<input type="hidden" class="hidden" name="'+f+'" id="'+g+'" value="" placeholder="'+i+'" />'),a(document.body).trigger("country_to_state_changed",[b,a(this).closest("div")]);else{var j="",k=e[b];for(var l in k)k.hasOwnProperty(l)&&(j=j+'<option value="'+l+'">'+k[l]+"</option>");c.parent().show(),c.is("input")&&(c.replaceWith('<select name="'+f+'" id="'+g+'" class="state_select" placeholder="'+i+'"></select>'),c=a(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state")),c.html('<option value="">'+wc_country_select_params.i18n_select_state_text+"</option>"+j),c.val(h).change(),a(document.body).trigger("country_to_state_changed",[b,a(this).closest("div")])}else c.is("select")?(d.show().find(".select2-container").remove(),c.replaceWith('<input type="text" class="input-text" name="'+f+'" id="'+g+'" placeholder="'+i+'" />'),a(document.body).trigger("country_to_state_changed",[b,a(this).closest("div")])):c.is(".hidden")&&(d.show().find(".select2-container").remove(),c.replaceWith('<input type="text" class="input-text" name="'+f+'" id="'+g+'" placeholder="'+i+'" />'),a(document.body).trigger("country_to_state_changed",[b,a(this).closest("div")]));a(document.body).trigger("country_to_state_changing",[b,a(this).closest("div")])}),a(function(){a(":input.country_to_state").change()})});