From: Andrew Dolgov Date: Tue, 15 May 2007 06:19:48 +0000 (+0100) Subject: prefetch old articles when necessary X-Git-Tag: schema_freeze_for_1.2.11~51 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=addb5836949e27cd89f5a9254a33b3ad41982843;p=tt-rss.git prefetch old articles when necessary --- diff --git a/backend.php b/backend.php index b04b2619..f83b71d5 100644 --- a/backend.php +++ b/backend.php @@ -155,9 +155,9 @@ // in prefetch mode we only output requested cids, main article // just gets marked as read (it already exists in client cache) - if ($mode != "prefetch") { + if ($mode == "") { outputArticleXML($link, $id, $feed_id); - } else { + } else if ($mode == "prefetch") { catchupArticleById($link, $id, 0); } @@ -167,9 +167,11 @@ } } - print ""; - getAllCounters($link, $omode); - print ""; + if ($mode != "prefetch_old") { + print ""; + getAllCounters($link, $omode); + print ""; + } print ""; } diff --git a/tt-rss.js b/tt-rss.js index d22aa1fb..861c9abb 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -50,7 +50,7 @@ function dlg_frefresh_callback() { if (getActiveFeedId() == _qfd_deleted_feed) { var h = document.getElementById("headlines-frame"); if (h) { - h.innerHTML = "
No feed selected.
"; + h.innerHTML = "
" + __('No feed selected.') + "
"; } } diff --git a/viewfeed.js b/viewfeed.js index 91b04268..f6078351 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -50,11 +50,12 @@ function headlines_callback() { if (counters) { debug("parsing piggybacked counters: " + counters); parse_counters(counters, false); + } else { + debug("counters container not found in reply"); } } else { debug("headlines_callback: returned no XML object"); - f.innerHTML = xmlhttp.responseText; - update_all_counters(); + f.innerHTML = "
" + __('Could not update headlines (missing XML object)') + "
"; } if (typeof correctPNG != 'undefined') { @@ -122,6 +123,7 @@ function article_callback() { } else { debug("article_callback: returned no XML object"); + f.innerHTML = "
" + __('Could not display article (missing XML object)') + "
"; } } catch (e) { exception_error("article_callback", e); @@ -144,7 +146,7 @@ function article_callback() { debug("parsing piggybacked counters: " + counters); parse_counters(counters, false); } else { - update_all_counters(); + debug("counters container not found in reply"); } } @@ -253,6 +255,14 @@ function view(id, feed_id, skip_history) { } else if (cached_article) { + query = query + "&mode=prefetch_old"; + + debug(query); + + xmlhttp.open("GET", query, true); + xmlhttp.onreadystatechange=article_callback; + xmlhttp.send(null); + render_article(cached_article); }