mirror of
https://gitee.com/dcren/initializr.git
synced 2025-11-28 17:32:34 +08:00
Show hint when more search results are available
This commit is contained in:
@@ -121,9 +121,9 @@ input[type=text] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tt-suggestion {
|
.tt-suggestion {
|
||||||
padding: 3px 20px;
|
padding: 4px 20px;
|
||||||
font-size: 18px;
|
font-size: 16px;
|
||||||
line-height: 24px;
|
line-height: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tt-suggestion:hover {
|
.tt-suggestion:hover {
|
||||||
@@ -137,6 +137,15 @@ input[type=text] {
|
|||||||
background-color: #0097cf;
|
background-color: #0097cf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tt-footer {
|
||||||
|
padding: 6px 20px 0px 20px;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
text-align: center;
|
||||||
|
font-style: italic;
|
||||||
|
border-top: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ $(function () {
|
|||||||
$("body").scrollTop(0);
|
$("body").scrollTop(0);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
var maxSuggestions = 5;
|
||||||
var starters = new Bloodhound({
|
var starters = new Bloodhound({
|
||||||
datumTokenizer: Bloodhound.tokenizers.obj.nonword('name', 'description', 'keywords', 'group'),
|
datumTokenizer: Bloodhound.tokenizers.obj.nonword('name', 'description', 'keywords', 'group'),
|
||||||
queryTokenizer: Bloodhound.tokenizers.nonword,
|
queryTokenizer: Bloodhound.tokenizers.nonword,
|
||||||
@@ -191,6 +192,7 @@ $(function () {
|
|||||||
sorter: function(a,b) {
|
sorter: function(a,b) {
|
||||||
return b.weight - a.weight;
|
return b.weight - a.weight;
|
||||||
},
|
},
|
||||||
|
limit: maxSuggestions,
|
||||||
cache: false
|
cache: false
|
||||||
});
|
});
|
||||||
initializeSearchEngine(starters, $("#bootVersion").val());
|
initializeSearchEngine(starters, $("#bootVersion").val());
|
||||||
@@ -205,6 +207,14 @@ $(function () {
|
|||||||
templates: {
|
templates: {
|
||||||
suggestion: function (data) {
|
suggestion: function (data) {
|
||||||
return "<div><strong>" + data.name + "</strong><br/><small>" + data.description + "</small></div>";
|
return "<div><strong>" + data.name + "</strong><br/><small>" + data.description + "</small></div>";
|
||||||
|
},
|
||||||
|
footer: function(search) {
|
||||||
|
if (search.suggestions && search.suggestions.length == maxSuggestions) {
|
||||||
|
return "<div class=\"tt-footer\">More matches, please refine your search</div>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user