fixes #785
This commit is contained in:
@@ -88,6 +88,9 @@
|
||||
var $dest = $("#related-tags");
|
||||
$dest.empty();
|
||||
|
||||
if (Danbooru.Cookie.get("recent_tags")) {
|
||||
$dest.append(Danbooru.RelatedTag.build_html("recent", Danbooru.RelatedTag.recent_tags()));
|
||||
}
|
||||
if (Danbooru.RelatedTag.favorite_tags().length) {
|
||||
$dest.append(Danbooru.RelatedTag.build_html("favorite", Danbooru.RelatedTag.favorite_tags()));
|
||||
}
|
||||
@@ -108,6 +111,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
Danbooru.RelatedTag.recent_tags = function() {
|
||||
var string = Danbooru.Cookie.get("recent_tags");
|
||||
if (string && string.length) {
|
||||
return $.map(string.match(/\S+/g), function(x, i) {
|
||||
return [[x, 0]];
|
||||
});
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Danbooru.RelatedTag.build_html = function(query, related_tags) {
|
||||
if (query === null || query === "") {
|
||||
return "";
|
||||
|
||||
@@ -66,10 +66,10 @@ private
|
||||
end
|
||||
|
||||
def save_recent_tags
|
||||
if tag_query
|
||||
tags = Tag.scan_tags(tag_query)
|
||||
tags = TagAlias.to_aliased(tags) + Tag.scan_tags(session[:recent_tags])
|
||||
session[:recent_tags] = tags.uniq.slice(0, 40).join(" ")
|
||||
if @post
|
||||
tags = Tag.scan_tags(@post.tag_string)
|
||||
tags = TagAlias.to_aliased(tags) + Tag.scan_tags(cookies[:recent_tags])
|
||||
cookies[:recent_tags] = tags.uniq.slice(0, 40).join(" ")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user