assorted fixes for keyboard navigation which hopefully don't break everything else

This commit is contained in:
Andrew Dolgov 2015-08-11 10:06:30 +03:00
parent 209ebdc644
commit 8292123ebc
2 changed files with 24 additions and 13 deletions

View file

@ -1,6 +1,5 @@
var _infscroll_disable = 0;
var _infscroll_request_sent = 0;
var _infscroll_tmp_disable = 0;
var _search_query = false;
var _viewfeed_last = 0;
@ -15,9 +14,7 @@ function viewCategory(cat) {
function loadMoreHeadlines() {
try {
console.log("loadMoreHeadlines: " + _infscroll_tmp_disable);
if (_infscroll_tmp_disable) return;
console.log("loadMoreHeadlines");
var offset = 0;

View file

@ -15,6 +15,8 @@ var loaded_article_ids = [];
var _last_headlines_update = 0;
var current_first_id = 0;
var _catchup_request_sent = false;
var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null;
function headlines_callback2(transport, offset, background, infscroll_req) {
@ -1319,11 +1321,17 @@ function headlines_scroll_handler(e) {
window.clearTimeout(catchup_timeout_id);
if (!_infscroll_request_sent) {
if (catchup_id_batch.length < 10) {
catchup_timeout_id = window.setTimeout('catchupBatchedArticles()',
500);
} else {
catchupBatchedArticles();
}
}
catchupBatchedArticles();
}
if (_infscroll_disable) {
var child = $$("#headlines-frame div[id*=RROW]").last();
@ -1356,7 +1364,7 @@ function openNextUnreadFeed() {
function catchupBatchedArticles() {
try {
if (catchup_id_batch.length > 0 && !_infscroll_request_sent) {
if (catchup_id_batch.length > 0 && !_infscroll_request_sent && !_catchup_request_sent) {
// make a copy of the array
var batch = catchup_id_batch.slice();
@ -1365,16 +1373,18 @@ function catchupBatchedArticles() {
console.log(query);
_catchup_request_sent = true;
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
handle_rpc_json(transport);
_catchup_request_sent = false;
reply = JSON.parse(transport.responseText);
var batch = reply.ids;
_infscroll_tmp_disable = 1;
batch.each(function(id) {
console.log(id);
var elem = $("RROW-" + id);
@ -1382,8 +1392,6 @@ function catchupBatchedArticles() {
catchup_id_batch.remove(id);
});
_infscroll_tmp_disable = 0;
updateFloatingTitle(true);
} });
@ -1509,6 +1517,8 @@ function cdmCollapseArticle(event, id, unmark) {
function cdmExpandArticle(id, noexpand) {
try {
if (getInitParam("cdm_expanded")) return;
console.log("cdmExpandArticle " + id);
if (!$("RROW-" + id)) return false;
@ -1563,6 +1573,7 @@ function cdmExpandArticle(id, noexpand) {
if (!noexpand)
toggleUnread(id, 0, true);
toggleSelected(id);
$("RROW-" + id).addClassName("active");
@ -1702,8 +1713,11 @@ function dismissReadArticles() {
}
}
// we don't really hide rows anymore
function getVisibleArticleIds() {
var ids = [];
return getLoadedArticleIds();
/*var ids = [];
try {
@ -1717,7 +1731,7 @@ function getVisibleArticleIds() {
exception_error("getVisibleArticleIds", e);
}
return ids;
return ids; */
}
function cdmClicked(event, id) {