only precache_headlines_idle() when actually idle
This commit is contained in:
parent
3ea91b2d18
commit
4d5eed551f
|
@ -1,6 +1,7 @@
|
||||||
var _infscroll_disable = 0;
|
var _infscroll_disable = 0;
|
||||||
var _infscroll_request_sent = 0;
|
var _infscroll_request_sent = 0;
|
||||||
var _search_query = false;
|
var _search_query = false;
|
||||||
|
var _viewfeed_last = 0;
|
||||||
|
|
||||||
var counter_timeout_id = false;
|
var counter_timeout_id = false;
|
||||||
|
|
||||||
|
@ -106,6 +107,8 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req) {
|
||||||
dijit.byId("content-tabs").getChildren()[0]);
|
dijit.byId("content-tabs").getChildren()[0]);
|
||||||
|
|
||||||
if (!background) {
|
if (!background) {
|
||||||
|
_viewfeed_last = get_timestamp();
|
||||||
|
|
||||||
if (getActiveFeedId() != feed || offset == 0) {
|
if (getActiveFeedId() != feed || offset == 0) {
|
||||||
active_post_id = 0;
|
active_post_id = 0;
|
||||||
_infscroll_disable = 0;
|
_infscroll_disable = 0;
|
||||||
|
@ -121,8 +124,7 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset != 0 && !method) {
|
if (offset != 0 && !method) {
|
||||||
var date = new Date();
|
var timestamp = get_timestamp();
|
||||||
var timestamp = Math.round(date.getTime() / 1000);
|
|
||||||
|
|
||||||
if (_infscroll_request_sent && _infscroll_request_sent + 30 > timestamp) {
|
if (_infscroll_request_sent && _infscroll_request_sent + 30 > timestamp) {
|
||||||
//console.log("infscroll request in progress, aborting");
|
//console.log("infscroll request in progress, aborting");
|
||||||
|
|
|
@ -393,20 +393,6 @@ function getURLParam(param){
|
||||||
return String(window.location.href).parseQuery()[param];
|
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) {
|
function closeInfoBox(cleanup) {
|
||||||
try {
|
try {
|
||||||
dialog = dijit.byId("infoBox");
|
dialog = dijit.byId("infoBox");
|
||||||
|
@ -1718,3 +1704,8 @@ function get_radio_checked(radioObj) {
|
||||||
}
|
}
|
||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_timestamp() {
|
||||||
|
var date = new Date();
|
||||||
|
return Math.round(date.getTime() / 1000);
|
||||||
|
}
|
||||||
|
|
|
@ -2057,6 +2057,8 @@ function render_local_headlines(feed, is_cat, obj) {
|
||||||
function precache_headlines_idle() {
|
function precache_headlines_idle() {
|
||||||
try {
|
try {
|
||||||
if (!feed_precache_timeout_id) {
|
if (!feed_precache_timeout_id) {
|
||||||
|
if (get_timestamp() - _viewfeed_last > 120) {
|
||||||
|
|
||||||
var feeds = dijit.byId("feedTree").getVisibleUnreadFeeds();
|
var feeds = dijit.byId("feedTree").getVisibleUnreadFeeds();
|
||||||
var uncached = [];
|
var uncached = [];
|
||||||
|
|
||||||
|
@ -2070,6 +2072,7 @@ function precache_headlines_idle() {
|
||||||
viewfeed(rf[0], '', rf[1], 0, true);
|
viewfeed(rf[0], '', rf[1], 0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
precache_idle_timeout_id = setTimeout("precache_headlines_idle()", 1000*30);
|
precache_idle_timeout_id = setTimeout("precache_headlines_idle()", 1000*30);
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue