Files
danbooru/app/assets/javascripts/paginator.js
evazion c3fa653fc5 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").
2017-01-24 02:45:55 -06:00

26 lines
564 B
JavaScript

(function() {
Danbooru.Paginator = {};
Danbooru.Paginator.next_page = function() {
var href = $(".paginator a[rel=next]").attr("href");
if (href) {
window.location = href;
}
}
Danbooru.Paginator.prev_page = function() {
var href = $(".paginator a[rel=prev]").attr("href");
if (href) {
window.location = href;
}
}
})();
$(function() {
if ($(".paginator").length) {
Danbooru.keydown("d", "next_page", Danbooru.Paginator.next_page);
Danbooru.keydown("a", "prev_page", Danbooru.Paginator.prev_page);
}
});