]> git.wh0rd.org - tt-rss.git/blobdiff - js/viewfeed.js
add a link to headlines-spacer to open next unread feed
[tt-rss.git] / js / viewfeed.js
index 9672c47ba6acdebbf5998d6f8b5fdc34992f0c67..76248415aef7f07a10e92a57813701bc4590a35f 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()) {
@@ -1351,6 +1360,20 @@ function headlines_scroll_handler(e) {
                                                500);
                                }
                        }
+
+                       if (_infscroll_disable) {
+                               var child = $$("#headlines-frame div[id*=RROW]").last();
+
+                               if (child && $("headlines-frame").scrollTop >
+                                               (child.offsetTop + child.offsetHeight/2)) {
+
+                                       console.log("we seem to be at an end");
+
+                                       if (getInitParam("on_catchup_show_next_feed") == "1") {
+                                               openNextUnreadFeed();
+                                       }
+                               }
+                       }
                }
 
        } catch (e) {
@@ -1358,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) {