1; 2jQuery(document).ready(function() 3{ 4 // Add autocompleting to WPFTS Custom Search widgets 5 jQuery('.search-form.wpfts_autocomplete').each(function(i, v) 6 { 7 var inp = jQuery('input[name="s"]', v); 8 var widget_code = jQuery('input[name="wpfts_wdgt"]', v).val(); 9 10 jQuery(inp).autocomplete({ 11 source: function(request, response) 12 { 13 jQuery.ajax({ 14 method: 'post', 15 url: document.wpfts_ajaxurl, 16 dataType: "json", 17 data: { 18 action: 'wpfts_autocomplete', 19 wpfts_wdgt: widget_code, 20 sq: request.term 21 }, 22 success: function(data) { 23 response(data); 24 } 25 }); 26 }, 27 minLength: 1, 28 delay: 300, 29 select: function( event, ui ) { 30 var t = jQuery('<textarea />').html(ui.item.label).text(); 31 inp.val(t); 32 33 if ('link' in ui.item) { 34 document.location.href = ui.item.link; 35 } 36 37 event.preventDefault(); 38 return false; 39 }, 40 focus: function( event, ui ) { 41 var t = jQuery('<textarea />').html(ui.item.label).text(); 42 inp.val(t); 43 event.preventDefault(); 44 return false; 45 }, 46 create: function (event,ui) { 47 jQuery(this).data('ui-autocomplete')._renderItem = function(ul, item) 48 { 49 var str = '<li><a>' + item.label + '</a></li>'; 50 return jQuery(str).appendTo(ul); 51 }; 52 } 53 }); 54 55 }); 56 57});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.