Fix broken tag autocomplete on multiple pages.
Mark all tag <input>s with a `data-autocomplete` attribute, instead of
hardcoding a list of html IDs to autocomplete in javascript.
This way should be less error prone. It fixes autocomplete in several places:
* Autocomplete for the search box on /posts didn't work in the
responsive layout. This was because /posts has two search boxes that
both have the id `tags`: one in the normal sidebar, and one in the
responsive tag list. $("#tags") only initialized autocomplete on the
first one.
* Autocomplete didn't work on the aliases or implications pages. This
was due to selecting the wrong html ids.
This commit is contained in:
@@ -87,18 +87,8 @@
|
||||
}
|
||||
|
||||
Danbooru.Autocomplete.initialize_tag_autocomplete = function() {
|
||||
var $fields_multiple = $(
|
||||
"#tags,#post_tag_string,#upload_tag_string,#tag-script-field,#c-moderator-post-queues #query," +
|
||||
"#user_blacklisted_tags,#user_favorite_tags,#search_post_tags_match"
|
||||
);
|
||||
var $fields_single = $(
|
||||
"#c-tags #search_name_matches,#c-tag-aliases #query,#c-tag-implications #query," +
|
||||
"#wiki_page_title," +
|
||||
"#tag_alias_request_antecedent_name,#tag_alias_request_consequent_name," +
|
||||
"#tag_implication_request_antecedent_name,#tag_implication_request_consequent_name," +
|
||||
"#tag_alias_antecedent_name,#tag_alias_consequent_name," +
|
||||
"#tag_implication_antecedent_name,#tag_implication_consequent_name"
|
||||
);
|
||||
var $fields_multiple = $('[data-autocomplete="tag-query"], [data-autocomplete="tag-edit"]');
|
||||
var $fields_single = $('[data-autocomplete="tag"]');
|
||||
|
||||
var prefixes = "-|~|general:|gen:|artist:|art:|copyright:|copy:|co:|character:|char:|ch:";
|
||||
var metatags = "order|-status|status|-rating|rating|-locked|locked|child|filetype|-filetype|" +
|
||||
|
||||
Reference in New Issue
Block a user