return false;
}
+function render_feedlist(data) {
+ try {
+
+ var f = document.getElementById("feeds-frame");
+ f.innerHTML = data;
+ cache_invalidate("FEEDLIST");
+ cache_inject("FEEDLIST", data);
+ feedlist_init();
+
+ } catch (e) {
+ exception_error("render_feedlist", e);
+ }
+}
+
function feedlist_callback2(transport) {
try {
debug("feedlist_callback2");
if (!transport_error_check(transport)) return;
- var f = document.getElementById("feeds-frame");
- f.innerHTML = transport.responseText;
- feedlist_init();
+ render_feedlist(transport.responseText);
} catch (e) {
exception_error("feedlist_callback2", e);
}
f.innerHTML = cache_find_param(cache_prefix + feed, unread_ctr);
request_counters();
+ remove_splash();
} else {
daemon_refresh_only = getInitParam("daemon_refresh_only") == 1;
feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
- setTimeout('updateFeedList(false, false)', 50);
+ var fl = cache_find("FEEDLIST");
+
+ if (fl) {
+ render_feedlist(fl);
+ request_counters();
+ } else {
+ setTimeout('updateFeedList(false, false)', 50);
+ }
debug("second stage ok");
db.execute("CREATE TABLE IF NOT EXISTS cache (id text, article text, param text, added text)");
}
+
+ cache_expire();
} catch (e) {
exception_error("init_gears", e);
function cache_find(id) {
if (db) {
+ var rs = db.execute("SELECT article FROM cache WHERE id = ?", [id]);
+
+ if (rs.isValidRow()) {
+ return rs.field(0);
+ }
} else {
for (var i = 0; i < article_cache.length; i++) {
}
function cache_expire() {
- if (!db) {
+ if (db) {
+ var date = new Date();
+ var ts = Math.round(date.getTime() / 1000);
+
+ db.execute("DELETE FROM cache WHERE added < ? - 600", [ts]);
+
+ } else {
while (article_cache.length > 25) {
article_cache.shift();
}