]> git.wh0rd.org Git - tt-rss.git/commitdiff
allow marking last headline as read automatically by scrolling below content
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 3 Aug 2011 14:36:08 +0000 (18:36 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 3 Aug 2011 14:36:08 +0000 (18:36 +0400)
tt-rss.css
viewfeed.js

index 28c9e9a1dea24348c125efde4c074164ae83f008..2f227595e6287aa9cf52be1cce80adea168fa013 100644 (file)
@@ -1543,3 +1543,10 @@ a.bookmarklet {
        cursor : pointer;
 }
 
+#headlines-spacer {
+       height : 100%;
+       margin-left : 1px;
+       text-align : center;
+       padding : 1em;
+       color : gray;
+}
index 552e42d03f620371cf7ad3f67ec44073b3b979ac..9d5af3adf23bfec08e7a7fc9f504a529da9a51af 100644 (file)
@@ -72,6 +72,17 @@ function headlines_callback2(transport, feed_cur_page) {
                                dijit.byId("headlines-toolbar").attr('content',
                                        reply['headlines']['toolbar']);
 
+                               var hsp = $("headlines-spacer");
+                               if (!hsp) hsp = document.createElement("DIV");
+
+                               hsp.id = "headlines-spacer";
+
+                               if (!_infscroll_disable)
+                                       hsp.innerHTML = "<img src='images/indicator_tiny.gif'> " +
+                                               __("Loading, please wait...");
+
+                               dijit.byId('headlines-frame').domNode.appendChild(hsp);
+
                                initHeadlinesMenu();
 
                        } else {
@@ -83,10 +94,25 @@ function headlines_callback2(transport, feed_cur_page) {
 
                                        $("headlines-tmp").innerHTML = reply['headlines']['content'];
 
+                                       var hsp = $("headlines-spacer");
+
+                                       if (hsp)
+                                               c.domNode.removeChild(hsp);
+
                                        $$("#headlines-tmp > div").each(function(row) {
                                                c.domNode.appendChild(row);
                                        });
 
+                                       if (!hsp) hsp = document.createElement("DIV");
+
+                                       hsp.id = "headlines-spacer";
+
+                                       if (!_infscroll_disable)
+                                               hsp.innerHTML = "<img src='images/indicator_tiny.gif'> " +
+                                                       __("Loading, please wait...");
+
+                                       c.domNode.appendChild(hsp);
+
                                        console.log("restore selected ids: " + ids);
 
                                        for (var i = 0; i < ids.length; i++) {
@@ -97,6 +123,10 @@ function headlines_callback2(transport, feed_cur_page) {
 
                                } else {
                                        console.log("no new headlines received");
+
+                                       var hsp = $("headlines-spacer");
+
+                                       if (hsp) hsp.innerHTML = "";
                                }
                        }
 
@@ -1306,14 +1336,18 @@ function postMouseOut(id) {
 
 function headlines_scroll_handler(e) {
        try {
+               var hsp = $("headlines-spacer");
+
+               if (!_infscroll_disable) {
+                       if (hsp && (e.scrollTop + e.offsetHeight > hsp.offsetTop) ||
+                                       e.scrollTop + e.offsetHeight > e.scrollHeight - 100) {
 
-               if (e.scrollTop + e.offsetHeight > e.scrollHeight - 100) {
-                       if (!_infscroll_disable) {
                                viewNextFeedPage();
                        }
+               } else {
+                       if (hsp) hsp.innerHTML = "";
                }
 
-
                if (getInitParam("cdm_auto_catchup") == 1) {
 
                        var ids = [];