Files
danbooru/app/assets/javascripts/saved_searches.js
evazion 51d0feb2c6 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.
2017-07-11 19:24:49 -05:00

17 lines
371 B
JavaScript

Danbooru.SavedSearch = {};
Danbooru.SavedSearch.initialize_all = function() {
if ($("#c-saved-searches".length)) {
Danbooru.sorttable($("#c-saved-searches table"));
}
}
Danbooru.SavedSearch.labels = function(term) {
return $.getJSON("/saved_searches/labels", {
"search[label]": term + "*",
"limit": 10
});
}
$(Danbooru.SavedSearch.initialize_all);