first
This commit is contained in:
@ -0,0 +1,57 @@
|
||||
jQuery(function($) {
|
||||
var autoCompleteEl = '#wpacu-search-form-assets-manager .search-field';
|
||||
|
||||
$(autoCompleteEl).autocomplete({
|
||||
source: function(request, response) {
|
||||
var wpacu_post_type;
|
||||
|
||||
if ($('#wpacu-custom-post-type-choice').length > 0) {
|
||||
// Custom Post Type
|
||||
wpacu_post_type = $('#wpacu-custom-post-type-choice').val();
|
||||
} else {
|
||||
// Post, Page or Attachment
|
||||
wpacu_post_type = wpacu_autocomplete_search_obj.post_type;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
dataType: 'json',
|
||||
url: wpacu_autocomplete_search_obj.ajax_url,
|
||||
cache: false,
|
||||
data: {
|
||||
wpacu_term: request.term,
|
||||
wpacu_post_type: wpacu_post_type,
|
||||
action: wpacu_autocomplete_search_obj.ajax_action,
|
||||
wpacu_security: wpacu_autocomplete_search_obj.ajax_nonce,
|
||||
wpacu_time: new Date().getTime()
|
||||
},
|
||||
success: function(data) {
|
||||
$('#wpacu-search-form-assets-manager-no-results').hide(); // in case it was ever shown
|
||||
response(data);
|
||||
console.log(data);
|
||||
},
|
||||
complete: function(jqXHR, textStatus) {
|
||||
if (jqXHR.responseText == 'no_results') {
|
||||
var noResultsArray = new Object();
|
||||
$('#wpacu-search-form-assets-manager-no-results').show();
|
||||
response(noResultsArray);
|
||||
//$(autoCompleteEl).val('');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
select: function(event, ui) {
|
||||
$('#wpacu-search-form-assets-manager').hide();
|
||||
$('#wpacu-post-chosen-loading-assets').show();
|
||||
//console.log(ui.item.id);
|
||||
|
||||
window.location.href = wpacu_autocomplete_search_obj.redirect_to.replace('=post_id_here', '=' + ui.item.id);
|
||||
},
|
||||
close: function(el) {
|
||||
el.target.value = '';
|
||||
}
|
||||
}).data("ui-autocomplete")._renderItem = function (ul, item) {
|
||||
return $( "<li>" )
|
||||
.append( "<div>" + item.label + "<span style='display:block;color:green;font-size:11px;'>"+ item.link +"</span></div>" )
|
||||
.appendTo( ul );
|
||||
};
|
||||
});
|
1
wp-content/plugins/wp-asset-clean-up/assets/auto-complete/main.min.js
vendored
Normal file
1
wp-content/plugins/wp-asset-clean-up/assets/auto-complete/main.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
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)}});
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user