Fix #3214: Add autocomplete for saved searches.
* Autocomplete the `search:<label>` metatag. * Make label autocompletion do a prefix match instead of a substring match. Example: `search:ar` matches `artists`, not `characters`. This is how tags and most other things are autocompleted.
This commit is contained in:
@@ -550,21 +550,14 @@
|
||||
$("#saved_search_labels").autocomplete({
|
||||
minLength: 2,
|
||||
source: function(req, resp) {
|
||||
$.ajax({
|
||||
url: "/saved_searches/labels.json",
|
||||
data: {
|
||||
label: req.term
|
||||
},
|
||||
method: "get",
|
||||
success: function(data) {
|
||||
resp($.map(data, function(saved_search) {
|
||||
return {
|
||||
label: saved_search.replace(/_/g, " "),
|
||||
value: saved_search
|
||||
};
|
||||
}));
|
||||
}
|
||||
})
|
||||
Danbooru.SavedSearch.labels(req.term).success(function(labels) {
|
||||
resp(labels.map(function(label) {
|
||||
return {
|
||||
label: label.replace(/_/g, " "),
|
||||
value: label
|
||||
};
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user