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