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(), '', activeFeedIsCat(), parseInt(_feed_cur_page+1));
61 exception_error("viewNextFeedPage", e);
66 function viewfeed(feed, subop, is_cat, offset) {
68 if (is_cat == undefined) is_cat = false;
70 if (offline_mode) return viewfeed_offline(feed, subop, is_cat, offset);
72 // if (!offset) page_offset = 0;
74 last_requested_article = 0;
75 //counters_last_request = 0;
77 if (feed == getActiveFeedId()) {
78 cache_invalidate("F:" + feed);
81 /* if (getInitParam("theme") == "" || getInitParam("theme") == "compact") {
82 if (getInitParam("hide_feedlist") == 1) {
83 Element.hide("feeds-holder");
87 var force_nocache = false;
96 _infscroll_disable = 0;
99 if (getActiveFeedId() != feed) {
102 _infscroll_disable = 0;
105 if (page_offset != 0 && !subop) {
106 var date = new Date();
107 var timestamp = Math.round(date.getTime() / 1000);
109 console.log(_infscroll_request_sent + " : " + timestamp);
111 if (_infscroll_request_sent && _infscroll_request_sent + 30 > timestamp) {
112 console.log("infscroll request in progress, aborting");
116 _infscroll_request_sent = timestamp;
123 Form.enable("main_toolbar_form");
125 var toolbar_form = document.forms["main_toolbar_form"];
126 var toolbar_query = Form.serialize("main_toolbar_form");
128 if (toolbar_form.query) {
129 if (toolbar_form.query.value != "") {
130 force_nocache = true;
132 toolbar_form.query.value = "";
135 var query = "?op=viewfeed&feed=" + feed + "&" +
136 toolbar_query + "&subop=" + param_escape(subop);
138 if ($("search_form")) {
139 var search_query = Form.serialize("search_form");
140 query = query + "&" + search_query;
141 $("search_form").query.value = "";
143 force_nocache = true;
146 // console.log("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat);
148 if (subop == "MarkAllRead") {
150 catchup_local_feed(feed, is_cat);
152 var show_next_feed = getInitParam("on_catchup_show_next_feed") == "1";
154 if (show_next_feed) {
156 if (!activeFeedIsCat()) {
158 var feedlist = $('feedList');
160 var next_unread_feed = getRelativeFeedId2(feed, false,
163 /* gRFI2 also returns categories which we don't really
164 * need here, so we skip them */
166 while (next_unread_feed && next_unread_feed.match("CAT:"))
167 next_unread_feed = getRelativeFeedId2(
168 next_unread_feed.replace("CAT:", ""),
171 if (!next_unread_feed) {
172 next_unread_feed = getRelativeFeedId2(-3, true,
176 if (next_unread_feed) {
177 query = query + "&nuf=" + param_escape(next_unread_feed);
178 //setActiveFeedId(next_unread_feed);
179 feed = next_unread_feed;
183 var next_unread_feed = getNextUnreadCat(feed);
185 /* we don't need to specify that our next feed is actually
186 a category, because we're in the is_cat mode by definition
189 if (next_unread_feed && show_next_feed) {
190 query = query + "&nuf=" + param_escape(next_unread_feed);
191 feed = next_unread_feed;
199 query = query + "&cat=1";
202 if (page_offset != 0) {
203 query = query + "&skip=" + page_offset;
205 // to prevent duplicate feed titles when showing grouped vfeeds
206 if (vgroup_last_feed) {
207 query = query + "&vgrlf=" + param_escape(vgroup_last_feed);
211 Form.enable("main_toolbar_form");
215 var container = $("headlinesInnerContainer");
219 if (!is_cat) unread_ctr = get_feed_unread(feed);
221 var cache_check = false;
223 if (unread_ctr != -1 && !page_offset && !force_nocache && !subop) {
225 var cache_prefix = "";
233 cache_check = cache_check_param(cache_prefix + feed, unread_ctr);
234 console.log("headline cache check: " + cache_check);
238 var f = $("headlines-frame");
240 clean_feed_selections();
242 setActiveFeedId(feed, is_cat);
245 var feedr = $("FEEDR-" + feed);
246 if (feedr && !feedr.className.match("Selected")) {
247 feedr.className = feedr.className + "Selected";
250 var feedr = $("FCAT-" + feed_id);
251 if (feedr && !feedr.className.match("Selected")) {
252 feedr.className = feedr.className + "Selected";
256 f.innerHTML = cache_find_param(cache_prefix + feed, unread_ctr);
263 // if (!page_offset) {
267 feedr = $('FCAP-' + feed);
269 feedr = $('FEEDR-' + feed);
272 if (feedr && !$('FLL-' + feed)) {
274 var img = $('FIMG-' + feed);
276 if (!is_cat && img) {
278 var cat_list = feedr.parentNode;
280 if (!cat_list || Element.visible(cat_list)) {
281 if (!img.src.match("indicator_white")) {
283 img.src = getInitParam("sign_progress");
285 } else if (cat_list) {
286 feed_cat_id = cat_list.id.replace("FCATLIST-", "");
288 if (!$('FLL-' + feed_cat_id)) {
290 var ll = document.createElement('img');
292 ll.src = getInitParam("sign_progress_tiny");
293 ll.className = 'hlLoading';
294 ll.id = 'FLL-' + feed;
296 $("FCAP-" + feed_cat_id).appendChild(ll);
302 if (!$('FLL-' + feed)) {
303 var ll = document.createElement('img');
305 ll.src = getInitParam("sign_progress_tiny");
306 ll.className = 'hlLoading';
307 ll.id = 'FLL-' + feed;
309 feedr.appendChild(ll);
315 new Ajax.Request("backend.php", {
317 onComplete: function(transport) {
318 headlines_callback2(transport, page_offset);
323 exception_error("viewfeed", e);
327 function toggleCollapseCat_af(effect) {
328 //var caption = elem.id.replace("FCATLIST-", "");
332 var elem = effect.element;
333 var cat = elem.id.replace("FCATLIST-", "");
334 var cap = $("FCAP-" + cat);
336 if (Element.visible(elem)) {
337 cap.innerHTML = cap.innerHTML.replace("…", "");
339 if (cap.innerHTML.lastIndexOf("…") != cap.innerHTML.length-3) {
340 cap.innerHTML = cap.innerHTML + "…";
345 exception_error("toggleCollapseCat_af", e);
349 function toggleCollapseCat(cat) {
352 var cat_elem = $("FCAT-" + cat);
353 var cat_list = $("FCATLIST-" + cat).parentNode;
354 var caption = $("FCAP-" + cat);
356 Effect.toggle('FCATLIST-' + cat, 'blind', { duration: 0.5,
357 afterFinish: toggleCollapseCat_af });
359 var img = cat_elem.getElementsByTagName("IMG")[0];
361 if (img.src.match("-collapse"))
362 img.src = img.src.replace("-collapse", "-uncollapse")
364 img.src = img.src.replace("-uncollapse", "-collapse")
366 new Ajax.Request("backend.php",
367 { parameters: "backend.php?op=feeds&subop=collapse&cid=" +
368 param_escape(cat) } );
370 local_collapse_cat(cat);
373 exception_error("toggleCollapseCat", e);
377 function isCatCollapsed(cat) {
379 return Element.visible("FCATLIST-" + cat);
381 exception_error("isCatCollapsed", e);
385 function feedlist_dragsorted(ctr) {
387 var elem = $("feedList");
389 var cats = elem.getElementsByTagName("LI");
390 var ordered_cats = new Array();
392 for (var i = 0; i < cats.length; i++) {
393 if (cats[i].id && cats[i].id.match("FCAT-")) {
394 ordered_cats.push(cats[i].id.replace("FCAT-", ""));
398 if (ordered_cats.length > 0) {
400 var query = "?op=feeds&subop=catsort&corder=" +
401 param_escape(ordered_cats.toString());
403 //console.log(query);
405 new Ajax.Request("backend.php", { parameters: query });
409 exception_error("feedlist_dragsorted", e);
413 function feedlist_init() {
415 loading_set_progress(90);
417 //console.log("in feedlist init");
419 hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
420 document.onkeydown = hotkey_handler;
421 document.onmousemove = mouse_move_handler;
422 document.onmousedown = mouse_down_handler;
423 document.onmouseup = mouse_up_handler;
425 if (!offline_mode) setTimeout("timeout()", 1);
427 setTimeout("hotkey_prefix_timeout()", 5*1000);
429 if (getActiveFeedId()) {
430 //console.log("some feed is open on feedlist refresh, reloading");
431 //setTimeout("viewCurrentFeed()", 100);
433 if (getInitParam("cdm_auto_catchup") != 1 && get_feed_unread(-3) > 0) {
434 notify_silent_next();
435 setTimeout("viewfeed(-3)", 100);
437 setTimeout("viewfeed(-5)", 100);
442 if (getInitParam("theme") == "" ||
443 getInitParam("theme_options").match("hide_footer")) {
444 setTimeout("hide_footer()", 5000);
447 init_collapsable_feedlist(getInitParam("theme"));
449 toggle_sortable_feedlist(isFeedlistSortable());
452 exception_error("feedlist/init", e);
456 function hide_footer_af(effect) {
458 var c = $("content-frame");
461 c.style.bottom = "0px";
463 var ioa = $("inline_orig_article");
466 ioa.height = c.offsetHeight;
470 var h = $("headlines-frame");
473 h.style.bottom = "0px";
478 exception_error("hide_footer_af", e);
482 function hide_footer() {
484 if (Element.visible("footer")) {
485 new Effect.Fade("footer", { afterFinish: hide_footer_af });
488 exception_error("hide_footer", e);
492 function init_collapsable_feedlist() {
494 //console.log("init_collapsable_feedlist");
496 var theme = getInitParam("theme");
497 var options = getInitParam("theme_options");
499 if (theme != "" && !options.match("collapse_feedlist")) return;
501 var fbtn = $("collapse_feeds_btn");
503 if (fbtn) Element.show(fbtn);
505 if (getInitParam("collapsed_feedlist") == 1) {
510 exception_error("init_hidden_feedlist", e);
515 function mouse_move_handler(e) {
521 client_y = window.event.clientY;
522 client_x = window.event.clientX;
524 client_x = e.screenX;
525 client_y = e.screenY;
530 if (mouse_y == 0) mouse_y = client_y;
531 if (mouse_x == 0) mouse_x = client_x;
533 resize_headlines(mouse_x - client_x, mouse_y - client_y);
542 exception_error("mouse_move_handler", e);
546 function enable_selection(b) {
547 selection_disabled = !b;
550 function enable_resize(b) {
554 function mouse_down_handler(e) {
557 /* do not prevent right click */
558 if (e && e.button && e.button == 2) return;
560 if (resize_enabled) {
561 mouse_is_down = true;
564 document.onselectstart = function() { return false; };
568 if (selection_disabled) {
569 document.onselectstart = function() { return false; };
574 exception_error("mouse_down_handler", e);
578 function mouse_up_handler(e) {
580 mouse_is_down = false;
582 if (!selection_disabled) {
583 document.onselectstart = null;
584 var e = $("headlineActionsBody");
585 if (e) Element.hide(e);
587 var e = $("offlineModeDrop");
588 if (e) Element.hide(e);
593 exception_error("mouse_up_handler", e);
597 function request_counters_real() {
601 if (offline_mode) return;
603 console.log("requesting counters...");
605 var query = "?op=rpc&subop=getAllCounters&seq=" + next_seq();
607 if (tagsAreDisplayed()) {
608 query = query + "&omode=tl";
610 query = query + "&omode=flc";
613 new Ajax.Request("backend.php", {
615 onComplete: function(transport) {
617 handle_rpc_reply(transport);
619 exception_error("viewfeed/getcounters", e);
624 exception_error("request_counters_real", e);
629 function request_counters() {
633 if (getInitParam("bw_limit") == "1") return;
635 var date = new Date();
636 var timestamp = Math.round(date.getTime() / 1000);
638 if (timestamp - counters_last_request > 5) {
639 console.log("scheduling request of counters...");
641 window.clearTimeout(counter_timeout_id);
642 counter_timeout_id = window.setTimeout("request_counters_real()", 1000);
644 counters_last_request = timestamp;
646 console.log("request_counters: rate limit reached: " + (timestamp - counters_last_request));
650 exception_error("request_counters", e);
654 function displayNewContentPrompt(id) {
657 var msg = "<a href='#' onclick='viewfeed("+id+")'>" +
658 __("New articles available in this feed (click to show)") + "</a>";
660 msg = msg.replace("%s", getFeedName(id));
662 $('auxDlg').innerHTML = msg;
664 new Effect.Appear('auxDlg', {duration : 0.5});
667 exception_error("displayNewContentPrompt", e);
671 function parse_counters(reply, scheduled_call) {
676 var elems = JSON.parse(reply.firstChild.nodeValue);
678 for (var l = 0; l < elems.length; l++) {
681 var kind = elems[l].kind;
682 var ctr = parseInt(elems[l].counter)
683 var error = elems[l].error;
684 var has_img = elems[l].has_img;
685 var updated = elems[l].updated;
686 var title = elems[l].title;
687 var xmsg = elems[l].xmsg;
689 if (id == "global-unread") {
691 if (ctr > global_unread) {
692 offlineDownloadStart(1);
700 if (id == "subscribed-feeds") {
705 if (kind && kind == "cat") {
706 var catctr = $("FCATCTR-" + id);
708 catctr.innerHTML = "(" + ctr + ")";
710 catctr.className = "catCtrHasUnread";
712 catctr.className = "catCtrNoUnread";
718 var feedctr = $("FEEDCTR-" + id);
719 var feedu = $("FEEDU-" + id);
720 var feedr = $("FEEDR-" + id);
721 var feed_img = $("FIMG-" + id);
722 var feedlink = $("FEEDL-" + id);
723 var feedupd = $("FLUPD-" + id);
725 if (updated && feedlink) {
727 feedlink.title = __("Error:") + " " + error + " (" + updated + ")";
729 feedlink.title = __("Updated:") + " " + updated;
731 } else if (!updated && feedlink) {
732 feedlink.title = __("Updated:") + " " + __("Never");
736 if (!updated) updated = "";
740 feedupd.innerHTML = updated + " " + xmsg + " (Error)";
742 feedupd.innerHTML = updated + " (Error)";
746 feedupd.innerHTML = updated + " (" + xmsg + ")";
748 feedupd.innerHTML = updated;
753 if (has_img && feed_img) {
754 if (!feed_img.src.match(id + ".ico")) {
755 feed_img.src = getInitParam("icons_url") + "/" + id + ".ico";
759 if (feedlink && title) {
760 feedlink.innerHTML = title;
763 if (feedctr && feedu && feedr) {
765 // if (id == getActiveFeedId())
766 // console.log("HAS CTR: " + feedu.innerHTML + " GOT CTR: " + ctr +
767 // " IS_SCHED: " + scheduled_call);
769 if (parseInt(ctr) > 0 &&
770 parseInt(feedu.innerHTML) < parseInt(ctr) &&
771 id == getActiveFeedId() && scheduled_call) {
773 displayNewContentPrompt(id);
776 var row_needs_hl = (ctr > 0 && ctr > parseInt(feedu.innerHTML));
778 feedu.innerHTML = ctr;
781 feedr.className = feedr.className.replace("feed", "error");
783 feedr.className = feedr.className.replace("error", "feed");
787 feedctr.className = "feedCtrHasUnread";
788 if (!feedr.className.match("Unread")) {
789 var is_selected = feedr.className.match("Selected");
791 feedr.className = feedr.className.replace("Selected", "");
792 feedr.className = feedr.className.replace("Unread", "");
794 feedr.className = feedr.className + "Unread";
797 feedr.className = feedr.className + "Selected";
803 !getInitParam("theme_options").match('no_highlights')) {
804 new Effect.Highlight(feedr, {duration: 1, startcolor: "#fff7d5",
805 queue: { position:'end', scope: 'EFQ-' + id, limit: 1 } } );
807 cache_invalidate("F:" + id);
810 feedctr.className = "feedCtrNoUnread";
811 feedr.className = feedr.className.replace("Unread", "");
816 hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
818 var feeds_stored = number_of_feeds;
820 //console.log("Feed counters, C: " + feeds_found + ", S:" + feeds_stored);
822 if (feeds_stored != feeds_found) {
823 number_of_feeds = feeds_found;
825 if (feeds_stored != 0 && feeds_found != 0) {
826 console.log("Subscribed feed number changed, refreshing feedlist");
827 setTimeout('updateFeedList(false, false)', 50);
830 /* var fl = $("feeds-frame").innerHTML;
832 cache_invalidate("FEEDLIST");
833 cache_inject("FEEDLIST", fl, getInitParam("num_feeds"));
838 exception_error("parse_counters", e);
842 function get_feed_unread(id) {
844 return parseInt($("FEEDU-" + id).innerHTML);
850 function get_cat_unread(id) {
852 var ctr = $("FCATCTR-" + id).innerHTML;
853 ctr = ctr.replace("(", "");
854 ctr = ctr.replace(")", "");
855 return parseInt(ctr);
861 function get_feed_entry_unread(elem) {
863 var id = elem.id.replace("FEEDR-", "");
870 return parseInt($("FEEDU-" + id).innerHTML);
876 function get_feed_entry_name(elem) {
877 var id = elem.id.replace("FEEDR-", "");
878 return getFeedName(id);
882 function resort_category(node, cat_mode) {
886 console.log("resort_category: " + node + " CM=" + cat_mode);
888 var by_unread = feedsSortByUnread();
890 var list = node.getElementsByTagName("LI");
892 for (i = 0; i < list.length; i++) {
894 for (j = i+1; j < list.length; j++) {
896 var tmp_val = get_feed_entry_unread(list[i]);
897 var cur_val = get_feed_entry_unread(list[j]);
899 var tmp_name = get_feed_entry_name(list[i]);
900 var cur_name = get_feed_entry_name(list[j]);
902 /* we don't want to match FEEDR-0 - e.g. Archived articles */
904 var valid_pair = cat_mode || (list[i].id.match(/FEEDR-[1-9]/) &&
905 list[j].id.match(/FEEDR-[1-9]/));
907 if (valid_pair && ((by_unread && (cur_val > tmp_val)) || (!by_unread && (cur_name < tmp_name)))) {
908 tempnode_i = list[i].cloneNode(true);
909 tempnode_j = list[j].cloneNode(true);
910 node.replaceChild(tempnode_i, list[j]);
911 node.replaceChild(tempnode_j, list[i]);
917 exception_error("resort_category", e);
922 function resort_feedlist() {
923 console.log("resort_feedlist");
925 if ($("FCATLIST--1")) {
927 var lists = document.getElementsByTagName("UL");
929 for (var i = 0; i < lists.length; i++) {
930 if (lists[i].id && lists[i].id.match("FCATLIST-")) {
931 resort_category(lists[i], true);
936 resort_category($("feedList"), false);
940 function hideOrShowFeeds(hide) {
944 //console.log("hideOrShowFeeds: " + hide);
946 if ($("FCATLIST--1")) {
948 var lists = document.getElementsByTagName("UL");
950 for (var i = 0; i < lists.length; i++) {
951 if (lists[i].id && lists[i].id.match("FCATLIST-")) {
953 var id = lists[i].id.replace("FCATLIST-", "");
954 hideOrShowFeedsCategory(id, hide);
959 hideOrShowFeedsCategory(null, hide);
963 exception_error("hideOrShowFeeds", e);
967 function hideOrShowFeedsCategory(id, hide) {
975 node = $("FCATLIST-" + id);
976 cat_node = $("FCAT-" + id);
978 node = $("feedList"); // no categories
981 // console.log("hideOrShowFeedsCategory: " + node + " (" + hide + ")");
986 console.warn("hideOrShowFeeds: passed node is null, aborting");
990 // console.log("cat: " + node.id);
992 if (node.hasChildNodes() && node.firstChild.nextSibling != false) {
993 for (i = 0; i < node.childNodes.length; i++) {
994 if (node.childNodes[i].nodeName != "LI") { continue; }
996 if (node.childNodes[i].style != undefined) {
998 var has_unread = (node.childNodes[i].className != "feed" &&
999 node.childNodes[i].className != "label" &&
1000 !(!getInitParam("hide_read_shows_special") &&
1001 node.childNodes[i].className == "virt") &&
1002 node.childNodes[i].className != "error" &&
1003 node.childNodes[i].className != "tag");
1005 var has_error = node.childNodes[i].className.match("error");
1007 // console.log(node.childNodes[i].id + " --> " + has_unread);
1009 if (hide && !has_unread) {
1010 var id = node.childNodes[i].id;
1011 Effect.Fade(node.childNodes[i], {duration : 0.3,
1012 queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }});
1016 Element.show(node.childNodes[i]);
1020 Element.show(node.childNodes[i]);
1024 //if (has_error) Element.hide(node.childNodes[i]);
1029 // console.log("end cat: " + node.id + " unread " + cat_unread);
1033 if (cat_unread == 0) {
1034 if (cat_node.style == undefined) {
1035 console.log("ERROR: supplied cat_node " + cat_node +
1036 " has no styles. WTF?");
1040 //cat_node.style.display = "none";
1041 Effect.Fade(cat_node, {duration : 0.3,
1042 queue: { position: 'end', scope: 'CFADE-' + node.id, limit: 1 }});
1044 cat_node.style.display = "list-item";
1048 cat_node.style.display = "list-item";
1055 // console.log("unread for category: " + cat_unread);
1058 exception_error("hideOrShowFeedsCategory", e);
1062 function getFeedName(id, is_cat) {
1066 e = $("FCATN-" + id);
1068 e = $("FEEDN-" + id);
1071 return e.innerHTML.stripTags();
1077 function getNextUnreadCat(id) {
1079 var rows = $("feedList").getElementsByTagName("LI");
1080 var feeds = new Array();
1082 var unread_only = true;
1085 for (var i = 0; i < rows.length; i++) {
1086 if (rows[i].id.match("FCAT-")) {
1087 if (rows[i].id == "FCAT-" + id && is_cat || (Element.visible(rows[i]) && Element.visible(rows[i].parentNode))) {
1089 var cat_id = parseInt(rows[i].id.replace("FCAT-", ""));
1092 if (!unread_only || get_cat_unread(cat_id) > 0) {
1100 var idx = feeds.indexOf(id);
1101 if (idx != -1 && idx < feeds.length) {
1102 return feeds[idx+1];
1104 return feeds.shift();
1108 exception_error("getNextUnreadCat", e);
1112 function getRelativeFeedId2(id, is_cat, direction, unread_only) {
1115 // alert(id + " IC: " + is_cat + " D: " + direction + " U: " + unread_only);
1117 var rows = $("feedList").getElementsByTagName("LI");
1118 var feeds = new Array();
1120 for (var i = 0; i < rows.length; i++) {
1121 if (rows[i].id.match("FEEDR-")) {
1123 if (rows[i].id == "FEEDR-" + id && !is_cat || (Element.visible(rows[i]) && Element.visible(rows[i].parentNode))) {
1126 (rows[i].className.match("Unread") || rows[i].id == "FEEDR-" + id)) {
1127 feeds.push(rows[i].id.replace("FEEDR-", ""));
1132 if (rows[i].id.match("FCAT-")) {
1133 if (rows[i].id == "FCAT-" + id && is_cat || (Element.visible(rows[i]) && Element.visible(rows[i].parentNode))) {
1135 var cat_id = parseInt(rows[i].id.replace("FCAT-", ""));
1138 if (!unread_only || get_cat_unread(cat_id) > 0) {
1139 feeds.push("CAT:"+cat_id);
1146 // alert(feeds.toString());
1149 if (direction == "next") {
1150 return feeds.shift();
1155 if (direction == "next") {
1156 if (is_cat) id = "CAT:" + id;
1157 var idx = feeds.indexOf(id);
1158 if (idx != -1 && idx < feeds.length) {
1159 return feeds[idx+1];
1161 return getRelativeFeedId2(false, is_cat, direction, unread_only);
1164 if (is_cat) id = "CAT:" + id;
1165 var idx = feeds.indexOf(id);
1167 return feeds[idx-1];
1169 return getRelativeFeedId2(false, is_cat, direction, unread_only);
1176 exception_error("getRelativeFeedId2", e);
1180 function clean_feed_selections() {
1182 var feeds = $("feedList").getElementsByTagName("LI");
1184 for (var i = 0; i < feeds.length; i++) {
1185 if (feeds[i].id && feeds[i].id.match("FEEDR-")) {
1186 feeds[i].className = feeds[i].className.replace("Selected", "");
1188 if (feeds[i].id && feeds[i].id.match("FCAT-")) {
1189 feeds[i].className = feeds[i].className.replace("Selected", "");
1193 exception_error("clean_feed_selections", e);
1197 function feedsSortByUnread() {
1198 return feeds_sort_by_unread;