2 var __bind = function (self, fn) {
3 return function() { fn.apply(self, arguments); };
7 $.widget("wl.search", {
16 minLength: this.options.minLength,
17 select: __bind(this, this.enter),
18 focus: function() { return false; },
19 source: this.element.data('source'),
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 = this.options.host+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="'+this.options.host+item.url+'"><span class="search-hint-label">'+item.label+'</span>'+
37 '<span class="search-hint-category mono">'+item.category+'</span></a>')