posts: refactor next/prev keyboard shortcuts.

On the post show page, define the next page / previous page keyboard
shortcuts in html using data-shortcut attributes instead of in
Javascript. This is consistent with how these shortcuts are defined on
the post index page.
This commit is contained in:
evazion
2021-01-29 21:57:35 -06:00
parent 27cac98516
commit c0f27d6e3b
2 changed files with 6 additions and 34 deletions

View File

@@ -19,7 +19,6 @@ Post.EDIT_DIALOG_WIDTH = 720;
Post.initialize_all = function() {
if ($("#c-posts").length) {
this.initialize_shortcuts();
this.initialize_saved_searches();
}
@@ -175,26 +174,6 @@ Post.swipe_prev = function(e) {
e.preventDefault();
}
Post.nav_prev = function(e) {
var href = "";
if ($(".paginator a[rel~=prev], .post-notice-search a[rel~=prev]").length) {
location.href = $("a[rel~=prev]").attr("href");
}
e.preventDefault();
}
Post.nav_next = function(e) {
var href = "";
if ($(".paginator a[rel~=next], .post-notice-search a[rel~=next]").length) {
location.href = $("a[rel~=next]").attr("href");
}
e.preventDefault();
}
Post.swipe_next = function(e) {
if ($(".paginator a[rel~=next ]").length) {
location.href = $(".paginator a[rel~=next]").attr("href");
@@ -203,13 +182,6 @@ Post.swipe_next = function(e) {
e.preventDefault();
}
Post.initialize_shortcuts = function() {
if ($("#a-show").length) {
Utility.keydown("a", "prev_page", Post.nav_prev);
Utility.keydown("d", "next_page", Post.nav_next);
}
}
Post.initialize_links = function() {
$("#copy-notes").on("click.danbooru", function(e) {
var current_post_id = $("meta[name=post-id]").attr("content");