/* Dashboard Instant Finder */ ( function( $ ) { $('.afisare').hide(); //var pozaID = ;// wp_get_attachment_url( 12 ); ?> /* Search pin */ $('.featured-post-search').on("click",function(e){ e.preventDefault(); console.log('Submit Function'); var postMeta = $('yes').val(); console.log(postMeta); var postID = 1; $.ajax({ data: {action: "update_meta", post_id: postID, post_meta: postMeta, }, type: 'POST', url: ajaxurl, success: function( response ) { console.log('Well Done and got this from sever: ' + response); } }); // end of ajax() return false; }); // end of document.ready /*Begin search */ $( document ).on( 'keyup', '#ayo_tags', function(event) { if( $( "#ayo_tags" ).val() == '' ) { $( "#ayo_results_posts" ).empty(); $( "#ayo_results_pages" ).empty(); $( "#ayo_results_products" ).empty(); $( "#ayo_results_comment" ).empty(); $( "#ayo_results_user" ).empty(); $( "ul[id^='ayo_results'] li,ul[id^='ayo_results'] p").remove(); $('.get_result center').hide(); $('.afisare').hide(); } else { $('.afisare').show(); } } ); // $( "#ayo_results_posts" ).substr(0, 10); //var longText = $('#ayo_results_posts'); //longText.text(longText.text().substr(0, 1)); $.widget( "app.autocomplete", $.ui.autocomplete, { options: { suggest: false }, _suggest: function( items ) { if ( $.isFunction( this.options.suggest ) ) { return this.options.suggest( items ); } this._super( items ); }, }); $( function() { $( "#ayo_tags" ).autocomplete( { minLength: 1, source: function( request, response ) { var results = $.ui.autocomplete.filter( ayo_data, request.term ); if( results.length == 0 ) { $('#nada_found').show(); $( "ul[id^='ayo_results'] li,ul[id^='ayo_results'] p").remove(); $('.get_result center').hide(); // $( "ul[id^='ayo_results']").not(':contains('+ayo_consts.str_nothing_found+')').append('
'+ayo_consts.str_nothing_found+'
' ); } else {$('#nada_found').hide();} response( results.slice( 0, 200 ) ); }, suggest: function( items ) { console.log(items); var $container_posts = $( "#ayo_results_posts" ); var $container_pages = $( "#ayo_results_pages" ); var $container_products = $( "#ayo_results_products" ); var $container_comment = $( "#ayo_results_comment" ); var $container_user = $( "#ayo_results_user" ); $container_posts.empty(); $container_pages.empty(); $container_products.empty(); $container_comment.empty(); $container_user.empty(); $( "ul[id^='ayo_results'] li,ul[id^='ayo_results'] p").remove(); $('.get_result center').show(); /* .text($(this).text().substr(0, 15)+'...'); Default Post Types -Post (Post Type: 'post') -Page (Post Type: 'page') -Attachment (Post Type: 'attachment') -Revision (Post Type: 'revision') -Navigation menu (Post Type: 'nav_menu_item') */ String.prototype.trunc = String.prototype.trunc || function(n){ return this.length>n ? this.substr(0,n-1)+'…' : this; }; /* Start organized listing */ var str_posts = ''+'
'+'
'+'
'+'
'+'
'+'
'+'
'+'
';
}
else if(this.type=='user'){
// str_product='
'+'
';
} else {
var str = '
'+'
'+'