1 var _feed_cur_page = 0;
2 var _infscroll_disable = 0;
3 var _infscroll_request_sent = 0;
4 var feed_under_pointer = undefined;
6 var mouse_is_down = false;
10 var counter_timeout_id = false;
12 var resize_enabled = false;
13 var selection_disabled = false;
14 var counters_last_request = 0;
16 var feeds_sort_by_unread = false;
17 var feedlist_sortable_enabled = false;
19 function toggle_sortable_feedlist(enabled) {
23 Sortable.create('feedList', {onChange: feedlist_dragsorted, only: "feedCat"});
25 Sortable.destroy('feedList');
29 exception_error("toggle_sortable_feedlist", e);
33 function viewCategory(cat) {
34 viewfeed(cat, '', true);
38 function render_feedlist(data) {
41 var f = $("feeds-frame");
43 // cache_invalidate("FEEDLIST");
44 // cache_inject("FEEDLIST", data, getInitParam("num_feeds"));
48 exception_error("render_feedlist", e);
52 function viewNextFeedPage() {
54 //if (!getActiveFeedId()) return;
56 console.log("viewNextFeedPage: calling viewfeed(), p: " + parseInt(_feed_cur_page+1));
58 viewfeed(getActiveFeedId(), undefined, activeFeedIsCat(), undefined,
59 undefined, parseInt(_feed_cur_page+1));
62 exception_error("viewNextFeedPage", e);
67 function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
69 if (is_cat == undefined) is_cat = false;
71 if (offline_mode) return viewfeed_offline(feed, subop, is_cat, subop_param,
72 skip_history, offset);
74 // if (!offset) page_offset = 0;
76 last_requested_article = 0;
77 //counters_last_request = 0;
79 if (feed == getActiveFeedId()) {
80 cache_invalidate("F:" + feed);
83 /* if (getInitParam("theme") == "" || getInitParam("theme") == "compact") {
84 if (getInitParam("hide_feedlist") == 1) {
85 Element.hide("feeds-holder");
89 var force_nocache = false;
98 _infscroll_disable = 0;
101 if (getActiveFeedId() != feed) {
104 _infscroll_disable = 0;
107 if (page_offset != 0 && !subop) {
108 var date = new Date();
109 var timestamp = Math.round(date.getTime() / 1000);
111 console.log(_infscroll_request_sent + " : " + timestamp);
113 if (_infscroll_request_sent && _infscroll_request_sent + 30 > timestamp) {
114 console.log("infscroll request in progress, aborting");
118 _infscroll_request_sent = timestamp;
125 Form.enable("main_toolbar_form");
127 var toolbar_form = document.forms["main_toolbar_form"];
128 var toolbar_query = Form.serialize("main_toolbar_form");
130 if (toolbar_form.query) {
131 if (toolbar_form.query.value != "") {
132 force_nocache = true;
134 toolbar_form.query.value = "";
137 var query = "?op=viewfeed&feed=" + feed + "&" +
138 toolbar_query + "&subop=" + param_escape(subop);
140 if ($("search_form")) {
141 var search_query = Form.serialize("search_form");
142 query = query + "&" + search_query;
143 $("search_form").query.value = "";
145 force_nocache = true;
148 // console.log("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat);
150 if (subop == "MarkAllRead") {
152 catchup_local_feed(feed, is_cat);
154 var show_next_feed = getInitParam("on_catchup_show_next_feed") == "1";
156 if (show_next_feed) {
158 if (!activeFeedIsCat()) {
160 var feedlist = $('feedList');
162 var next_unread_feed = getRelativeFeedId2(feed, false,
165 /* gRFI2 also returns categories which we don't really
166 * need here, so we skip them */
168 while (next_unread_feed && next_unread_feed.match("CAT:"))
169 next_unread_feed = getRelativeFeedId2(
170 next_unread_feed.replace("CAT:", ""),
173 if (!next_unread_feed) {
174 next_unread_feed = getRelativeFeedId2(-3, true,
178 if (next_unread_feed) {
179 query = query + "&nuf=" + param_escape(next_unread_feed);
180 //setActiveFeedId(next_unread_feed);
181 feed = next_unread_feed;
185 var next_unread_feed = getNextUnreadCat(feed);
187 /* we don't need to specify that our next feed is actually
188 a category, because we're in the is_cat mode by definition
191 if (next_unread_feed && show_next_feed) {
192 query = query + "&nuf=" + param_escape(next_unread_feed);
193 feed = next_unread_feed;
201 query = query + "&cat=1";
204 if (page_offset != 0) {
205 query = query + "&skip=" + page_offset;
207 // to prevent duplicate feed titles when showing grouped vfeeds
208 if (vgroup_last_feed) {
209 query = query + "&vgrlf=" + param_escape(vgroup_last_feed);
213 Form.enable("main_toolbar_form");
215 // for piggybacked counters
217 if (tagsAreDisplayed()) {
218 query = query + "&omode=lt";
220 query = query + "&omode=flc";
225 var container = $("headlinesInnerContainer");
227 /* if (container && page_offset == 0 && !isCdmMode()) {
228 new Effect.Fade(container, {duration: 1, to: 0.01,
229 queue: { position:'end', scope: 'FEEDL-' + feed, limit: 1 } } );
234 if (!is_cat) unread_ctr = get_feed_unread(feed);
236 var cache_check = false;
238 if (unread_ctr != -1 && !page_offset && !force_nocache && !subop) {
240 var cache_prefix = "";
248 cache_check = cache_check_param(cache_prefix + feed, unread_ctr);
249 console.log("headline cache check: " + cache_check);
253 var f = $("headlines-frame");
255 clean_feed_selections();
257 setActiveFeedId(feed, is_cat);
260 var feedr = $("FEEDR-" + feed);
261 if (feedr && !feedr.className.match("Selected")) {
262 feedr.className = feedr.className + "Selected";
265 var feedr = $("FCAT-" + feed_id);
266 if (feedr && !feedr.className.match("Selected")) {
267 feedr.className = feedr.className + "Selected";
271 f.innerHTML = cache_find_param(cache_prefix + feed, unread_ctr);
282 feedr = $('FCAP-' + feed);
284 feedr = $('FEEDR-' + feed);
287 if (feedr && !$('FLL-' + feed)) {
289 var img = $('FIMG-' + feed);
291 if (!is_cat && img) {
293 var cat_list = feedr.parentNode;
295 if (!cat_list || Element.visible(cat_list)) {
296 if (!img.src.match("indicator_white")) {
298 img.src = getInitParam("sign_progress");
300 } else if (cat_list) {
301 feed_cat_id = cat_list.id.replace("FCATLIST-", "");
303 if (!$('FLL-' + feed_cat_id)) {
305 var ll = document.createElement('img');
307 ll.src = getInitParam("sign_progress_tiny");
308 ll.className = 'hlLoading';
309 ll.id = 'FLL-' + feed;
311 $("FCAP-" + feed_cat_id).appendChild(ll);
317 if (!$('FLL-' + feed)) {
318 var ll = document.createElement('img');
320 ll.src = getInitParam("sign_progress_tiny");
321 ll.className = 'hlLoading';
322 ll.id = 'FLL-' + feed;
324 feedr.appendChild(ll);
330 new Ajax.Request("backend.php", {
332 onComplete: function(transport) {
333 headlines_callback2(transport, page_offset);
338 exception_error("viewfeed", e);
342 function toggleCollapseCat_af(effect) {
343 //var caption = elem.id.replace("FCATLIST-", "");
347 var elem = effect.element;
348 var cat = elem.id.replace("FCATLIST-", "");
349 var cap = $("FCAP-" + cat);
351 if (Element.visible(elem)) {
352 cap.innerHTML = cap.innerHTML.replace("…", "");
354 if (cap.innerHTML.lastIndexOf("…") != cap.innerHTML.length-3) {
355 cap.innerHTML = cap.innerHTML + "…";
360 exception_error("toggleCollapseCat_af", e);
364 function toggleCollapseCat(cat) {
367 var cat_elem = $("FCAT-" + cat);
368 var cat_list = $("FCATLIST-" + cat).parentNode;
369 var caption = $("FCAP-" + cat);
371 Effect.toggle('FCATLIST-' + cat, 'blind', { duration: 0.5,
372 afterFinish: toggleCollapseCat_af });
374 var img = cat_elem.getElementsByTagName("IMG")[0];
376 if (img.src.match("-collapse"))
377 img.src = img.src.replace("-collapse", "-uncollapse")
379 img.src = img.src.replace("-uncollapse", "-collapse")
381 new Ajax.Request("backend.php",
382 { parameters: "backend.php?op=feeds&subop=collapse&cid=" +
383 param_escape(cat) } );
385 local_collapse_cat(cat);
388 exception_error("toggleCollapseCat", e);
392 function isCatCollapsed(cat) {
394 return Element.visible("FCATLIST-" + cat);
396 exception_error("isCatCollapsed", e);
400 function feedlist_dragsorted(ctr) {
402 var elem = $("feedList");
404 var cats = elem.getElementsByTagName("LI");
405 var ordered_cats = new Array();
407 for (var i = 0; i < cats.length; i++) {
408 if (cats[i].id && cats[i].id.match("FCAT-")) {
409 ordered_cats.push(cats[i].id.replace("FCAT-", ""));
413 if (ordered_cats.length > 0) {
415 var query = "?op=feeds&subop=catsort&corder=" +
416 param_escape(ordered_cats.toString());
418 //console.log(query);
420 new Ajax.Request("backend.php", { parameters: query });
424 exception_error("feedlist_dragsorted", e);
428 function feedlist_init() {
430 loading_set_progress(90);
432 //console.log("in feedlist init");
434 hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
435 document.onkeydown = hotkey_handler;
436 document.onmousemove = mouse_move_handler;
437 document.onmousedown = mouse_down_handler;
438 document.onmouseup = mouse_up_handler;
440 if (!offline_mode) setTimeout("timeout()", 1);
442 setTimeout("hotkey_prefix_timeout()", 5*1000);
444 if (getActiveFeedId()) {
445 //console.log("some feed is open on feedlist refresh, reloading");
446 //setTimeout("viewCurrentFeed()", 100);
448 if (getInitParam("cdm_auto_catchup") != 1 && get_feed_unread(-3) > 0) {
449 notify_silent_next();
450 setTimeout("viewfeed(-3)", 100);
452 setTimeout("viewfeed(-5)", 100);
457 if (getInitParam("theme") == "" ||
458 getInitParam("theme_options").match("hide_footer")) {
459 setTimeout("hide_footer()", 5000);
462 init_collapsable_feedlist(getInitParam("theme"));
464 toggle_sortable_feedlist(isFeedlistSortable());
467 exception_error("feedlist/init", e);
471 function hide_footer_af(effect) {
473 var c = $("content-frame");
476 c.style.bottom = "0px";
478 var ioa = $("inline_orig_article");
481 ioa.height = c.offsetHeight;
485 var h = $("headlines-frame");
488 h.style.bottom = "0px";
493 exception_error("hide_footer_af", e);
497 function hide_footer() {
499 if (Element.visible("footer")) {
500 new Effect.Fade("footer", { afterFinish: hide_footer_af });
503 exception_error("hide_footer", e);
507 function init_collapsable_feedlist() {
509 //console.log("init_collapsable_feedlist");
511 var theme = getInitParam("theme");
512 var options = getInitParam("theme_options");
514 if (theme != "" && !options.match("collapse_feedlist")) return;
516 var fbtn = $("collapse_feeds_btn");
518 if (fbtn) Element.show(fbtn);
520 if (getInitParam("collapsed_feedlist") == 1) {
525 exception_error("init_hidden_feedlist", e);
530 function mouse_move_handler(e) {
536 client_y = window.event.clientY;
537 client_x = window.event.clientX;
539 client_x = e.screenX;
540 client_y = e.screenY;
545 if (mouse_y == 0) mouse_y = client_y;
546 if (mouse_x == 0) mouse_x = client_x;
548 resize_headlines(mouse_x - client_x, mouse_y - client_y);
557 exception_error("mouse_move_handler", e);
561 function enable_selection(b) {
562 selection_disabled = !b;
565 function enable_resize(b) {
569 function mouse_down_handler(e) {
572 /* do not prevent right click */
573 if (e && e.button && e.button == 2) return;
575 if (resize_enabled) {
576 mouse_is_down = true;
579 document.onselectstart = function() { return false; };
583 if (selection_disabled) {
584 document.onselectstart = function() { return false; };
589 exception_error("mouse_down_handler", e);
593 function mouse_up_handler(e) {
595 mouse_is_down = false;
597 if (!selection_disabled) {
598 document.onselectstart = null;
599 var e = $("headlineActionsBody");
600 if (e) Element.hide(e);
602 var e = $("offlineModeDrop");
603 if (e) Element.hide(e);
608 exception_error("mouse_up_handler", e);
612 function request_counters_real() {
616 if (offline_mode) return;
618 console.log("requesting counters...");
620 var query = "?op=rpc&subop=getAllCounters&seq=" + next_seq();
622 if (tagsAreDisplayed()) {
623 query = query + "&omode=tl";
625 query = query + "&omode=flc";
628 new Ajax.Request("backend.php", {
630 onComplete: function(transport) {
632 handle_rpc_reply(transport);
634 exception_error("viewfeed/getcounters", e);
639 exception_error("request_counters_real", e);
644 function request_counters() {
648 if (getInitParam("bw_limit") == "1") return;
650 var date = new Date();
651 var timestamp = Math.round(date.getTime() / 1000);
653 if (timestamp - counters_last_request > 5) {
654 console.log("scheduling request of counters...");
656 window.clearTimeout(counter_timeout_id);
657 counter_timeout_id = window.setTimeout("request_counters_real()", 1000);
659 counters_last_request = timestamp;
661 console.log("request_counters: rate limit reached: " + (timestamp - counters_last_request));
665 exception_error("request_counters", e);
669 function displayNewContentPrompt(id) {
672 var msg = "<a href='#' onclick='viewfeed("+id+")'>" +
673 __("New articles available in this feed (click to show)") + "</a>";
675 msg = msg.replace("%s", getFeedName(id));
677 $('auxDlg').innerHTML = msg;
679 new Effect.Appear('auxDlg', {duration : 0.5});
682 exception_error("displayNewContentPrompt", e);
686 function parse_counters(reply, scheduled_call) {
691 var elems = JSON.parse(reply.firstChild.nodeValue);
693 for (var l = 0; l < elems.length; l++) {
696 var kind = elems[l].kind;
697 var ctr = parseInt(elems[l].counter)
698 var error = elems[l].error;
699 var has_img = elems[l].has_img;
700 var updated = elems[l].updated;
701 var title = elems[l].title;
702 var xmsg = elems[l].xmsg;
704 if (id == "global-unread") {
706 if (ctr > global_unread) {
707 offlineDownloadStart(1);
715 if (id == "subscribed-feeds") {
720 if (kind && kind == "cat") {
721 var catctr = $("FCATCTR-" + id);
723 catctr.innerHTML = "(" + ctr + ")";
725 catctr.className = "catCtrHasUnread";
727 catctr.className = "catCtrNoUnread";
733 var feedctr = $("FEEDCTR-" + id);
734 var feedu = $("FEEDU-" + id);
735 var feedr = $("FEEDR-" + id);
736 var feed_img = $("FIMG-" + id);
737 var feedlink = $("FEEDL-" + id);
738 var feedupd = $("FLUPD-" + id);
740 if (updated && feedlink) {
742 feedlink.title = "Error: " + error + " (" + updated + ")";
744 feedlink.title = "Updated: " + updated;
749 if (!updated) updated = "";
753 feedupd.innerHTML = updated + " " + xmsg + " (Error)";
755 feedupd.innerHTML = updated + " (Error)";
759 feedupd.innerHTML = updated + " (" + xmsg + ")";
761 feedupd.innerHTML = updated;
766 if (has_img && feed_img) {
767 if (!feed_img.src.match(id + ".ico")) {
768 feed_img.src = getInitParam("icons_url") + "/" + id + ".ico";
772 if (feedlink && title) {
773 feedlink.innerHTML = title;
776 if (feedctr && feedu && feedr) {
778 // if (id == getActiveFeedId())
779 // console.log("HAS CTR: " + feedu.innerHTML + " GOT CTR: " + ctr +
780 // " IS_SCHED: " + scheduled_call);
782 if (parseInt(ctr) > 0 &&
783 parseInt(feedu.innerHTML) < parseInt(ctr) &&
784 id == getActiveFeedId() && scheduled_call) {
786 displayNewContentPrompt(id);
789 var row_needs_hl = (ctr > 0 && ctr > parseInt(feedu.innerHTML));
791 feedu.innerHTML = ctr;
794 feedr.className = feedr.className.replace("feed", "error");
796 feedr.className = feedr.className.replace("error", "feed");
800 feedctr.className = "feedCtrHasUnread";
801 if (!feedr.className.match("Unread")) {
802 var is_selected = feedr.className.match("Selected");
804 feedr.className = feedr.className.replace("Selected", "");
805 feedr.className = feedr.className.replace("Unread", "");
807 feedr.className = feedr.className + "Unread";
810 feedr.className = feedr.className + "Selected";
816 !getInitParam("theme_options").match('no_highlights')) {
817 new Effect.Highlight(feedr, {duration: 1, startcolor: "#fff7d5",
818 queue: { position:'end', scope: 'EFQ-' + id, limit: 1 } } );
820 cache_invalidate("F:" + id);
823 feedctr.className = "feedCtrNoUnread";
824 feedr.className = feedr.className.replace("Unread", "");
829 hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
831 var feeds_stored = number_of_feeds;
833 //console.log("Feed counters, C: " + feeds_found + ", S:" + feeds_stored);
835 if (feeds_stored != feeds_found) {
836 number_of_feeds = feeds_found;
838 if (feeds_stored != 0 && feeds_found != 0) {
839 console.log("Subscribed feed number changed, refreshing feedlist");
840 setTimeout('updateFeedList(false, false)', 50);
843 /* var fl = $("feeds-frame").innerHTML;
845 cache_invalidate("FEEDLIST");
846 cache_inject("FEEDLIST", fl, getInitParam("num_feeds"));
851 exception_error("parse_counters", e);
855 function get_feed_unread(id) {
857 return parseInt($("FEEDU-" + id).innerHTML);
863 function get_cat_unread(id) {
865 var ctr = $("FCATCTR-" + id).innerHTML;
866 ctr = ctr.replace("(", "");
867 ctr = ctr.replace(")", "");
868 return parseInt(ctr);
874 function get_feed_entry_unread(elem) {
876 var id = elem.id.replace("FEEDR-", "");
883 return parseInt($("FEEDU-" + id).innerHTML);
889 function get_feed_entry_name(elem) {
890 var id = elem.id.replace("FEEDR-", "");
891 return getFeedName(id);
895 function resort_category(node, cat_mode) {
899 console.log("resort_category: " + node + " CM=" + cat_mode);
901 var by_unread = feedsSortByUnread();
903 var list = node.getElementsByTagName("LI");
905 for (i = 0; i < list.length; i++) {
907 for (j = i+1; j < list.length; j++) {
909 var tmp_val = get_feed_entry_unread(list[i]);
910 var cur_val = get_feed_entry_unread(list[j]);
912 var tmp_name = get_feed_entry_name(list[i]);
913 var cur_name = get_feed_entry_name(list[j]);
915 /* we don't want to match FEEDR-0 - e.g. Archived articles */
917 var valid_pair = cat_mode || (list[i].id.match(/FEEDR-[1-9]/) &&
918 list[j].id.match(/FEEDR-[1-9]/));
920 if (valid_pair && ((by_unread && (cur_val > tmp_val)) || (!by_unread && (cur_name < tmp_name)))) {
921 tempnode_i = list[i].cloneNode(true);
922 tempnode_j = list[j].cloneNode(true);
923 node.replaceChild(tempnode_i, list[j]);
924 node.replaceChild(tempnode_j, list[i]);
930 exception_error("resort_category", e);
935 function resort_feedlist() {
936 console.log("resort_feedlist");
938 if ($("FCATLIST--1")) {
940 var lists = document.getElementsByTagName("UL");
942 for (var i = 0; i < lists.length; i++) {
943 if (lists[i].id && lists[i].id.match("FCATLIST-")) {
944 resort_category(lists[i], true);
949 resort_category($("feedList"), false);
953 function hideOrShowFeeds(hide) {
957 //console.log("hideOrShowFeeds: " + hide);
959 if ($("FCATLIST--1")) {
961 var lists = document.getElementsByTagName("UL");
963 for (var i = 0; i < lists.length; i++) {
964 if (lists[i].id && lists[i].id.match("FCATLIST-")) {
966 var id = lists[i].id.replace("FCATLIST-", "");
967 hideOrShowFeedsCategory(id, hide);
972 hideOrShowFeedsCategory(null, hide);
976 exception_error("hideOrShowFeeds", e);
980 function hideOrShowFeedsCategory(id, hide) {
988 node = $("FCATLIST-" + id);
989 cat_node = $("FCAT-" + id);
991 node = $("feedList"); // no categories
994 // console.log("hideOrShowFeedsCategory: " + node + " (" + hide + ")");
999 console.warn("hideOrShowFeeds: passed node is null, aborting");
1003 // console.log("cat: " + node.id);
1005 if (node.hasChildNodes() && node.firstChild.nextSibling != false) {
1006 for (i = 0; i < node.childNodes.length; i++) {
1007 if (node.childNodes[i].nodeName != "LI") { continue; }
1009 if (node.childNodes[i].style != undefined) {
1011 var has_unread = (node.childNodes[i].className != "feed" &&
1012 node.childNodes[i].className != "label" &&
1013 !(!getInitParam("hide_read_shows_special") &&
1014 node.childNodes[i].className == "virt") &&
1015 node.childNodes[i].className != "error" &&
1016 node.childNodes[i].className != "tag");
1018 var has_error = node.childNodes[i].className.match("error");
1020 // console.log(node.childNodes[i].id + " --> " + has_unread);
1022 if (hide && !has_unread) {
1023 var id = node.childNodes[i].id;
1024 Effect.Fade(node.childNodes[i], {duration : 0.3,
1025 queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }});
1029 Element.show(node.childNodes[i]);
1033 Element.show(node.childNodes[i]);
1037 //if (has_error) Element.hide(node.childNodes[i]);
1042 // console.log("end cat: " + node.id + " unread " + cat_unread);
1046 if (cat_unread == 0) {
1047 if (cat_node.style == undefined) {
1048 console.log("ERROR: supplied cat_node " + cat_node +
1049 " has no styles. WTF?");
1053 //cat_node.style.display = "none";
1054 Effect.Fade(cat_node, {duration : 0.3,
1055 queue: { position: 'end', scope: 'CFADE-' + node.id, limit: 1 }});
1057 cat_node.style.display = "list-item";
1061 cat_node.style.display = "list-item";
1068 // console.log("unread for category: " + cat_unread);
1071 exception_error("hideOrShowFeedsCategory", e);
1075 function getFeedName(id, is_cat) {
1079 e = $("FCATN-" + id);
1081 e = $("FEEDN-" + id);
1084 return e.innerHTML.stripTags();
1090 function getNextUnreadCat(id) {
1092 var rows = $("feedList").getElementsByTagName("LI");
1093 var feeds = new Array();
1095 var unread_only = true;
1098 for (var i = 0; i < rows.length; i++) {
1099 if (rows[i].id.match("FCAT-")) {
1100 if (rows[i].id == "FCAT-" + id && is_cat || (Element.visible(rows[i]) && Element.visible(rows[i].parentNode))) {
1102 var cat_id = parseInt(rows[i].id.replace("FCAT-", ""));
1105 if (!unread_only || get_cat_unread(cat_id) > 0) {
1113 var idx = feeds.indexOf(id);
1114 if (idx != -1 && idx < feeds.length) {
1115 return feeds[idx+1];
1117 return feeds.shift();
1121 exception_error("getNextUnreadCat", e);
1125 function getRelativeFeedId2(id, is_cat, direction, unread_only) {
1128 // alert(id + " IC: " + is_cat + " D: " + direction + " U: " + unread_only);
1130 var rows = $("feedList").getElementsByTagName("LI");
1131 var feeds = new Array();
1133 for (var i = 0; i < rows.length; i++) {
1134 if (rows[i].id.match("FEEDR-")) {
1136 if (rows[i].id == "FEEDR-" + id && !is_cat || (Element.visible(rows[i]) && Element.visible(rows[i].parentNode))) {
1139 (rows[i].className.match("Unread") || rows[i].id == "FEEDR-" + id)) {
1140 feeds.push(rows[i].id.replace("FEEDR-", ""));
1145 if (rows[i].id.match("FCAT-")) {
1146 if (rows[i].id == "FCAT-" + id && is_cat || (Element.visible(rows[i]) && Element.visible(rows[i].parentNode))) {
1148 var cat_id = parseInt(rows[i].id.replace("FCAT-", ""));
1151 if (!unread_only || get_cat_unread(cat_id) > 0) {
1152 feeds.push("CAT:"+cat_id);
1159 // alert(feeds.toString());
1162 if (direction == "next") {
1163 return feeds.shift();
1168 if (direction == "next") {
1169 if (is_cat) id = "CAT:" + id;
1170 var idx = feeds.indexOf(id);
1171 if (idx != -1 && idx < feeds.length) {
1172 return feeds[idx+1];
1174 return getRelativeFeedId2(false, is_cat, direction, unread_only);
1177 if (is_cat) id = "CAT:" + id;
1178 var idx = feeds.indexOf(id);
1180 return feeds[idx-1];
1182 return getRelativeFeedId2(false, is_cat, direction, unread_only);
1189 exception_error("getRelativeFeedId2", e);
1193 function clean_feed_selections() {
1195 var feeds = $("feedList").getElementsByTagName("LI");
1197 for (var i = 0; i < feeds.length; i++) {
1198 if (feeds[i].id && feeds[i].id.match("FEEDR-")) {
1199 feeds[i].className = feeds[i].className.replace("Selected", "");
1201 if (feeds[i].id && feeds[i].id.match("FCAT-")) {
1202 feeds[i].className = feeds[i].className.replace("Selected", "");
1206 exception_error("clean_feed_selections", e);
1210 function feedsSortByUnread() {
1211 return feeds_sort_by_unread;