1/*!@license 2* jQuery UI autocomplete 3* http://jqueryui.com 4* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.position.js, jquery.ui.autocomplete.js, jquery.ui.menu.js 5* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT 6*/ 7 8/* 9 NB: jQuery UI is not present in the repository, except file included in the minified version of the script 10*/ 11 12/* 13@codekit-prepend '../jquery-ui-master/ui/core.js'; 14@codekit-prepend '../jquery-ui-master/ui/widget.js'; 15@codekit-prepend '../jquery-ui-master/ui/position.js'; 16@codekit-prepend '../jquery-ui-master/ui/autocomplete.js'; 17@codekit-prepend '../jquery-ui-master/ui/menu.js'; 18*/ 19 20 21/* 22 * Jquery UI autocomplete Bootstrap theming 23 * Massimo Cassandro 24 */ 25 26jQuery(function ($) { 27 $.widget( "ui.autocomplete", $.ui.autocomplete, { 28 29 _renderMenu: function( ul, items ) { 30 var that = this; 31 ul.attr("class", "nav nav-pills nav-stacked bs-autocomplete-menu" ); 32 $.each( items, function( index, item ) { 33 that._renderItemData( ul, item ); 34 }); 35 }, 36 37 _resizeMenu: function() { 38 var ul = this.menu.element; 39 ul.outerWidth( Math.min( 40 // Firefox wraps long text (possibly a rounding bug) 41 // so we add 1px to avoid the wrapping (#7513) 42 ul.width( "" ).outerWidth() + 1, 43 this.element.outerWidth() 44 ) ); 45 } 46 47 }); 48 49 $('.bs-autocomplete').each( function() { 50 var _this = $(this), 51 _data = _this.data(), 52 _hidden_field = $('#' + _data.hidden_field_id) 53 ; 54 55 _this.after('<div class="bs-autocomplete-feedback form-control-feedback"><div class="loader">Loading...</div></div>') 56 .parent('.form-group').addClass('has-feedback'); 57 58 var feedback_icon = _this.next('.bs-autocomplete-feedback'); 59 feedback_icon.hide(); 60 61 _this.autocomplete({ 62 minLength:2, 63 autoFocus: true, 64 65 source: function(request, response) { 66 $.ajax({ 67 url: _data.source, 68 dataType: "json", 69 data: { 70 q: request.term 71 }, 72 success: function(data) { 73 response ( data ); 74 } 75 }); 76 }, 77 78 search: function () { 79 feedback_icon.show(); 80 _hidden_field.val(''); 81 }, 82 83 response: function() { 84 feedback_icon.hide(); 85 }, 86 87 focus: function(event, ui) { 88 _this.val(ui.item[_data.item_label]); 89 event.preventDefault(); 90 }, 91 92 select: function(event, ui) { 93 _this.val(ui.item[_data.item_label]); 94 _hidden_field.val(ui.item[_data.item_id]); 95 event.preventDefault(); 96 } 97 }) 98 .data( 'ui-autocomplete' )._renderItem = function( ul, item ) { 99 return $( '<li></li>' ) 100 .data( "item.autocomplete", item ) 101 .append( '<a>' + item[_data.item_label] + '</a>') 102 .appendTo( ul ); 103 }; 104 // end autocomplete 105 }); 106}); 107 108 109(function() { 110 "use strict"; 111 112 113})();
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.