Skip to content
Snippets Groups Projects
Commit 0c903cc2 authored by Chris Hallberg's avatar Chris Hallberg
Browse files

Merge branch 'release-2.3'

Conflicts:
	themes/bootstrap3/js/common.js
parents 19b4fbea 3fef3062
No related merge requests found
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/*global ajaxLoadTab, Bloodhound, btoa, checkSaveStatuses, console, extractSource, hexEncode, Lightbox, path, rc4Encrypt, refreshCommentList, unescape, vufindString */ /*global ajaxLoadTab, btoa, checkSaveStatuses, console, extractSource, hexEncode, Lightbox, path, rc4Encrypt, refreshCommentList, unescape, vufindString */
/* --- GLOBAL FUNCTIONS --- */ /* --- GLOBAL FUNCTIONS --- */
function htmlEncode(value){ function htmlEncode(value){
...@@ -290,42 +290,36 @@ $(document).ready(function() { ...@@ -290,42 +290,36 @@ $(document).ready(function() {
}); });
// Search autocomplete // Search autocomplete
var searcher = extractClassParams('.autocomplete');
var autocompleteEngine = new Bloodhound({
name: 'search-suggestions',
remote: {
url: path + '/AJAX/JSON?q=%QUERY',
ajax: {
data: {
method:'getACSuggestions',
type:$('#searchForm_type').val(),
searcher:searcher['searcher']
},
dataType:'json'
},
filter: function(json) {
if (json.status == 'OK' && json.data.length > 0) {
var datums = [];
for (var i=0;i<json.data.length;i++) {
datums.push({val:json.data[i]});
}
return datums;
} else {
return [];
}
}
},
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('val'),
queryTokenizer: Bloodhound.tokenizers.whitespace
});
autocompleteEngine.initialize();
$('.autocomplete').typeahead( $('.autocomplete').typeahead(
{ {
highlight: true, highlight: true,
minLength: 3 minLength: 3
}, { }, {
displayKey:'val', displayKey:'val',
source: autocompleteEngine.ttAdapter() source: function(query, cb) {
var searcher = extractClassParams('.autocomplete');
$.ajax({
url: path + '/AJAX/JSON',
data: {
q:query,
method:'getACSuggestions',
searcher:searcher['searcher'],
type:$('#searchForm_type').val(),
},
dataType:'json',
success: function(json) {
if (json.status == 'OK' && json.data.length > 0) {
var datums = [];
for (var i=0;i<json.data.length;i++) {
datums.push({val:json.data[i]});
}
cb(datums);
} else {
cb([]);
}
}
})
}
} }
); );
......
This diff is collapsed.
...@@ -30,14 +30,15 @@ label.list-group-item {border-radius:0;font-weight:normal;margin-top:0;padding-l ...@@ -30,14 +30,15 @@ label.list-group-item {border-radius:0;font-weight:normal;margin-top:0;padding-l
/* --- Autocomplete --- */ /* --- Autocomplete --- */
.twitter-typeahead { .twitter-typeahead {
background: #FFF; background:#FFF;
padding: 8px 0 10px; border-radius:@border-radius-base;
border-radius: @border-radius-base; vertical-align:top;
.tt-hint {display:none} .tt-hint {display:none}
} }
.tt-dropdown-menu {.list-group;margin-top:10px;} .tt-dropdown-menu {.list-group;}
.tt-suggestion { .tt-suggestion {
.list-group-item; .list-group-item;
cursor:pointer;
text-overflow:ellipsis; text-overflow:ellipsis;
white-space:nowrap; white-space:nowrap;
&.active { &.active {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment