2023-04-13 12:27:41 +00:00
|
|
|
/* ***** Orcinus Site Search - Default Search Result Javascript **** */
|
2023-04-12 23:08:00 +00:00
|
|
|
let remoteValue;
|
|
|
|
if (typeof os_return_all !== 'function') {
|
|
|
|
function os_return_all() { return []; }
|
|
|
|
remoteValue = { url: '?q=%QUERY&json', wildcard: '%QUERY' }
|
|
|
|
}
|
|
|
|
|
|
|
|
let os_bloodhound = new Bloodhound({
|
|
|
|
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('title'),
|
|
|
|
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
|
|
|
limit: 5,
|
|
|
|
remote: remoteValue,
|
|
|
|
local: os_return_all
|
|
|
|
});
|
|
|
|
|
2023-04-13 01:08:53 +00:00
|
|
|
$('input.os_typeahead').attr('autocomplete', 'off').typeahead({
|
2023-04-12 23:08:00 +00:00
|
|
|
hint: true,
|
|
|
|
highlight: true,
|
|
|
|
minLength: 3
|
|
|
|
}, {
|
|
|
|
source: os_bloodhound,
|
|
|
|
display: 'title'
|
|
|
|
}).bind('typeahead:selected', function (obj, datum) {
|
|
|
|
window.location.href = datum.url;
|
|
|
|
});
|