1/** 2 * Funciones de palabras sugeridas para el buscador. 3 */ 4var accentMap = { 5 "á": "a", 6 "é": "e", 7 "Ã": "i", 8 "ó": "o", 9 "ú": "u" 10 }; 11 var normalize = function( term ) { 12 var ret = ""; 13 for ( var i = 0; i < term.length; i++ ) { 14 ret += accentMap[ term.charAt(i) ] || term.charAt(i); 15 } 16 return ret; 17 }; 18function getSuggestedWords(inputId){ 19 $.ajax({ 20 url: '/bps/SearchUtilsService', 21 crossDomain: true, 22 timeout:60000, 23 type : 'POST', 24 data: { 25 cmdaction: "getSuggestedWords" 26 } 27 }) 28 .done(function(data) { 29 var dataJSON = $.parseJSON(data); 30 $( "#" + inputId ).autocomplete({ 31 source: function( request, response ) { 32 var matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" ); 33 response( $.grep( dataJSON.words, function( value ) { 34 value = value.label || value.value || value; 35 return matcher.test( value ) || matcher.test( normalize( value ) ); 36 }).slice(0, 10) ); 37 }, 38 minLength: 2, 39 select: function(event, ui) { 40 //assign value back to the form element 41 if(ui.item){ 42 $(event.target).val(ui.item.value); 43 } 44 //submit the form 45 $(event.target.form).submit(); 46 } 47 }); 48 }) 49 .fail(function(jqXHR, textStatus, errorThrown) { 50 $('.box-captcha').jqwait('hide'); 51 $('.Box').jqwait('destroy'); 52 53 alert('Error'); 54 }); 55}
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.