* 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").
26 lines
564 B
JavaScript
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);
|
|
}
|
|
});
|
|
|