]> git.wh0rd.org Git - tt-rss.git/commitdiff
assorted fixes for keyboard navigation which hopefully don't break everything else
authorAndrew Dolgov <noreply@fakecake.org>
Tue, 11 Aug 2015 07:06:30 +0000 (10:06 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Tue, 11 Aug 2015 07:06:30 +0000 (10:06 +0300)
js/feedlist.js
js/viewfeed.js

index 6284534dba8e3a9d003c8d3ac706c4dd07f30403..05c50228400f38804d6cca5648f603dcc625f17b 100644 (file)
@@ -1,6 +1,5 @@
 var _infscroll_disable = 0;
 var _infscroll_request_sent = 0;
-var _infscroll_tmp_disable = 0;
 
 var _search_query = false;
 var _viewfeed_last = 0;
@@ -15,9 +14,7 @@ function viewCategory(cat) {
 
 function loadMoreHeadlines() {
        try {
-               console.log("loadMoreHeadlines: " + _infscroll_tmp_disable);
-
-               if (_infscroll_tmp_disable) return;
+               console.log("loadMoreHeadlines");
 
                var offset = 0;
 
index d73d388a98b17d4af6f6e7b5c7a50e41f481f27b..243e9983bc33dbf9a92fa7973ce3ba1c3addfee4 100644 (file)
@@ -15,6 +15,8 @@ var loaded_article_ids = [];
 var _last_headlines_update = 0;
 var current_first_id = 0;
 
+var _catchup_request_sent = false;
+
 var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null;
 
 function headlines_callback2(transport, offset, background, infscroll_req) {
@@ -1319,9 +1321,15 @@ function headlines_scroll_handler(e) {
                                window.clearTimeout(catchup_timeout_id);
 
                                if (!_infscroll_request_sent) {
-                                       catchup_timeout_id = window.setTimeout('catchupBatchedArticles()',
-                                               500);
+                                       if (catchup_id_batch.length < 10) {
+                                               catchup_timeout_id = window.setTimeout('catchupBatchedArticles()',
+                                                       500);
+                                       } else {
+                                               catchupBatchedArticles();
+                                       }
                                }
+
+                               catchupBatchedArticles();
                        }
 
                        if (_infscroll_disable) {
@@ -1356,7 +1364,7 @@ function openNextUnreadFeed() {
 
 function catchupBatchedArticles() {
        try {
-               if (catchup_id_batch.length > 0 && !_infscroll_request_sent) {
+               if (catchup_id_batch.length > 0 && !_infscroll_request_sent && !_catchup_request_sent) {
 
                        // make a copy of the array
                        var batch = catchup_id_batch.slice();
@@ -1365,16 +1373,18 @@ function catchupBatchedArticles() {
 
                        console.log(query);
 
+                       _catchup_request_sent = true;
+
                        new Ajax.Request("backend.php", {
                                parameters: query,
                                onComplete: function(transport) {
                                        handle_rpc_json(transport);
 
+                                       _catchup_request_sent = false;
+
                                        reply = JSON.parse(transport.responseText);
                                        var batch = reply.ids;
 
-                                       _infscroll_tmp_disable = 1;
-
                                        batch.each(function(id) {
                                                console.log(id);
                                                var elem = $("RROW-" + id);
@@ -1382,8 +1392,6 @@ function catchupBatchedArticles() {
                                                catchup_id_batch.remove(id);
                                        });
 
-                                       _infscroll_tmp_disable = 0;
-
                                        updateFloatingTitle(true);
 
                                } });
@@ -1509,6 +1517,8 @@ function cdmCollapseArticle(event, id, unmark) {
 
 function cdmExpandArticle(id, noexpand) {
        try {
+               if (getInitParam("cdm_expanded")) return;
+
                console.log("cdmExpandArticle " + id);
 
                if (!$("RROW-" + id)) return false;
@@ -1563,6 +1573,7 @@ function cdmExpandArticle(id, noexpand) {
 
                if (!noexpand)
                        toggleUnread(id, 0, true);
+
                toggleSelected(id);
                $("RROW-" + id).addClassName("active");
 
@@ -1702,8 +1713,11 @@ function dismissReadArticles() {
        }
 }
 
+// we don't really hide rows anymore
 function getVisibleArticleIds() {
-       var ids = [];
+       return getLoadedArticleIds();
+
+       /*var ids = [];
 
        try {
 
@@ -1717,7 +1731,7 @@ function getVisibleArticleIds() {
                exception_error("getVisibleArticleIds", e);
        }
 
-       return ids;
+       return ids; */
 }
 
 function cdmClicked(event, id) {