var _infscroll_disable = 0;
var _infscroll_request_sent = 0;
var _search_query = false;
+var _viewfeed_last = 0;
var counter_timeout_id = false;
dijit.byId("content-tabs").getChildren()[0]);
if (!background) {
+ _viewfeed_last = get_timestamp();
+
if (getActiveFeedId() != feed || offset == 0) {
active_post_id = 0;
_infscroll_disable = 0;
}
if (offset != 0 && !method) {
- var date = new Date();
- var timestamp = Math.round(date.getTime() / 1000);
+ var timestamp = get_timestamp();
if (_infscroll_request_sent && _infscroll_request_sent + 30 > timestamp) {
//console.log("infscroll request in progress, aborting");
return String(window.location.href).parseQuery()[param];
}
-function leading_zero(p) {
- var s = String(p);
- if (s.length == 1) s = "0" + s;
- return s;
-}
-
-function make_timestamp() {
- var d = new Date();
-
- return leading_zero(d.getHours()) + ":" + leading_zero(d.getMinutes()) +
- ":" + leading_zero(d.getSeconds());
-}
-
-
function closeInfoBox(cleanup) {
try {
dialog = dijit.byId("infoBox");
}
return("");
}
+
+function get_timestamp() {
+ var date = new Date();
+ return Math.round(date.getTime() / 1000);
+}
function precache_headlines_idle() {
try {
if (!feed_precache_timeout_id) {
- var feeds = dijit.byId("feedTree").getVisibleUnreadFeeds();
- var uncached = [];
+ if (get_timestamp() - _viewfeed_last > 120) {
- feeds.each(function(item) {
- if (parseInt(item[0]) > 0 && !cache_get("feed:" + item[0] + ":" + item[1]))
- uncached.push(item);
- });
+ var feeds = dijit.byId("feedTree").getVisibleUnreadFeeds();
+ var uncached = [];
+
+ feeds.each(function(item) {
+ if (parseInt(item[0]) > 0 && !cache_get("feed:" + item[0] + ":" + item[1]))
+ uncached.push(item);
+ });
- if (uncached.length > 0) {
- var rf = uncached[Math.floor(Math.random()*uncached.length)];
- viewfeed(rf[0], '', rf[1], 0, true);
+ if (uncached.length > 0) {
+ var rf = uncached[Math.floor(Math.random()*uncached.length)];
+ viewfeed(rf[0], '', rf[1], 0, true);
+ }
}
}
precache_idle_timeout_id = setTimeout("precache_headlines_idle()", 1000*30);