hotkeys: refactor to use .on(), namespaces.
* Use .on() instead of .bind() because bind is deprecated in jquery 3.0.
* Ensure enable-js-navigation is always respected.
* Namespace keybindings so they may be disabled by userscripts with
e.g. $(document).off("keydown.danbooru") or $(document).off("next_page").
This commit is contained in:
@@ -17,9 +17,9 @@
|
||||
})();
|
||||
|
||||
$(function() {
|
||||
if ($(".paginator").length && (Danbooru.meta("enable-js-navigation") === "true")) {
|
||||
$(document).bind("keydown", "d", Danbooru.Paginator.next_page);
|
||||
$(document).bind("keydown", "a", Danbooru.Paginator.prev_page);
|
||||
if ($(".paginator").length) {
|
||||
Danbooru.keydown("d", "next_page", Danbooru.Paginator.next_page);
|
||||
Danbooru.keydown("a", "prev_page", Danbooru.Paginator.prev_page);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user