fixes #785
This commit is contained in:
@@ -88,6 +88,9 @@
|
|||||||
var $dest = $("#related-tags");
|
var $dest = $("#related-tags");
|
||||||
$dest.empty();
|
$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) {
|
if (Danbooru.RelatedTag.favorite_tags().length) {
|
||||||
$dest.append(Danbooru.RelatedTag.build_html("favorite", Danbooru.RelatedTag.favorite_tags()));
|
$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) {
|
Danbooru.RelatedTag.build_html = function(query, related_tags) {
|
||||||
if (query === null || query === "") {
|
if (query === null || query === "") {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -66,10 +66,10 @@ private
|
|||||||
end
|
end
|
||||||
|
|
||||||
def save_recent_tags
|
def save_recent_tags
|
||||||
if tag_query
|
if @post
|
||||||
tags = Tag.scan_tags(tag_query)
|
tags = Tag.scan_tags(@post.tag_string)
|
||||||
tags = TagAlias.to_aliased(tags) + Tag.scan_tags(session[:recent_tags])
|
tags = TagAlias.to_aliased(tags) + Tag.scan_tags(cookies[:recent_tags])
|
||||||
session[:recent_tags] = tags.uniq.slice(0, 40).join(" ")
|
cookies[:recent_tags] = tags.uniq.slice(0, 40).join(" ")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user