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:
@@ -7,9 +7,7 @@
|
||||
this.initialize_autocomplete();
|
||||
}
|
||||
|
||||
if (Danbooru.meta("enable-js-navigation") === "true") {
|
||||
this.initialize_shortcuts();
|
||||
}
|
||||
this.initialize_shortcuts();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +49,7 @@
|
||||
|
||||
Danbooru.WikiPage.initialize_shortcuts = function() {
|
||||
if ($("#a-show").length) {
|
||||
$(document).bind("keydown", "e", function(e) {
|
||||
Danbooru.keydown("e", "edit", function(e) {
|
||||
$("#wiki-page-edit-link")[0].click();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user