wp_back/wp-content/plugins/wp-asset-clean-up/assets/auto-complete/main.min.js
2024-05-20 15:37:46 +03:00

1 line
1.2 KiB
JavaScript

jQuery(function(e){e("#wpacu-search-form-assets-manager .search-field").autocomplete({source:function(a,o){var t;t=e("#wpacu-custom-post-type-choice").length>0?e("#wpacu-custom-post-type-choice").val():wpacu_autocomplete_search_obj.post_type,e.ajax({dataType:"json",url:wpacu_autocomplete_search_obj.ajax_url,cache:!1,data:{wpacu_term:a.term,wpacu_post_type:t,action:wpacu_autocomplete_search_obj.ajax_action,wpacu_security:wpacu_autocomplete_search_obj.ajax_nonce,wpacu_time:(new Date).getTime()},success:function(a){e("#wpacu-search-form-assets-manager-no-results").hide(),o(a),console.log(a)},complete:function(a,t){if("no_results"==a.responseText){var c=new Object;e("#wpacu-search-form-assets-manager-no-results").show(),o(c)}}})},select:function(a,o){e("#wpacu-search-form-assets-manager").hide(),e("#wpacu-post-chosen-loading-assets").show(),window.location.href=wpacu_autocomplete_search_obj.redirect_to.replace("=post_id_here","="+o.item.id)},close:function(e){e.target.value=""}}).data("ui-autocomplete")._renderItem=function(a,o){return e("<li>").append("<div>"+o.label+"<span style='display:block;color:green;font-size:11px;'>"+o.link+"</span></div>").appendTo(a)}});