Hacked By AnonymousFox
jQuery(function(a){function c(){return{language:{errorLoading:function(){return kkart_enhanced_select_params.i18n_searching},inputTooLong:function(e){e=e.input.length-e.maximum;return 1==e?kkart_enhanced_select_params.i18n_input_too_long_1:kkart_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",e)},inputTooShort:function(e){e=e.minimum-e.input.length;return 1==e?kkart_enhanced_select_params.i18n_input_too_short_1:kkart_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",e)},loadingMore:function(){return kkart_enhanced_select_params.i18n_load_more},maximumSelected:function(e){return 1===e.maximum?kkart_enhanced_select_params.i18n_selection_too_long_1:kkart_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",e.maximum)},noResults:function(){return kkart_enhanced_select_params.i18n_no_matches},searching:function(){return kkart_enhanced_select_params.i18n_searching}}}}try{a(document.body).on("kkart-enhanced-select-init",function(){a(":input.kkart-enhanced-select, :input.chosen_select").filter(":not(.enhanced)").each(function(){var e=a.extend({minimumResultsForSearch:10,allowClear:!!a(this).data("allow_clear"),placeholder:a(this).data("placeholder")},c());a(this).selectWoo(e).addClass("enhanced")}),a(":input.kkart-enhanced-select-nostd, :input.chosen_select_nostd").filter(":not(.enhanced)").each(function(){var e=a.extend({minimumResultsForSearch:10,allowClear:!0,placeholder:a(this).data("placeholder")},c());a(this).selectWoo(e).addClass("enhanced")}),a(":input.kkart-product-search").filter(":not(.enhanced)").each(function(){var t,e,n={allowClear:!!a(this).data("allow_clear"),placeholder:a(this).data("placeholder"),minimumInputLength:a(this).data("minimum_input_length")?a(this).data("minimum_input_length"):"3",escapeMarkup:function(e){return e},ajax:{url:kkart_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(e){return{term:e.term,action:a(this).data("action")||"kkart_json_search_products_and_variations",security:kkart_enhanced_select_params.search_products_nonce,exclude:a(this).data("exclude"),exclude_type:a(this).data("exclude_type"),include:a(this).data("include"),limit:a(this).data("limit"),display_stock:a(this).data("display_stock")}},processResults:function(e){var n=[];return e&&a.each(e,function(e,t){n.push({id:e,text:t})}),{results:n}},cache:!0}},n=a.extend(n,c());a(this).selectWoo(n).addClass("enhanced"),a(this).data("sortable")?(t=a(this),(e=a(this).next(".select2-container").find("ul.select2-selection__rendered")).sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){a(e.find(".select2-selection__choice").get().reverse()).each(function(){var e=a(this).data("data").id,e=t.find('option[value="'+e+'"]')[0];t.prepend(e)})}})):a(this).prop("multiple")&&a(this).on("change",function(){var e=a(this).children();e.sort(function(e,t){e=e.text.toLowerCase(),t=t.text.toLowerCase();return t<e?1:e<t?-1:0}),a(this).html(e)})}),a(":input.kkart-customer-search").filter(":not(.enhanced)").each(function(){var t,e,n={allowClear:!!a(this).data("allow_clear"),placeholder:a(this).data("placeholder"),minimumInputLength:a(this).data("minimum_input_length")?a(this).data("minimum_input_length"):"1",escapeMarkup:function(e){return e},ajax:{url:kkart_enhanced_select_params.ajax_url,dataType:"json",delay:1e3,data:function(e){return{term:e.term,action:"kkart_json_search_customers",security:kkart_enhanced_select_params.search_customers_nonce,exclude:a(this).data("exclude")}},processResults:function(e){var n=[];return e&&a.each(e,function(e,t){n.push({id:e,text:t})}),{results:n}},cache:!0}},n=a.extend(n,c());a(this).selectWoo(n).addClass("enhanced"),a(this).data("sortable")&&(t=a(this),(e=a(this).next(".select2-container").find("ul.select2-selection__rendered")).sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){a(e.find(".select2-selection__choice").get().reverse()).each(function(){var e=a(this).data("data").id,e=t.find('option[value="'+e+'"]')[0];t.prepend(e)})}}))}),a(":input.kkart-category-search").filter(":not(.enhanced)").each(function(){var e=a.extend({allowClear:!!a(this).data("allow_clear"),placeholder:a(this).data("placeholder"),minimumInputLength:a(this).data("minimum_input_length")?a(this).data("minimum_input_length"):3,escapeMarkup:function(e){return e},ajax:{url:kkart_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(e){return{term:e.term,action:"kkart_json_search_categories",security:kkart_enhanced_select_params.search_categories_nonce}},processResults:function(e){var n=[];return e&&a.each(e,function(e,t){n.push({id:t.slug,text:t.formatted_name})}),{results:n}},cache:!0}},c());a(this).selectWoo(e).addClass("enhanced")})}).on("kkart_backbone_modal_before_remove",function(){a(".kkart-enhanced-select, :input.kkart-product-search, :input.kkart-customer-search").filter(".select2-hidden-accessible").selectWoo("close")}).trigger("kkart-enhanced-select-init"),a("html").on("click",function(e){this===e.target&&a(".kkart-enhanced-select, :input.kkart-product-search, :input.kkart-customer-search").filter(".select2-hidden-accessible").selectWoo("close")})}catch(e){window.console.log(e)}});
Hacked By AnonymousFox1.0, Coded By AnonymousFox