From: Andrew Dolgov Date: Tue, 11 Aug 2015 09:00:08 +0000 (+0300) Subject: prevent cyclical scrolling in headlines if next offset requested by infscroll is... X-Git-Tag: 16.3~176 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=eaec06f950439db7d2ae0c7e25e915639e2ae281;p=tt-rss.git prevent cyclical scrolling in headlines if next offset requested by infscroll is zero a bunch of other related fixes --- diff --git a/js/feedlist.js b/js/feedlist.js index 05c50228..ad9d8dcf 100644 --- a/js/feedlist.js +++ b/js/feedlist.js @@ -72,12 +72,12 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req, can_w if (!background) { _viewfeed_last = get_timestamp(); - if (getActiveFeedId() != feed || offset == 0) { + if (getActiveFeedId() != feed || !infscroll_req) { setActiveArticleId(0); _infscroll_disable = 0; } - if (offset != 0 && !method) { + if (infscroll_req && !method) { var timestamp = get_timestamp(); if (_infscroll_request_sent && _infscroll_request_sent + 30 > timestamp) { diff --git a/js/viewfeed.js b/js/viewfeed.js index af5adeb2..e84ed710 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -565,8 +565,10 @@ function moveToPost(mode, noscroll, noexpand) { } } + console.log("cur: " + getActiveArticleId() + " next: " + next_id); + if (mode == "next") { - if (next_id || getActiveArticleId()) { + if (next_id /*|| getActiveArticleId()*/) { if (isCdmMode()) { var article = $("RROW-" + getActiveArticleId()); @@ -690,6 +692,8 @@ function toggleUnread(id, cmode, effect) { var row = $("RROW-" + id); if (row) { + var tmpClassName = row.className; + if (cmode == undefined || cmode == 2) { if (row.hasClassName("Unread")) { row.removeClassName("Unread"); @@ -713,11 +717,14 @@ function toggleUnread(id, cmode, effect) { // notify_progress("Loading, please wait..."); - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - handle_rpc_json(transport); - } }); + if (tmpClassName != row.className) { + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function (transport) { + handle_rpc_json(transport); + } + }); + } } @@ -1204,6 +1211,8 @@ function cdmScrollToArticleId(id, force) { } function setActiveArticleId(id) { + console.log("setActiveArticleId:" + id); + _active_article_id = id; PluginHost.run(PluginHost.HOOK_ARTICLE_SET_ACTIVE, _active_article_id); } @@ -1281,7 +1290,7 @@ function headlines_scroll_handler(e) { } if (!_infscroll_disable) { - if (hsp && hsp.offsetTop - 100 <= e.scrollTop + e.offsetHeight) { + if (hsp && hsp.offsetTop - 250 <= e.scrollTop + e.offsetHeight) { hsp.innerHTML = " " + __("Loading, please wait...") + "";