add experimental cooldown after headlines buffer had been manipulated before auto catchup is enabled

only unmark articles which had been processed when automarking
This commit is contained in:
Andrew Dolgov 2013-04-04 09:37:43 +04:00
parent 509626a2ac
commit dfd071e28d

View file

@ -12,6 +12,7 @@ var catchup_timeout_id = false;
var cids_requested = []; var cids_requested = [];
var loaded_article_ids = []; var loaded_article_ids = [];
var _last_headlines_update = 0;
var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null; var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null;
@ -204,6 +205,7 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
} }
_infscroll_request_sent = 0; _infscroll_request_sent = 0;
_last_headlines_update = new Date().getTime() / 1000;
unpackVisibleHeadlines(); unpackVisibleHeadlines();
@ -1159,7 +1161,6 @@ function postMouseOut(id) {
function unpackVisibleHeadlines() { function unpackVisibleHeadlines() {
try { try {
if (!isCdmMode()) return; if (!isCdmMode()) return;
$$("#headlines-frame > div[id*=RROW]").each( $$("#headlines-frame > div[id*=RROW]").each(
@ -1178,7 +1179,6 @@ function unpackVisibleHeadlines() {
} }
); );
} catch (e) { } catch (e) {
exception_error("unpackVisibleHeadlines", e); exception_error("unpackVisibleHeadlines", e);
} }
@ -1209,6 +1209,11 @@ function headlines_scroll_handler(e) {
if (getInitParam("cdm_auto_catchup") == 1) { if (getInitParam("cdm_auto_catchup") == 1) {
// let's get DOM some time to settle down
var ts = new Date().getTime() / 1000;
if (ts - _last_headlines_update < 3) return;
$$("#headlines-frame > div[id*=RROW][class*=Unread]").each( $$("#headlines-frame > div[id*=RROW][class*=Unread]").each(
function(child) { function(child) {
if (child.hasClassName("Unread") && $("headlines-frame").scrollTop > if (child.hasClassName("Unread") && $("headlines-frame").scrollTop >