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'),
21 this.element.autocomplete($.extend(opts, this.options))
22 .data("autocomplete")._renderItem = __bind(this, this.render_item);
25 enter: function(event, ui) {
26 if (ui.item.url != undefined) {
27 location.href = ui.item.url;
29 this.element.closest('form').submit();
33 render_item: function (ul, item) {
34 return $("<li></li>").data('item.autocomplete', item)
35 .append('<a href="'+item.url+'"><span class="search-hint-label">'+item.label+'</span>'+
36 '<span class="search-hint-category mono">'+item.category+'</span></a>')