diff options
author | Andrew Dolgov <[email protected]> | 2019-12-09 23:23:54 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-12-09 23:23:54 +0300 |
commit | 44ef447c0f3c4cd5d5bbd02b2971ea80422a8439 (patch) | |
tree | d4e75e3fa453da29765ed7cb1706b3c63ce00560 /js | |
parent | e7dd634183154949fab7aa0b00844eb645cb87e5 (diff) |
fix fatal error in previous because of event not being passed via Headlines.move()
scrollbypages, etc: make event optional anyway
Diffstat (limited to 'js')
-rw-r--r-- | js/Article.js | 2 | ||||
-rwxr-xr-x | js/Headlines.js | 16 | ||||
-rw-r--r-- | js/tt-rss.js | 24 |
3 files changed, 24 insertions, 18 deletions
diff --git a/js/Article.js b/js/Article.js index 9c7ccf074..1b92c2965 100644 --- a/js/Article.js +++ b/js/Article.js @@ -338,7 +338,7 @@ define(["dojo/_base/declare"], function (declare) { elem = $("headlines-frame"); } - if (event.repeat) { + if (event && event.repeat) { elem.addClassName("forbid-smooth-scroll"); window.clearTimeout(this._scroll_reset_timeout); diff --git a/js/Headlines.js b/js/Headlines.js index 058376266..354c8b18d 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -806,7 +806,13 @@ define(["dojo/_base/declare"], function (declare) { if (row) row.toggleClassName("published"); }, - move: function (mode, noscroll, noexpand) { + move: function (mode, params) { + params = params || {}; + + const noscroll = params.noscroll || false; + const noexpand = params.noexpand || false; + const event = params.event; + const rows = Headlines.getLoaded(); let prev_id = false; @@ -849,7 +855,7 @@ define(["dojo/_base/declare"], function (declare) { if (!noscroll && article && article.offsetTop + article.offsetHeight > ctr.scrollTop + ctr.offsetHeight) { - Article.scroll(ctr.offsetHeight / 4); + Article.scroll(ctr.offsetHeight / 4, event); } else if (next_id) { Article.setActive(next_id); @@ -872,10 +878,10 @@ define(["dojo/_base/declare"], function (declare) { const ctr = $("headlines-frame"); if (!noscroll && article && article.offsetTop < ctr.scrollTop) { - Article.scroll(-ctr.offsetHeight / 3); + Article.scroll(-ctr.offsetHeight / 3, event); } else if (!noscroll && prev_article && prev_article.offsetTop < ctr.scrollTop) { - Article.scroll(-ctr.offsetHeight / 4); + Article.scroll(-ctr.offsetHeight / 4, event); } else if (prev_id) { Article.setActive(prev_id); Article.cdmScrollToId(prev_id, noscroll); @@ -1387,7 +1393,7 @@ define(["dojo/_base/declare"], function (declare) { scrollByPages: function (offset, event) { const elem = $("headlines-frame"); - if (event.repeat) { + if (event && event.repeat) { elem.addClassName("forbid-smooth-scroll"); window.clearTimeout(this._scroll_reset_timeout); diff --git a/js/tt-rss.js b/js/tt-rss.js index 8972543c9..744034f0c 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -277,23 +277,23 @@ require(["dojo/_base/kernel", if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true}) }; - this.hotkey_actions["next_article"] = function () { - Headlines.move('next'); + this.hotkey_actions["next_article"] = function (event) { + Headlines.move('next', {event: event}); }; - this.hotkey_actions["prev_article"] = function () { - Headlines.move('prev'); + this.hotkey_actions["prev_article"] = function (event) { + Headlines.move('prev', {event: event}); }; - this.hotkey_actions["next_article_noscroll"] = function () { - Headlines.move('next', true); + this.hotkey_actions["next_article_noscroll"] = function (event) { + Headlines.move('next', {noscroll: true, event: event}); }; - this.hotkey_actions["prev_article_noscroll"] = function () { - Headlines.move('prev', true); + this.hotkey_actions["prev_article_noscroll"] = function (event) { + Headlines.move('prev', {noscroll: true, event: event}); }; - this.hotkey_actions["next_article_noexpand"] = function () { - Headlines.move('next', true, true); + this.hotkey_actions["next_article_noexpand"] = function (event) { + Headlines.move('next', {noscroll: true, noexpand: true, event: event}); }; - this.hotkey_actions["prev_article_noexpand"] = function () { - Headlines.move('prev', true, true); + this.hotkey_actions["prev_article_noexpand"] = function (event) { + Headlines.move('prev', {noscroll: true, noexpand: true, event: event}); }; this.hotkey_actions["search_dialog"] = function () { Feeds.search(); |