]> git.wh0rd.org - tt-rss.git/commitdiff
fix view() being called twice on every headline click, experimental progress indicato...
authorAndrew Dolgov <fox@bah.org.ru>
Wed, 7 Oct 2009 10:22:44 +0000 (14:22 +0400)
committerAndrew Dolgov <fox@bah.org.ru>
Wed, 7 Oct 2009 10:22:44 +0000 (14:22 +0400)
feedlist.js
functions.php
images/indicator_tiny.gif [new file with mode: 0644]
tt-rss.css
viewfeed.js

index 05109ad23334d4b7998bfc0f7856b271e9d3bb00..37c80001a6ee038a532b8d18eee8b49bd89a2b67 100644 (file)
@@ -315,7 +315,17 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
                } else {
 
                        if (!page_offset) {
-                               notify_progress("Loading, please wait...", true);
+                               var feedr = $('FEEDR-' + feed);
+
+                               if (feedr) {
+                                       var ll = document.createElement('img');
+
+                                       ll.src = 'images/indicator_tiny.gif';
+                                       ll.className = 'hlLoading';
+                                       ll.id = 'FLL-' + feed;
+
+                                       feedr.appendChild(ll);
+                               }
                        }
 
                        new Ajax.Request(query, {
index effd20005869c0b2e67bbdff3a81ecb30fcf2070..2c2a81c5666090e2d8204df3331be522b32d1d74 100644 (file)
 #                                                              truncate_string($line["feed_title"],30)."</a>&nbsp;</td>";
 #                                      } else {                        
 
-                                       print "<td onclick='view($id,$feed_id)' class='hlContent$hlc_suffix' valign='middle'>";
+                                       print "<td onclick='view($id,$feed_id)' class='hlContent$hlc_suffix' valign='middle' id='HLC-$id'>";
 
                                        print "<a id=\"RTITLE-$id\" 
                                                href=\"" . htmlspecialchars($line["link"]) . "\"
-                                               onclick=\"return view($id,$feed_id);\">" .
+                                               onclick=\"return false\">" .
                                                $line["title"];
 
                                        if (get_pref($link, 'SHOW_CONTENT_PREVIEW')) {
                                                        </span>";
                                                }
                                        }
+
+//                                     print "<img id='HLL-$id' class='hlLoading' 
+//                                             src='images/indicator_tiny.gif' style='display : none'>";
+
                                        print "</td>";
 
 #                                      }
diff --git a/images/indicator_tiny.gif b/images/indicator_tiny.gif
new file mode 100644 (file)
index 0000000..09d621e
Binary files /dev/null and b/images/indicator_tiny.gif differ
index 598f0c749ca95b78b90262e2df5d9478a70fab0d..021af11d89b4c383124ca0b51f3fa6f964a0fa85 100644 (file)
@@ -105,6 +105,12 @@ div.postReply span.author {
        font-size : 12px;
 }
 
+ul.feedList img.hlLoading {
+       margin-left : 5px;
+       vertical-align : middle;
+       height : 10px;
+}
+
 ul.feedList {
        list-style-type : none;
        margin : 5px 5px 5px 0px;
@@ -915,6 +921,11 @@ table.headlinesList span.hlLabelRef, div.cdmHeader span.hlLabelRef {
        white-space: nowrap;
 }
 
+table.headlinesList img.hlLoading {
+       margin-left : 5px;
+       vertical-align : middle;
+}
+
 table.headlinesList td.hlFeedIcon {
        width : 25px;
        text-align : center;
index 227aa87a50a21334ad49c02848728e9a39953968..7a614f783bc7c5d475a4490c9e168ef4a8ce6040 100644 (file)
@@ -106,18 +106,23 @@ function headlines_callback2(transport, feed_cur_page) {
                        }
                }
 
+               var ll = $('FLL-' + feed_id);
+
                if (!is_cat) {
                        var feedr = $("FEEDR-" + feed_id);
                        if (feedr && !feedr.className.match("Selected")) {      
                                feedr.className = feedr.className + "Selected";
                        } 
+                       if (feedr && ll) feedr.removeChild(ll);
                } else {
                        var feedr = $("FCAT-" + feed_id);
                        if (feedr && !feedr.className.match("Selected")) {      
                                feedr.className = feedr.className + "Selected";
                        } 
+                       if (feedr && ll) feedr.removeChild(ll);
+
                }
-       
+
                var f = $("headlines-frame");
                try {
                        if (feed_cur_page == 0) { 
@@ -363,6 +368,19 @@ function article_callback2(transport, id, feed_id) {
 
                        if (!transport_error_check(transport)) return;
 
+                       var ll = $('LL-' + id);
+                       var content = $('HLC-' + id);
+
+                       if (ll && content) content.removeChild(ll);
+                       
+                       if (id != last_requested_article) {
+                               debug("requested article id is out of sequence, aborting");
+                               return;
+                       }
+
+                       active_real_feed_id = feed_id;
+                       active_post_id = id; 
+
                        debug("looking for articles to cache...");
 
                        var articles = transport.responseXML.getElementsByTagName("article");
@@ -380,13 +398,6 @@ function article_callback2(transport, id, feed_id) {
                                cache_inject(a_id, articles[i].firstChild.nodeValue);
                        }
 
-                       if (id != last_requested_article) {
-                               debug("requested article id is out of sequence, aborting");
-                               return;
-                       }
-
-                       active_real_feed_id = feed_id;
-                       active_post_id = id; 
 
                        showArticleInHeadlines(id);     
 
@@ -491,7 +502,20 @@ function view(id, feed_id, skip_history) {
 
                if (!cached_article) {
 
-                       notify_progress("Loading, please wait...", true);
+//                     notify_progress("Loading, please wait...", true);
+
+                       var content = $('HLC-' + id);
+
+                       if (content && !$('LL-' + id)) {
+                               var ll = document.createElement('img');
+               
+                               ll.src = 'images/indicator_tiny.gif';
+                               ll.className = 'hlLoading';
+                               ll.id = 'LL-' + id;
+
+                               content.appendChild(ll);
+
+                       }
 
                } else if (cached_article && article_is_unread) {