modify relationship preview js
This commit is contained in:
@@ -140,32 +140,30 @@
|
|||||||
var current_post_id = $("meta[name=post-id]").attr("content");
|
var current_post_id = $("meta[name=post-id]").attr("content");
|
||||||
$("#post_" + current_post_id).css("background-color", "rgba(0,0,0,0.05)");
|
$("#post_" + current_post_id).css("background-color", "rgba(0,0,0,0.05)");
|
||||||
|
|
||||||
$("#has-children-relationship-preview").hide();
|
this.toggle_relationship_preview($("#has-children-relationship-preview"), $("#has-children-relationship-preview-link"));
|
||||||
$("#has-parent-relationship-preview").hide();
|
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-link").click(function(e) {
|
||||||
$("#has-children-relationship-preview").toggle();
|
Danbooru.Post.toggle_relationship_preview($("#has-children-relationship-preview"), $(this));
|
||||||
if ($("#has-children-relationship-preview").is(":visible")) {
|
|
||||||
$(this).html("« hide");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(this).html("show »");
|
|
||||||
}
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#has-parent-relationship-preview-link").click(function(e) {
|
$("#has-parent-relationship-preview-link").click(function(e) {
|
||||||
$("#has-parent-relationship-preview").toggle();
|
Danbooru.Post.toggle_relationship_preview($("#has-parent-relationship-preview"), $(this));
|
||||||
if ($("#has-parent-relationship-preview").is(":visible")) {
|
|
||||||
$(this).html("« hide");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(this).html("show »");
|
|
||||||
}
|
|
||||||
e.preventDefault();
|
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() {
|
Danbooru.Post.initialize_favlist = function() {
|
||||||
$("#favlist").hide();
|
$("#favlist").hide();
|
||||||
$("#hide-favlist-link").hide();
|
$("#hide-favlist-link").hide();
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ module PostsHelper
|
|||||||
|
|
||||||
html << " (#{link_to("learn more", wiki_pages_path(:title => "help:post_relationships"))}) "
|
html << " (#{link_to("learn more", wiki_pages_path(:title => "help:post_relationships"))}) "
|
||||||
|
|
||||||
html << link_to("show »".html_safe, "#", :id => "has-parent-relationship-preview-link")
|
html << link_to("« hide".html_safe, "#", :id => "has-parent-relationship-preview-link")
|
||||||
|
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
@@ -70,7 +70,7 @@ module PostsHelper
|
|||||||
|
|
||||||
html << " (#{link_to("learn more", wiki_pages_path(:title => "help:post_relationships"))}) "
|
html << " (#{link_to("learn more", wiki_pages_path(:title => "help:post_relationships"))}) "
|
||||||
|
|
||||||
html << link_to("show »".html_safe, "#", :id => "has-children-relationship-preview-link")
|
html << link_to("« hide".html_safe, "#", :id => "has-children-relationship-preview-link")
|
||||||
|
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user