]> git.wh0rd.org - tt-rss.git/blobdiff - js/viewfeed.js
scroll to end to show next feed or category
[tt-rss.git] / js / viewfeed.js
index 301260f135b69b11f7dd18f257c27f4a006e0ea7..a786904e39d48859b8f0cf3d925435a294cb35e1 100644 (file)
@@ -8,6 +8,7 @@ var post_under_pointer = false;
 var last_requested_article = false;
 
 var catchup_id_batch = [];
+var catchup_go_next = false;
 var catchup_timeout_id = false;
 
 var cids_requested = [];
@@ -87,8 +88,12 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
                                dijit.byId("headlines-frame").attr('content',
                                        reply['headlines']['content']);
 
-                               dijit.byId("headlines-toolbar").attr('content',
-                                       reply['headlines']['toolbar']);
+                               //dijit.byId("headlines-toolbar").attr('content',
+                               //      reply['headlines']['toolbar']);
+
+                               dojo.html.set($("headlines-toolbar"),
+                                               reply['headlines']['toolbar'],
+                                               {parseContent: true});
 
                                $$("#headlines-frame > div[id*=RROW]").each(function(row) {
                                        if (loaded_article_ids.indexOf(row.id) != -1) {
@@ -190,14 +195,11 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
                        else
                                request_counters(true);
 
-               } else if (transport.responseText) {
+               } else {
                        console.error("Invalid object received: " + transport.responseText);
                        dijit.byId("headlines-frame").attr('content', "<div class='whiteBox'>" +
                                        __('Could not update headlines (invalid object received - see error console for details)') +
                                        "</div>");
-               } else {
-                       //notify_error("Error communicating with server.");
-                       Element.show(dijit.byId("net-alert").domNode);
                }
 
                _infscroll_request_sent = 0;
@@ -314,13 +316,11 @@ function article_callback2(transport, id) {
 //                             return;
 //                     }
 
-               } else if (transport.responseText) {
+               } else {
                        console.error("Invalid object received: " + transport.responseText);
 
                        render_article("<div class='whiteBox'>" +
                                        __('Could not display article (invalid object received - see error console for details)') + "</div>");
-               } else {
-                       Element.show(dijit.byId("net-alert").domNode);
                }
 
                var unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length
@@ -1245,7 +1245,7 @@ function postMouseOut(id) {
 
 function unpackVisibleHeadlines() {
        try {
-               if (!isCdmMode()) return;
+               if (!isCdmMode() || !getInitParam("cdm_expanded")) return;
 
                $$("#headlines-frame > div[id*=RROW]").each(
                        function(child) {
@@ -1329,6 +1329,8 @@ function headlines_scroll_handler(e) {
                        var ts = new Date().getTime();
                        if (ts - _last_headlines_update < 100) return;
 
+                       var atend = true;
+
                        $$("#headlines-frame > div[id*=RROW][class*=Unread]").each(
                                function(child) {
                                        if (child.hasClassName("Unread") && $("headlines-frame").scrollTop >
@@ -1340,10 +1342,18 @@ function headlines_scroll_handler(e) {
                                                        catchup_id_batch.push(id);
 
                                                //console.log("auto_catchup_batch: " + catchup_id_batch.toString());
+                                       } else {
+                                               atend = false;
                                        }
 
                                });
 
+                       if (atend) {
+                               if (getInitParam("on_catchup_show_next_feed") == "1") {
+                                       catchup_go_next = true;
+                               }
+                       }
+
                        if (catchup_id_batch.length > 0) {
                                window.clearTimeout(catchup_timeout_id);
 
@@ -1389,6 +1399,12 @@ function catchupBatchedArticles() {
 
                                } });
                }
+               if (catchup_go_next) {
+                       catchup_go_next = false;
+                       var is_cat = activeFeedIsCat();
+                       var nuf = getNextUnreadFeed(getActiveFeedId(), is_cat);
+                       if (nuf) viewfeed(nuf, '', is_cat);
+               }
 
        } catch (e) {
                exception_error("catchupBatchedArticles", e);
@@ -1763,7 +1779,8 @@ function cdmClicked(event, id) {
                                return !event.shiftKey;
                        }
 
-               } else {
+               } else if (event.target.parents(".cdmHeader").length > 0) {
+
                        toggleSelected(id, true);
 
                        var elem = $("RROW-" + id);