2 var __bind = function (self, fn) {
3 return function() { fn.apply(self, arguments); };
7 $.widget("wl.search", {
14 minLength: this.options.minLength,
15 select: __bind(this, this.enter),
16 focus: function() { return false; },
17 source: this.element.data('source'),
19 this.element.autocomplete(opts).data("autocomplete")._renderItem = __bind(this, this.render_item);
22 enter: function(event, ui) {
23 if (ui.item.url != undefined) {
24 location.href = ui.item.url;
26 this.element.closest('form').submit();
30 render_item: function (ul, item) {
31 return $("<li></li>").data('item.autocomplete', item)
32 .append('<a href="'+item.url+'">'+item.label+ ' ('+item.category+')</a>')