- console.warn("headlines_scroll_handler: " + e);
- }
-}
-
-function openNextUnreadFeed() {
- try {
- var is_cat = activeFeedIsCat();
- var nuf = getNextUnreadFeed(getActiveFeedId(), is_cat);
- if (nuf) viewfeed({feed: nuf, is_cat: is_cat});
- } catch (e) {
- exception_error("openNextUnreadFeed", e);
- }
-}
-
-function catchupBatchedArticles() {
- try {
- if (catchup_id_batch.length > 0 && !_infscroll_request_sent && !_catchup_request_sent) {
-
- console.log("catchupBatchedArticles: working");
-
- // make a copy of the array
- var batch = catchup_id_batch.slice();
- var query = "?op=rpc&method=catchupSelected" +
- "&cmode=0&ids=" + param_escape(batch.toString());
-
- 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;
-
- batch.each(function(id) {
- console.log(id);
- var elem = $("RROW-" + id);
- if (elem) elem.removeClassName("Unread");
- catchup_id_batch.remove(id);
- });
-
- updateFloatingTitle(true);
-
- } });
- }
-
- } catch (e) {
- exception_error("catchupBatchedArticles", e);
- }
-}
-
-function catchupRelativeToArticle(below, id) {
-
- try {
-
- if (!id) id = getActiveArticleId();
-
- if (!id) {
- alert(__("No article is selected."));
- return;
- }
-
- var visible_ids = getLoadedArticleIds();
-
- var ids_to_mark = new Array();
-
- if (!below) {
- for (var i = 0; i < visible_ids.length; i++) {
- if (visible_ids[i] != id) {
- var e = $("RROW-" + visible_ids[i]);
-
- if (e && e.hasClassName("Unread")) {
- ids_to_mark.push(visible_ids[i]);
- }
- } else {
- break;
- }
- }
- } else {
- for (var i = visible_ids.length-1; i >= 0; i--) {
- if (visible_ids[i] != id) {
- var e = $("RROW-" + visible_ids[i]);
-
- if (e && e.hasClassName("Unread")) {
- ids_to_mark.push(visible_ids[i]);
- }
- } else {
- break;
- }
- }
- }
-
- if (ids_to_mark.length == 0) {
- alert(__("No articles found to mark"));
- } else {
- var msg = ngettext("Mark %d article as read?", "Mark %d articles as read?", ids_to_mark.length).replace("%d", ids_to_mark.length);
-
- if (getInitParam("confirm_feed_catchup") != 1 || confirm(msg)) {
-
- for (var i = 0; i < ids_to_mark.length; i++) {
- var e = $("RROW-" + ids_to_mark[i]);
- e.removeClassName("Unread");
- }
-
- var query = "?op=rpc&method=catchupSelected" +
- "&cmode=0" + "&ids=" + param_escape(ids_to_mark.toString());
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function(transport) {
- handle_rpc_json(transport);
- } });
-
- }
- }
-
- } catch (e) {
- exception_error("catchupRelativeToArticle", e);
- }
-}
-
-function cdmCollapseArticle(event, id, unmark) {
- try {
- if (unmark == undefined) unmark = true;
-
- var row = $("RROW-" + id);
- var elem = $("CICD-" + id);
-
- if (elem && row) {
- var collapse = $$("div#RROW-" + id +
- " span[class='collapseBtn']")[0];
-
- Element.hide(elem);
- Element.show("CEXC-" + id);
- Element.hide(collapse);
-
- if (unmark) {
- row.removeClassName("active");
-
- markHeadline(id, false);
-
- if (id == getActiveArticleId()) {
- setActiveArticleId(0);
- }
-
- updateSelectedPrompt();
- }
-
- if (event) Event.stop(event);
-
- PluginHost.run(PluginHost.HOOK_ARTICLE_COLLAPSED, id);
-
- if (row.offsetTop < $("headlines-frame").scrollTop)
- scrollToRowId(row.id);
-
- $("floatingTitle").style.visibility = "hidden";
- $("floatingTitle").setAttribute("data-article-id", 0);
- }
-
- } catch (e) {
- exception_error("cdmCollapseArticle", e);