- some more documentation of typeahead functions.

- typeahead expects the first char of the returned items to be 'F', 'D'
  or ' '
This commit is contained in:
steinm 2013-01-25 09:54:50 +00:00
parent ffe54b8662
commit feaf3e87ce

View File

@ -38,9 +38,24 @@ $(document).ready( function() {
process(data);
});
},
/* updater is called when the item in the list is clicked. It is
* actually provided to update the input field, but here we use
* it to set the document location. */
updater: function (item) {
document.location = "../op/op.Search.php?query=" + encodeURIComponent(item);
document.location = "../op/op.Search.php?query=" + encodeURIComponent(item.substring(1));
return item;
},
/* Set a matcher that allows any returned value */
matcher : function (item) {
return true;
},
highlighter : function (item) {
if(item.charAt(0) == 'D')
return '<i class="icon-file"></i> ' + item.substring(1);
else if(item.charAt(0) == 'F')
return '<i class="icon-folder-close"></i> ' + item.substring(1);
else
return '<i class="icon-search"></i> ' + item.substring(1);
}
});
});