#1537: Fix poor performance
This commit is contained in:
@@ -6,11 +6,7 @@
|
||||
this.initialize_buttons();
|
||||
$("#related-tags-container").hide();
|
||||
$("#artist-tags-container").hide();
|
||||
$("#upload_tag_string,#post_tag_string").keyup(function(e) {
|
||||
if ($("#related-tags").is(":visible")) {
|
||||
Danbooru.RelatedTag.build_all();
|
||||
}
|
||||
});
|
||||
$("#upload_tag_string,#post_tag_string").keyup(Danbooru.RelatedTag.update_selected);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +96,18 @@
|
||||
Danbooru.RelatedTag.build_all();
|
||||
}
|
||||
|
||||
Danbooru.RelatedTag.update_selected = function(e) {
|
||||
var current_tags = $("#upload_tag_string,#post_tag_string").val().toLowerCase().match(/\S+/g) || [];
|
||||
var $all_tags = $("#related-tags a");
|
||||
$all_tags.removeClass("selected");
|
||||
|
||||
$all_tags.each(function(i, tag) {
|
||||
if (current_tags.indexOf(tag.textContent.replace(/ /g, "_")) > -1) {
|
||||
$(tag).addClass("selected");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.RelatedTag.build_all = function() {
|
||||
if (Danbooru.RelatedTag.recent_search === null || Danbooru.RelatedTag.recent_search === undefined) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user