]> git.wh0rd.org Git - tt-rss.git/commitdiff
headlines scroll handler: add a rate limit
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Tue, 22 Mar 2016 09:43:18 +0000 (12:43 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Tue, 22 Mar 2016 09:43:18 +0000 (12:43 +0300)
js/feedlist.js
js/viewfeed.js

index a7bf05d42edd7353b5d4dcc9c0b0e03abfd79148..a976c55bd44633a8716676e589c1a554d568d396 100644 (file)
@@ -102,6 +102,7 @@ function viewfeed(params) {
                                _infscroll_disable = 0;
 
                                cleanup_memory("headlines-frame");
+                               _headlines_scroll_offset = 0;
                        }
 
                        if (infscroll_req) {
index 0b37c071fa967df1af88ec35737e400421fb72f0..83ef3ac6006d7795dd4fff113c08f54b8435ae83 100755 (executable)
@@ -13,6 +13,7 @@ var catchup_timeout_id = false;
 var cids_requested = [];
 var loaded_article_ids = [];
 var _last_headlines_update = 0;
+var _headlines_scroll_offset = 0;
 var current_first_id = 0;
 
 var _catchup_request_sent = false;
@@ -1265,6 +1266,14 @@ function unpackVisibleHeadlines() {
 
 function headlines_scroll_handler(e) {
        try {
+
+               // rate-limit in case of smooth scrolling and similar abominations
+               if (e.scrollTop - _headlines_scroll_offset < 10) {
+                       return;
+               }
+
+               _headlines_scroll_offset = e.scrollTop;
+
                var hsp = $("headlines-spacer");
 
                unpackVisibleHeadlines();
@@ -1273,6 +1282,7 @@ function headlines_scroll_handler(e) {
                if (isCdmMode() && getInitParam("cdm_auto_catchup") == 1 &&
                                getSelectedArticleIds2().length <= 1 &&
                                getInitParam("cdm_expanded")) {
+
                        var rows = $$("#headlines-frame > div[id*=RROW]");
 
                        for (var i = 0; i < rows.length; i++) {