This commit is contained in:
Toks
2015-04-23 11:20:14 -04:00
parent c56d16d336
commit a0baaea1b2
8 changed files with 194 additions and 101 deletions

View File

@@ -772,7 +772,7 @@ $(function() {
if ($("#c-posts").length && $("#a-show").length && $("#image").length && !$("video#image").length) {
if ($("#note-locked-notice").length == 0) {
$("#translate").bind("click", Danbooru.Note.TranslationMode.toggle);
$(document).bind("keypress", "n", Danbooru.Note.TranslationMode.toggle);
$(document).bind("keydown", "n", Danbooru.Note.TranslationMode.toggle);
}
Danbooru.Note.embed = (Danbooru.meta("post-has-embedded-notes") === "true");
Danbooru.Note.load_all();

View File

@@ -18,8 +18,8 @@
$(function() {
if ($(".paginator").length && (Danbooru.meta("enable-js-navigation") === "true")) {
$(document).bind("keypress", "d", Danbooru.Paginator.next_page);
$(document).bind("keypress", "a", Danbooru.Paginator.prev_page);
$(document).bind("keydown", "d", Danbooru.Paginator.next_page);
$(document).bind("keydown", "a", Danbooru.Paginator.prev_page);
}
});

View File

@@ -13,7 +13,7 @@
}
Danbooru.PostModeMenu.initialize_shortcuts = function() {
$(document).bind("keypress", "1 2 3 4 5 6 7 8 9 0", Danbooru.PostModeMenu.change_tag_script);
$(document).bind("keydown", "1 2 3 4 5 6 7 8 9 0", Danbooru.PostModeMenu.change_tag_script);
}
Danbooru.PostModeMenu.show_notice = function(i) {

View File

@@ -22,12 +22,12 @@
Danbooru.PostPopular.initialize_all = function() {
if ($("#c-explore-posts").length) {
if (Danbooru.meta("enable-js-navigation") === "true") {
$(document).bind("keypress", "a", function(e) {
$(document).bind("keydown", "a", function(e) {
Danbooru.PostPopular.nav_prev();
e.preventDefault();
});
$(document).bind("keypress", "d", function(e) {
$(document).bind("keydown", "d", function(e) {
Danbooru.PostPopular.nav_next();
e.preventDefault();
});

View File

@@ -169,23 +169,23 @@
Danbooru.Post.initialize_shortcuts = function() {
if ($("#a-show").length) {
$(document).bind("keypress", "e", function(e) {
$(document).bind("keydown", "e", function(e) {
$("#post-edit-link").trigger("click");
$("#post_tag_string").focus();
e.preventDefault();
});
$(document).bind("keypress", "a", function(e) {
$(document).bind("keydown", "a", function(e) {
Danbooru.Post.nav_prev();
e.preventDefault();
});
$(document).bind("keypress", "d", function(e) {
$(document).bind("keydown", "d", function(e) {
Danbooru.Post.nav_next();
e.preventDefault();
});
$(document).bind("keypress", "f", function(e) {
$(document).bind("keydown", "f", function(e) {
if ($("#add-to-favorites").is(":visible")) {
$("#add-to-favorites").click();
} else {
@@ -322,7 +322,7 @@
});
if ($("#image-resize-notice").length && Danbooru.meta("enable-js-navigation") === "true") {
$(document).bind("keypress", "v", function(e) {
$(document).bind("keydown", "v", function(e) {
if ($("#image-resize-notice").is(":visible")) {
$("#image-resize-link").click();
} else {

View File

@@ -2,21 +2,21 @@
Danbooru.Shortcuts = {};
Danbooru.Shortcuts.initialize = function() {
$(document).bind("keypress", "s", function(e) {
$(document).bind("keydown", "s", function(e) {
Danbooru.Shortcuts.nav_scroll_down();
});
$(document).bind("keypress", "w", function(e) {
$(document).bind("keydown", "w", function(e) {
Danbooru.Shortcuts.nav_scroll_up();
});
$(document).bind("keypress", "q", function(e) {
$(document).bind("keydown", "q", function(e) {
$("#tags, #search_name, #search_name_matches, #query").trigger("focus").selectEnd();
e.preventDefault();
});
if ($("#image").length) { // post page or bookmarklet upload page
$(document).bind("keypress", "shift+e", function(e) {
$(document).bind("keydown", "shift+e", function(e) {
if (!$("#edit-dialog").length) {
$("#edit").show();
$("#comments").hide();
@@ -32,17 +32,17 @@
}
if ($("#c-posts").length && $("#a-show").length) {
$(document).bind("keypress", "shift+o", function(e) {
$(document).bind("keydown", "shift+o", function(e) {
Danbooru.Post.approve(Danbooru.meta("post-id"));
});
$(document).bind("keypress", "r", function(e) {
$(document).bind("keydown", "r", function(e) {
$("#random-post")[0].click();
});
}
if ($("#c-posts").length && $("#a-index").length) {
$(document).bind("keypress", "r", function(e) {
$(document).bind("keydown", "r", function(e) {
$("#random-post")[0].click();
});
}

View File

@@ -51,7 +51,7 @@
Danbooru.WikiPage.initialize_shortcuts = function() {
if ($("#a-show").length) {
$(document).bind("keypress", "e", function(e) {
$(document).bind("keydown", "e", function(e) {
$("#wiki-page-edit-link")[0].click();
e.preventDefault();
});