2 var __bind = function (self, fn) {
3 return function() { return 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 this.element.autocomplete('instance')._renderItem = __bind(this, this.render_item_2022);
24 this.element.data('autocomplete')._renderItem = __bind(this, this.render_item);;
27 enter: function(event, ui) {
28 if (ui.item.url !== undefined) {
29 location.href = this.options.host+ui.item.url;
31 this.element.closest('form').submit();
35 render_item: function (ul, item) {
38 label = '<cite>' + item.label + '</cite>, ' + item['author'];
42 return $("<li></li>").data('item.autocomplete', item)
43 .append('<a href="'+this.options.host+item.url+'"><span class="search-hint-label">'+label+'</span>')
47 render_item_2022: function (ul, item) {
50 label = '<cite>' + item.label + '</cite>, ' + item['author'];
55 .append('<a href="'+this.options.host+item.url+'">'+label+'</a>')