]> git.wh0rd.org Git - tt-rss.git/commitdiff
rework infinite scroll request synchronization
authorAndrew Dolgov <fox@madoka.spb.ru>
Tue, 28 Aug 2007 05:05:45 +0000 (06:05 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Tue, 28 Aug 2007 05:05:45 +0000 (06:05 +0100)
feedlist.js
viewfeed.js

index a8c1cd5c865b239b14770fa09c5bc97c12331986..774c4d2e2cc0b47602afcc4ff54f59a77d7d5491 100644 (file)
@@ -1,5 +1,6 @@
 var _feed_cur_page = 0;
 var _infscroll_disable = 0;
+var _infscroll_request_sent = 0;
 
 function viewCategory(cat) {
        active_feed_is_cat = true;
@@ -53,6 +54,20 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
                        _infscroll_disable = 0;
                }
 
+               if (page_offset != 0 && !subop) {
+                       var date = new Date();
+                       var timestamp = Math.round(date.getTime() / 1000);
+
+                       debug("<b>" + _infscroll_request_sent + " : " + timestamp + "</b>");
+
+                       if (_infscroll_request_sent && _infscroll_request_sent + 30 > timestamp) {
+                               debug("infscroll request in progress, aborting");
+                               return;
+                       }
+
+                       _infscroll_request_sent = timestamp;                    
+               }
+
                enableHotkeys();
 
                closeInfoBox();
@@ -134,7 +149,6 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
                }
 
                new Ajax.Request(query, {
-                       asynchronous: page_offset == 0,
                        onComplete: function(transport) { 
                                headlines_callback2(transport, feed, is_cat, page_offset); 
                        } });
index 1b26fdff684699183c288033be35af713ce0111e..8f7c27acbaa2f9719480cf701a141e9496548245 100644 (file)
@@ -175,7 +175,8 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
                }
        
                _feed_cur_page = feed_cur_page;
-       
+               _infscroll_request_sent = 0;
+
                notify("");
        } catch (e) {
                exception_error("headlines_callback2", e);