mirror of
https://github.com/thelounge/thelounge
synced 2024-11-10 22:54:15 +00:00
Implement pgup/pgdown keys
This commit is contained in:
parent
44f71bb93e
commit
2d9aa35c06
1 changed files with 27 additions and 0 deletions
|
@ -1301,6 +1301,33 @@ $(function() {
|
|||
});
|
||||
|
||||
(function HotkeysScope() {
|
||||
Mousetrap.bind([
|
||||
"pageup",
|
||||
"pagedown"
|
||||
], function(e, key) {
|
||||
let container = windows.find(".window.active");
|
||||
|
||||
// Chat windows scroll message container
|
||||
if (container.attr("id") === "chat-container") {
|
||||
container = container.find(".chan.active .chat");
|
||||
}
|
||||
|
||||
const offset = container.get(0).clientHeight * 0.94;
|
||||
let scrollTop = container.scrollTop();
|
||||
|
||||
if (key === "pageup") {
|
||||
scrollTop -= offset;
|
||||
} else {
|
||||
scrollTop += offset;
|
||||
}
|
||||
|
||||
container.stop().animate({
|
||||
scrollTop: scrollTop
|
||||
}, 200);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
Mousetrap.bind([
|
||||
"command+up",
|
||||
"command+down",
|
||||
|
|
Loading…
Reference in a new issue