Skip to content

Commit

Permalink
(#939) Try alternate way to detect bottom of page
Browse files Browse the repository at this point in the history
  • Loading branch information
Difegue committed Jan 12, 2025
1 parent 1b50138 commit e0df929
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions public/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,15 @@ LRR.getImgSizeAsync = function (target) {
});
};

LRR.getDocHeight = function() {
var D = document;
return Math.max(
D.body.scrollHeight, D.documentElement.scrollHeight,
D.body.offsetHeight, D.documentElement.offsetHeight,
D.body.clientHeight, D.documentElement.clientHeight
);
}

/**
* Show a generic toast with a given header and message.
* This is a compatibility layer to migrate jquery-toast-plugin to react-toastify.
Expand Down
2 changes: 1 addition & 1 deletion public/js/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ Reader.handleShortcuts = function (e) {
if ($(".page-overlay").is(":visible")) { break; }
if (e.originalEvent.getModifierState("Shift") && (window.scrollY) === 0) {
(Reader.mangaMode) ? Reader.changePage(1) : Reader.changePage(-1);
} else if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
} else if (($(window).height() + $(window).scrollTop()) >= LRR.getDocHeight()) {
(Reader.mangaMode) ? Reader.changePage(-1) : Reader.changePage(1);
}
// spacebar is always forward regardless of reading direction, so it needs to be flipped
Expand Down

0 comments on commit e0df929

Please sign in to comment.