]> git.wh0rd.org - tt-rss.git/blobdiff - js/viewfeed.js
another implementation of pull 386 (show next when finished reading)
[tt-rss.git] / js / viewfeed.js
index 301260f135b69b11f7dd18f257c27f4a006e0ea7..846c87a8f39ec8c7af0cf1bee530af026fe6a468 100644 (file)
@@ -87,8 +87,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 +194,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 +315,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 +1244,7 @@ function postMouseOut(id) {
 
 function unpackVisibleHeadlines() {
        try {
-               if (!isCdmMode()) return;
+               if (!isCdmMode() || !getInitParam("cdm_expanded")) return;
 
                $$("#headlines-frame > div[id*=RROW]").each(
                        function(child) {
@@ -1351,6 +1350,21 @@ function headlines_scroll_handler(e) {
                                        catchup_timeout_id = window.setTimeout('catchupBatchedArticles()',
                                                500);
                                }
+                       } else 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") {
+                                               var is_cat = activeFeedIsCat();
+                                               var nuf = getNextUnreadFeed(getActiveFeedId(), is_cat);
+
+                                               if (nuf) viewfeed(nuf, '', is_cat);
+                                       }
+                               }
                        }
                }
 
@@ -1763,7 +1777,8 @@ function cdmClicked(event, id) {
                                return !event.shiftKey;
                        }
 
-               } else {
+               } else if (event.target.parents(".cdmHeader").length > 0) {
+
                        toggleSelected(id, true);
 
                        var elem = $("RROW-" + id);