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:
@@ -27,11 +27,11 @@
|
||||
}
|
||||
|
||||
Danbooru.Upload.initialize_enter_on_tags = function() {
|
||||
$("#upload_tag_string,#post_tag_string").bind("keydown", "return", function(e) {
|
||||
$("#upload_tag_string,#post_tag_string").on("keydown.danbooru.submit", null, "return", function(e) {
|
||||
if (!Danbooru.autocompleting) {
|
||||
$("#form").trigger("submit");
|
||||
$("#quick-edit-form").trigger("submit");
|
||||
$("#upload_tag_string,#post_tag_string").unbind("keydown");
|
||||
$("#upload_tag_string,#post_tag_string").off(".submit");
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user