diff --git a/app/assets/javascripts/artists.js b/app/assets/javascripts/artists.js index 9ea2afa36..d390f4998 100644 --- a/app/assets/javascripts/artists.js +++ b/app/assets/javascripts/artists.js @@ -4,6 +4,7 @@ Danbooru.Artist.initialize_all = function() { if ($("#c-artists").length) { Danbooru.Artist.initialize_check_name(); + Danbooru.Artist.initialize_shortcuts(); if (Danbooru.meta("enable-auto-complete") === "true") { Danbooru.Artist.initialize_autocomplete(); @@ -31,6 +32,18 @@ }); } + Danbooru.Artist.initialize_shortcuts = function() { + if ($("#c-artists #a-show").length) { + Danbooru.keydown("e", "edit", function(e) { + $("#artist-edit a")[0].click(); + }); + + Danbooru.keydown("shift+d", "delete", function(e) { + $("#artist-delete a")[0].click(); + }); + } + }; + Danbooru.Artist.initialize_autocomplete = function() { var $fields = $("#search_name,#quick_search_name"); diff --git a/app/assets/javascripts/forum_posts.js b/app/assets/javascripts/forum_posts.js index 480852f42..4e9a15091 100644 --- a/app/assets/javascripts/forum_posts.js +++ b/app/assets/javascripts/forum_posts.js @@ -2,8 +2,22 @@ Danbooru.ForumPost = {}; Danbooru.ForumPost.initialize_all = function() { - if ($("#c-forum-topics").length && $("#a-show").length) {; + if ($("#c-forum-topics #a-show").length) {; this.initialize_edit_links(); + + Danbooru.keydown("e", "edit", function(e) { + $(".edit_forum_topic_link")[0].click(); + }); + + Danbooru.keydown("shift+d", "delete", function(e) { + $("#forum-topic-delete a")[0].click(); + }); + } + + if ($("#c-forum-topics").length) { + Danbooru.keydown("shift+r", "mark_all_as_read", function(e) { + $("#secondary-links-mark-all-as-read a").click(); + }); } } diff --git a/app/assets/javascripts/pools.js b/app/assets/javascripts/pools.js index a4aa36f89..8e78a8701 100644 --- a/app/assets/javascripts/pools.js +++ b/app/assets/javascripts/pools.js @@ -3,6 +3,7 @@ Danbooru.Pool.initialize_all = function() { if ($("#c-pools").length) { + this.initialize_shortcuts(); if (Danbooru.meta("enable-auto-complete") === "true") { this.initialize_autocomplete_for("#search_name_matches,#quick_search_name_matches"); } @@ -70,6 +71,18 @@ }); } + Danbooru.Pool.initialize_shortcuts = function() { + if ($("#c-pools #a-show").length) { + Danbooru.keydown("e", "edit", function(e) { + $("#pool-edit a")[0].click(); + }); + + Danbooru.keydown("shift+d", "delete", function(e) { + $("#pool-delete a")[0].click(); + }); + } + }; + Danbooru.Pool.initialize_simple_edit = function() { $("#sortable").sortable({ placeholder: "ui-state-placeholder" diff --git a/app/assets/javascripts/wiki_pages.js b/app/assets/javascripts/wiki_pages.js index 4c4764550..7d90831a7 100644 --- a/app/assets/javascripts/wiki_pages.js +++ b/app/assets/javascripts/wiki_pages.js @@ -50,8 +50,11 @@ Danbooru.WikiPage.initialize_shortcuts = function() { if ($("#a-show").length) { Danbooru.keydown("e", "edit", function(e) { - $("#wiki-page-edit-link")[0].click(); - e.preventDefault(); + $("#wiki-page-edit a")[0].click(); + }); + + Danbooru.keydown("shift+d", "delete", function(e) { + $("#wiki-page-delete a")[0].click(); }); } } diff --git a/app/views/artists/_secondary_links.html.erb b/app/views/artists/_secondary_links.html.erb index 95e2435a9..06014b52b 100644 --- a/app/views/artists/_secondary_links.html.erb +++ b/app/views/artists/_secondary_links.html.erb @@ -10,12 +10,12 @@
  • <%= link_to "Posts (#{Post.fast_count(@artist.name)})", posts_path(:tags => @artist.name) %>
  • <%= link_to "Show", artist_path(@artist) %>
  • <% if CurrentUser.is_member? %> -
  • <%= link_to "Edit", edit_artist_path(@artist) %>
  • +
  • <%= link_to "Edit", edit_artist_path(@artist) %>
  • <% end %>
  • <%= link_to "History", artist_versions_path(:search => {:artist_id => @artist.id}) %>
  • <% if @artist.deletable_by?(CurrentUser.user) %> <% if @artist.is_active? %> -
  • <%= link_to "Delete", artist_path(@artist), :method => :delete, :data => {:confirm => "Are you sure you want to delete this artist?"} %>
  • +
  • <%= link_to "Delete", artist_path(@artist), :method => :delete, :data => {:confirm => "Are you sure you want to delete this artist?"} %>
  • <% else %>
  • <%= link_to "Undelete", undelete_artist_path(@artist), :method => :post, :data => {:confirm => "Are you sure you want to undelete this artist?"} %>
  • <% end %> diff --git a/app/views/forum_topics/_secondary_links.html.erb b/app/views/forum_topics/_secondary_links.html.erb index 99d8dd32d..1e1c0d846 100644 --- a/app/views/forum_topics/_secondary_links.html.erb +++ b/app/views/forum_topics/_secondary_links.html.erb @@ -7,7 +7,7 @@
  • <%= link_to "New", new_forum_topic_path %>
  • <%= link_to "Request alias", new_tag_alias_request_path %>
  • <%= link_to "Request implication", new_tag_implication_request_path %>
  • -
  • <%= link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post %>
  • +
  • <%= link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post %>
  • <% end %>
  • <%= link_to "Search", search_forum_posts_path %>
  • @@ -26,7 +26,7 @@ <% if @forum_topic.is_deleted? %>
  • <%= link_to "Undelete", undelete_forum_topic_path(@forum_topic), :method => :post %>
  • <% else %> -
  • <%= link_to "Delete", forum_topic_path(@forum_topic), :method => :delete, :data => {:confirm => "Are you sure you want to delete this forum topic?"} %>
  • +
  • <%= link_to "Delete", forum_topic_path(@forum_topic), :method => :delete, :data => {:confirm => "Are you sure you want to delete this forum topic?"} %>
  • <% end %> <% if @forum_topic.is_locked? %>
  • <%= link_to "Unlock", forum_topic_path(@forum_topic, :forum_topic => {:is_locked => false}), :method => :put %>
  • diff --git a/app/views/pools/_secondary_links.html.erb b/app/views/pools/_secondary_links.html.erb index 8f8eae873..39e5c4d2e 100644 --- a/app/views/pools/_secondary_links.html.erb +++ b/app/views/pools/_secondary_links.html.erb @@ -10,13 +10,13 @@
  • <%= link_to "Show", pool_path(@pool) %>
  • <%= link_to "Posts", posts_path(:tags => "pool:#{@pool.id}") %>
  • <% if CurrentUser.is_member? %> -
  • <%= link_to "Edit", edit_pool_path(@pool) %>
  • +
  • <%= link_to "Edit", edit_pool_path(@pool) %>
  • <% end %> <% if @pool.deletable_by?(CurrentUser.user) %> <% if @pool.is_deleted? %> -
  • <%= link_to "Undelete", undelete_pool_path(@pool), :method => :post, :remote => true %>
  • +
  • <%= link_to "Undelete", undelete_pool_path(@pool), :method => :post, :remote => true %>
  • <% else %> -
  • <%= link_to "Delete", pool_path(@pool), :method => :delete, :data => {:confirm => "Are you sure you want to delete this pool?"}, :remote => true %>
  • +
  • <%= link_to "Delete", pool_path(@pool), :method => :delete, :data => {:confirm => "Are you sure you want to delete this pool?"}, :remote => true %>
  • <% end %> <% end %> <% if PoolArchive.enabled? %> diff --git a/app/views/wiki_pages/_secondary_links.html.erb b/app/views/wiki_pages/_secondary_links.html.erb index dc7844b8a..ee56fab2c 100644 --- a/app/views/wiki_pages/_secondary_links.html.erb +++ b/app/views/wiki_pages/_secondary_links.html.erb @@ -16,10 +16,10 @@ <% unless @wiki_page.new_record? %>
  • <%= link_to "History", wiki_page_versions_path(:search => {:wiki_page_id => @wiki_page.id}) %>
  • <% if CurrentUser.is_member? %> -
  • <%= link_to "Edit", edit_wiki_page_path(@wiki_page), :id => "wiki-page-edit-link" %>
  • +
  • <%= link_to "Edit", edit_wiki_page_path(@wiki_page) %>
  • <% end %> <% if CurrentUser.is_builder? && !@wiki_page.is_deleted? %> -
  • <%= link_to "Delete", wiki_page_path(@wiki_page), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this wiki page?"} %>
  • +
  • <%= link_to "Delete", wiki_page_path(@wiki_page), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this wiki page?"} %>
  • <% end %> <% end %> <% end %>