1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 02:45:56 +00:00
This commit is contained in:
Andrew Dolgov
2020-05-17 08:25:51 +03:00
parent 3dc506a19a
commit 9ae9302b6b
11 changed files with 110 additions and 111 deletions

View File

@@ -7,6 +7,33 @@ define(["dojo/_base/declare"], function (declare) {
hotkey_prefix: 0,
hotkey_prefix_pressed: false,
hotkey_prefix_timeout: 0,
Scrollable: {
scrollByPages: function (elem, page_offset, event) {
if (!elem) return;
/* keep a line or so from the previous page */
const offset = (elem.offsetHeight - (page_offset > 0 ? 50 : -50)) * page_offset;
this.scroll(elem, offset, event);
},
scroll: function(elem, offset, event) {
if (!elem) return;
if (event && event.repeat) {
elem.addClassName("forbid-smooth-scroll");
window.clearTimeout(this._scroll_reset_timeout);
this._scroll_reset_timeout = window.setTimeout(() => {
if (elem) elem.removeClassName("forbid-smooth-scroll");
}, 250)
} else {
elem.removeClassName("forbid-smooth-scroll");
}
elem.scrollTop += offset;
},
},
constructor: function() {
window.onerror = this.Error.onWindowError;
},