Factor out related tags visibility toggling code.
This commit is contained in:
@@ -43,16 +43,7 @@
|
||||
});
|
||||
|
||||
$("#toggle-related-tags-link").click(function(e) {
|
||||
var $related_tags = $("#related-tags");
|
||||
if ($related_tags.is(":visible")) {
|
||||
$related_tags.hide();
|
||||
$(e.target).html("»");
|
||||
} else {
|
||||
$related_tags.show();
|
||||
$("#related-tags-button").trigger("click");
|
||||
$("#find-artist-button").trigger("click");
|
||||
$(e.target).html("«");
|
||||
}
|
||||
Danbooru.RelatedTag.toggle();
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
@@ -121,8 +112,8 @@
|
||||
Danbooru.Post.close_edit_dialog = function(e, ui) {
|
||||
$("#form").appendTo($("#c-posts #edit,#c-uploads #a-new"));
|
||||
$("#edit-dialog").remove();
|
||||
$("#related-tags").show();
|
||||
$("#toggle-related-tags-link").html("»").hide();
|
||||
Danbooru.RelatedTag.show();
|
||||
$("#toggle-related-tags-link").hide();
|
||||
var $tag_string = $("#post_tag_string,#upload_tag_string");
|
||||
$("div.input").has($tag_string).prevAll().show();
|
||||
$("#open-edit-dialog").show();
|
||||
|
||||
@@ -114,8 +114,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
$("#related-tags").show();
|
||||
$("#toggle-related-tags-link").html("«");
|
||||
Danbooru.RelatedTag.show();
|
||||
|
||||
var query = Danbooru.RelatedTag.recent_search.query;
|
||||
var related_tags = Danbooru.RelatedTag.recent_search.tags;
|
||||
@@ -274,6 +273,26 @@
|
||||
Danbooru.RelatedTag.recent_artists = data;
|
||||
Danbooru.RelatedTag.build_all();
|
||||
}
|
||||
|
||||
Danbooru.RelatedTag.toggle = function() {
|
||||
if ($("#related-tags").is(":visible")) {
|
||||
Danbooru.RelatedTag.hide();
|
||||
} else {
|
||||
Danbooru.RelatedTag.show();
|
||||
$("#related-tags-button").trigger("click");
|
||||
$("#find-artist-button").trigger("click");
|
||||
}
|
||||
}
|
||||
|
||||
Danbooru.RelatedTag.show = function() {
|
||||
$("#related-tags").show()
|
||||
$("#toggle-related-tags-link").text("«");
|
||||
}
|
||||
|
||||
Danbooru.RelatedTag.hide = function() {
|
||||
$("#related-tags").hide();
|
||||
$("#toggle-related-tags-link").text("»");
|
||||
}
|
||||
})();
|
||||
|
||||
$(function() {
|
||||
|
||||
Reference in New Issue
Block a user