modify relationship preview js

This commit is contained in:
Toks
2013-04-29 17:10:33 -04:00
parent 4775535c11
commit e1c34df22e
2 changed files with 16 additions and 18 deletions

View File

@@ -140,32 +140,30 @@
var current_post_id = $("meta[name=post-id]").attr("content");
$("#post_" + current_post_id).css("background-color", "rgba(0,0,0,0.05)");
$("#has-children-relationship-preview").hide();
$("#has-parent-relationship-preview").hide();
this.toggle_relationship_preview($("#has-children-relationship-preview"), $("#has-children-relationship-preview-link"));
this.toggle_relationship_preview($("#has-parent-relationship-preview"), $("#has-parent-relationship-preview-link"));
$("#has-children-relationship-preview-link").click(function(e) {
$("#has-children-relationship-preview").toggle();
if ($("#has-children-relationship-preview").is(":visible")) {
$(this).html("« hide");
}
else {
$(this).html("show »");
}
Danbooru.Post.toggle_relationship_preview($("#has-children-relationship-preview"), $(this));
e.preventDefault();
});
$("#has-parent-relationship-preview-link").click(function(e) {
$("#has-parent-relationship-preview").toggle();
if ($("#has-parent-relationship-preview").is(":visible")) {
$(this).html("« hide");
}
else {
$(this).html("show »");
}
Danbooru.Post.toggle_relationship_preview($("#has-parent-relationship-preview"), $(this));
e.preventDefault();
});
}
Danbooru.Post.toggle_relationship_preview = function(preview, preview_link) {
preview.toggle();
if (preview.is(":visible")) {
preview_link.html("« hide");
}
else {
preview_link.html("show »");
}
}
Danbooru.Post.initialize_favlist = function() {
$("#favlist").hide();
$("#hide-favlist-link").hide();

View File

@@ -56,7 +56,7 @@ module PostsHelper
html << " (#{link_to("learn more", wiki_pages_path(:title => "help:post_relationships"))}) "
html << link_to("show &raquo;".html_safe, "#", :id => "has-parent-relationship-preview-link")
html << link_to("&laquo; hide".html_safe, "#", :id => "has-parent-relationship-preview-link")
html.html_safe
end
@@ -70,7 +70,7 @@ module PostsHelper
html << " (#{link_to("learn more", wiki_pages_path(:title => "help:post_relationships"))}) "
html << link_to("show &raquo;".html_safe, "#", :id => "has-children-relationship-preview-link")
html << link_to("&laquo; hide".html_safe, "#", :id => "has-children-relationship-preview-link")
html.html_safe
end