2 var __bind = function (self, fn) {
3 return function() { fn.apply(self, arguments); };
7 $.widget("wl.search", {
15 minLength: this.options.minLength,
16 select: __bind(this, this.enter),
17 focus: function() { return false; },
18 source: this.element.data('source'),
19 dataType: options.dataType,
22 this.element.autocomplete($.extend(opts, this.options))
23 .data("autocomplete")._renderItem = __bind(this, this.render_item);
26 enter: function(event, ui) {
27 if (ui.item.url != undefined) {
28 location.href = ui.item.url;
30 this.element.closest('form').submit();
34 render_item: function (ul, item) {
35 return $("<li></li>").data('item.autocomplete', item)
36 .append('<a href="'+item.url+'"><span class="search-hint-label">'+item.label+'</span>'+
37 '<span class="search-hint-category mono">'+item.category+'</span></a>')