]> git.wh0rd.org - tt-rss.git/blobdiff - js/viewfeed.js
adjust scroll amount to trigger auto-opening next unread feed
[tt-rss.git] / js / viewfeed.js
index 846c87a8f39ec8c7af0cf1bee530af026fe6a468..8f4b6dfe87dad0183f53a9c99fe4fbd3f5499e2d 100644 (file)
@@ -108,6 +108,10 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
 
                                initHeadlinesMenu();
 
+                               if (_infscroll_disable)
+                                       hsp.innerHTML = "<a href='#' onclick='openNextUnreadFeed()'>" +
+                                               __("Click to open next unread feed.") + "</a>";
+
                                if (_search_query) {
                                        $("feed_title").innerHTML += "<span id='cancel_search'>" +
                                                " (<a href='#' onclick='cancelSearch()'>" + __("Cancel search") + "</a>)" +
@@ -176,7 +180,7 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
 
                                        var hsp = $("headlines-spacer");
 
-                                       if (hsp) hsp.innerHTML = "";
+                                       if (hsp) hsp.innerHTML = "Click to open next unread feed.";
                                }
                        }
 
@@ -1315,7 +1319,12 @@ function headlines_scroll_handler(e) {
 
                        }
                } else {
-                       if (hsp) hsp.innerHTML = "";
+                       if (hsp)
+                               if (_infscroll_disable)
+                                       hsp.innerHTML = "<a href='#' onclick='openNextUnreadFeed()'>" +
+                                               __("Click to open next unread feed.") + "</a>";
+                               else
+                                       hsp.innerHTML = "";
                }
 
                if (isCdmMode()) {
@@ -1350,19 +1359,18 @@ function headlines_scroll_handler(e) {
                                        catchup_timeout_id = window.setTimeout('catchupBatchedArticles()',
                                                500);
                                }
-                       } else if (_infscroll_disable) {
+                       }
+
+                       if (_infscroll_disable) {
                                var child = $$("#headlines-frame div[id*=RROW]").last();
 
                                if (child && $("headlines-frame").scrollTop >
-                                               (child.offsetTop + child.offsetHeight/2)) {
+                                               (child.offsetTop + child.offsetHeight - 50)) {
 
                                        console.log("we seem to be at an end");
 
                                        if (getInitParam("on_catchup_show_next_feed") == "1") {
-                                               var is_cat = activeFeedIsCat();
-                                               var nuf = getNextUnreadFeed(getActiveFeedId(), is_cat);
-
-                                               if (nuf) viewfeed(nuf, '', is_cat);
+                                               openNextUnreadFeed();
                                        }
                                }
                        }
@@ -1373,6 +1381,16 @@ function headlines_scroll_handler(e) {
        }
 }
 
+function openNextUnreadFeed() {
+       try {
+               var is_cat = activeFeedIsCat();
+               var nuf = getNextUnreadFeed(getActiveFeedId(), is_cat);
+               if (nuf) viewfeed(nuf, '', is_cat);
+       } catch (e) {
+               exception_error("openNextUnreadFeed", e);
+       }
+}
+
 function catchupBatchedArticles() {
        try {
                if (catchup_id_batch.length > 0 && !_infscroll_request_sent) {