From ccf32aa7a45bf870e0469d4298d8044c0ad466c5 Mon Sep 17 00:00:00 2001 From: evazion Date: Mon, 14 Oct 2019 21:16:04 -0500 Subject: [PATCH] posts: remove 'Similar' button from post edit form. Remove the 'Similar' button next to the source field in the post edit form. Removed for multiple reasons: * It doesn't make sense to have to open the edit form to do a reverse image search. * The 'Similar' button tries to redownload the file from the source, which has various problems: the source might have been deleted, it might have been changed or revised, it might be a format that iqdb can't handle (ugoira/webm/mp4), or it might otherwise not match the the actual post. * The 'Find similar' button already exists in the sidebar and it does the right thing by using the preview image from Danbooru, which avoids all the above issues. --- app/javascript/src/javascripts/posts.js.erb | 8 -------- app/views/posts/partials/show/_edit.html.erb | 11 ++--------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/app/javascript/src/javascripts/posts.js.erb b/app/javascript/src/javascripts/posts.js.erb index bd176f56c..14ccc3f23 100644 --- a/app/javascript/src/javascripts/posts.js.erb +++ b/app/javascript/src/javascripts/posts.js.erb @@ -30,7 +30,6 @@ Post.initialize_all = function() { this.initialize_post_sections(); this.initialize_post_image_resize_links(); this.initialize_post_image_resize_to_window_link(); - this.initialize_similar(); if (CurrentUser.data("always-resize-images") || (Utility.meta("viewport") && (window.screen.width <= 660))) { $("#image-resize-to-window-link").click(); @@ -171,13 +170,6 @@ Post.close_edit_dialog = function(e, ui) { $(document).trigger("danbooru:close-post-edit-dialog"); } -Post.initialize_similar = function() { - $("#similar-button").on("click.danbooru", function(e) { - $.get("/iqdb_queries", {"url": $("#post_source").val()}).done(function(html) {$("#iqdb-similar").html(html).show()}); - e.preventDefault(); - }); -} - Post.swipe_prev = function(e) { if ($(".paginator a[rel~=prev]").length) { location.href = $("a[rel~=prev]").attr("href"); diff --git a/app/views/posts/partials/show/_edit.html.erb b/app/views/posts/partials/show/_edit.html.erb index 12aa32a95..6c066f890 100644 --- a/app/views/posts/partials/show/_edit.html.erb +++ b/app/views/posts/partials/show/_edit.html.erb @@ -62,21 +62,14 @@
<%= f.label :parent_id, "Parent" %> - <%= f.text_field :parent_id, :size => 5 %> + <%= f.text_field :parent_id, size: 60 %>
<%= f.label :source %> - <%= f.text_field :source %> - <%= button_tag "Similar", :id => "similar-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub" %> + <%= f.text_field :source, size: 60 %>
- <% if Danbooru.config.iqdbs_server %> - - <% end %> - - -
<%= f.label :tag_string, "Tags" %>