(function() { Danbooru.Post = {}; Danbooru.Post.pending_update_count = 0; Danbooru.Post.initialize_all = function() { this.initialize_post_previews(); if ($("#c-posts").length) { this.initialize_shortcuts(); } if ($("#c-posts").length && $("#a-index").length) { this.initialize_excerpt(); this.initialize_saved_searches(); } if ($("#c-posts").length && $("#a-show").length) { this.initialize_links(); this.initialize_post_relationship_previews(); this.initialize_favlist(); this.initialize_post_sections(); this.initialize_post_image_resize_links(); this.initialize_post_image_resize_to_window_link(); this.initialize_similar(); if (Danbooru.meta("always-resize-images") === "true") { $("#image-resize-to-window-link").click(); } } if ($("#image").length) { this.initialize_edit_dialog(); } } Danbooru.Post.initialize_edit_dialog = function(e) { $("#open-edit-dialog").button().show().click(function(e) { $(window).scrollTop($("#image").offset().top); Danbooru.Post.open_edit_dialog(); e.preventDefault(); }); $("#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("«"); } e.preventDefault(); }); } Danbooru.Post.open_edit_dialog = function() { var $tag_string = $("#post_tag_string,#upload_tag_string"); $("div.input").has($tag_string).prevAll().hide(); $("#open-edit-dialog").hide(); $("#toggle-related-tags-link").show().click(); var dialog = $("
").attr("id", "edit-dialog"); $("#form").appendTo(dialog); dialog.dialog({ title: "Edit tags", width: $(window).width() / 3, position: { my: "right", at: "right-20", of: window }, drag: function(e, ui) { if (Danbooru.meta("enable-auto-complete") === "true") { $tag_string.data("uiAutocomplete").close(); } }, close: Danbooru.Post.close_edit_dialog }); dialog.dialog("widget").draggable("option", "containment", "none"); var pin_button = $("