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");
213 // for piggybacked counters
215 if (tagsAreDisplayed()) {
216 query
= query
+ "&omode=lt";
218 query
= query
+ "&omode=flc";
223 var container
= $("headlinesInnerContainer");
225 /* if (container && page_offset == 0 && !isCdmMode()) {
226 new Effect.Fade(container, {duration: 1, to: 0.01,
227 queue: { position:'end', scope: 'FEEDL-' + feed, limit: 1 } } );
232 if (!is_cat
) unread_ctr
= get_feed_unread(feed
);
234 var cache_check
= false;
236 if (unread_ctr
!= -1 && !page_offset
&& !force_nocache
&& !subop
) {
238 var cache_prefix
= "";
246 cache_check
= cache_check_param(cache_prefix
+ feed
, unread_ctr
);
247 console
.log("headline cache check: " + cache_check
);
251 var f
= $("headlines-frame");
253 clean_feed_selections();
255 setActiveFeedId(feed
, is_cat
);
258 var feedr
= $("FEEDR-" + feed
);
259 if (feedr
&& !feedr
.className
.match("Selected")) {
260 feedr
.className
= feedr
.className
+ "Selected";
263 var feedr
= $("FCAT-" + feed_id
);
264 if (feedr
&& !feedr
.className
.match("Selected")) {
265 feedr
.className
= feedr
.className
+ "Selected";
269 f
.innerHTML
= cache_find_param(cache_prefix
+ feed
, unread_ctr
);
280 feedr
= $('FCAP-' + feed
);
282 feedr
= $('FEEDR-' + feed
);
285 if (feedr
&& !$('FLL-' + feed
)) {
287 var img
= $('FIMG-' + feed
);
289 if (!is_cat
&& img
) {
291 var cat_list
= feedr
.parentNode
;
293 if (!cat_list
|| Element
.visible(cat_list
)) {
294 if (!img
.src
.match("indicator_white")) {
296 img
.src
= getInitParam("sign_progress");
298 } else if (cat_list
) {
299 feed_cat_id
= cat_list
.id
.replace("FCATLIST-", "");
301 if (!$('FLL-' + feed_cat_id
)) {
303 var ll
= document
.createElement('img');
305 ll
.src
= getInitParam("sign_progress_tiny");
306 ll
.className
= 'hlLoading';
307 ll
.id
= 'FLL-' + feed
;
309 $("FCAP-" + feed_cat_id
).appendChild(ll
);
315 if (!$('FLL-' + feed
)) {
316 var ll
= document
.createElement('img');
318 ll
.src
= getInitParam("sign_progress_tiny");
319 ll
.className
= 'hlLoading';
320 ll
.id
= 'FLL-' + feed
;
322 feedr
.appendChild(ll
);
328 new Ajax
.Request("backend.php", {
330 onComplete: function(transport
) {
331 headlines_callback2(transport
, page_offset
);
336 exception_error("viewfeed", e
);
340 function toggleCollapseCat_af(effect
) {
341 //var caption = elem.id.replace("FCATLIST-", "");
345 var elem
= effect
.element
;
346 var cat
= elem
.id
.replace("FCATLIST-", "");
347 var cap
= $("FCAP-" + cat
);
349 if (Element
.visible(elem
)) {
350 cap
.innerHTML
= cap
.innerHTML
.replace("…", "");
352 if (cap
.innerHTML
.lastIndexOf("…") != cap
.innerHTML
.length
-3) {
353 cap
.innerHTML
= cap
.innerHTML
+ "…";
358 exception_error("toggleCollapseCat_af", e
);
362 function toggleCollapseCat(cat
) {
365 var cat_elem
= $("FCAT-" + cat
);
366 var cat_list
= $("FCATLIST-" + cat
).parentNode
;
367 var caption
= $("FCAP-" + cat
);
369 Effect
.toggle('FCATLIST-' + cat
, 'blind', { duration
: 0.5,
370 afterFinish
: toggleCollapseCat_af
});
372 var img
= cat_elem
.getElementsByTagName("IMG")[0];
374 if (img
.src
.match("-collapse"))
375 img
.src
= img
.src
.replace("-collapse", "-uncollapse")
377 img
.src
= img
.src
.replace("-uncollapse", "-collapse")
379 new Ajax
.Request("backend.php",
380 { parameters
: "backend.php?op=feeds&subop=collapse&cid=" +
381 param_escape(cat
) } );
383 local_collapse_cat(cat
);
386 exception_error("toggleCollapseCat", e
);
390 function isCatCollapsed(cat
) {
392 return Element
.visible("FCATLIST-" + cat
);
394 exception_error("isCatCollapsed", e
);
398 function feedlist_dragsorted(ctr
) {
400 var elem
= $("feedList");
402 var cats
= elem
.getElementsByTagName("LI");
403 var ordered_cats
= new Array();
405 for (var i
= 0; i
< cats
.length
; i
++) {
406 if (cats
[i
].id
&& cats
[i
].id
.match("FCAT-")) {
407 ordered_cats
.push(cats
[i
].id
.replace("FCAT-", ""));
411 if (ordered_cats
.length
> 0) {
413 var query
= "?op=feeds&subop=catsort&corder=" +
414 param_escape(ordered_cats
.toString());
416 //console.log(query);
418 new Ajax
.Request("backend.php", { parameters
: query
});
422 exception_error("feedlist_dragsorted", e
);
426 function feedlist_init() {
428 loading_set_progress(90);
430 //console.log("in feedlist init");
432 hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
433 document
.onkeydown
= hotkey_handler
;
434 document
.onmousemove
= mouse_move_handler
;
435 document
.onmousedown
= mouse_down_handler
;
436 document
.onmouseup
= mouse_up_handler
;
438 if (!offline_mode
) setTimeout("timeout()", 1);
440 setTimeout("hotkey_prefix_timeout()", 5*1000);
442 if (getActiveFeedId()) {
443 //console.log("some feed is open on feedlist refresh, reloading");
444 //setTimeout("viewCurrentFeed()", 100);
446 if (getInitParam("cdm_auto_catchup") != 1 && get_feed_unread(-3) > 0) {
447 notify_silent_next();
448 setTimeout("viewfeed(-3)", 100);
450 setTimeout("viewfeed(-5)", 100);
455 if (getInitParam("theme") == "" ||
456 getInitParam("theme_options").match("hide_footer")) {
457 setTimeout("hide_footer()", 5000);
460 init_collapsable_feedlist(getInitParam("theme"));
462 toggle_sortable_feedlist(isFeedlistSortable());
465 exception_error("feedlist/init", e
);
469 function hide_footer_af(effect
) {
471 var c
= $("content-frame");
474 c
.style
.bottom
= "0px";
476 var ioa
= $("inline_orig_article");
479 ioa
.height
= c
.offsetHeight
;
483 var h
= $("headlines-frame");
486 h
.style
.bottom
= "0px";
491 exception_error("hide_footer_af", e
);
495 function hide_footer() {
497 if (Element
.visible("footer")) {
498 new Effect
.Fade("footer", { afterFinish
: hide_footer_af
});
501 exception_error("hide_footer", e
);
505 function init_collapsable_feedlist() {
507 //console.log("init_collapsable_feedlist");
509 var theme
= getInitParam("theme");
510 var options
= getInitParam("theme_options");
512 if (theme
!= "" && !options
.match("collapse_feedlist")) return;
514 var fbtn
= $("collapse_feeds_btn");
516 if (fbtn
) Element
.show(fbtn
);
518 if (getInitParam("collapsed_feedlist") == 1) {
523 exception_error("init_hidden_feedlist", e
);
528 function mouse_move_handler(e
) {
534 client_y
= window
.event
.clientY
;
535 client_x
= window
.event
.clientX
;
537 client_x
= e
.screenX
;
538 client_y
= e
.screenY
;
543 if (mouse_y
== 0) mouse_y
= client_y
;
544 if (mouse_x
== 0) mouse_x
= client_x
;
546 resize_headlines(mouse_x
- client_x
, mouse_y
- client_y
);
555 exception_error("mouse_move_handler", e
);
559 function enable_selection(b
) {
560 selection_disabled
= !b
;
563 function enable_resize(b
) {
567 function mouse_down_handler(e
) {
570 /* do not prevent right click */
571 if (e
&& e
.button
&& e
.button
== 2) return;
573 if (resize_enabled
) {
574 mouse_is_down
= true;
577 document
.onselectstart = function() { return false; };
581 if (selection_disabled
) {
582 document
.onselectstart = function() { return false; };
587 exception_error("mouse_down_handler", e
);
591 function mouse_up_handler(e
) {
593 mouse_is_down
= false;
595 if (!selection_disabled
) {
596 document
.onselectstart
= null;
597 var e
= $("headlineActionsBody");
598 if (e
) Element
.hide(e
);
600 var e
= $("offlineModeDrop");
601 if (e
) Element
.hide(e
);
606 exception_error("mouse_up_handler", e
);
610 function request_counters_real() {
614 if (offline_mode
) return;
616 console
.log("requesting counters...");
618 var query
= "?op=rpc&subop=getAllCounters&seq=" + next_seq();
620 if (tagsAreDisplayed()) {
621 query
= query
+ "&omode=tl";
623 query
= query
+ "&omode=flc";
626 new Ajax
.Request("backend.php", {
628 onComplete: function(transport
) {
630 handle_rpc_reply(transport
);
632 exception_error("viewfeed/getcounters", e
);
637 exception_error("request_counters_real", e
);
642 function request_counters() {
646 if (getInitParam("bw_limit") == "1") return;
648 var date
= new Date();
649 var timestamp
= Math
.round(date
.getTime() / 1000);
651 if (timestamp
- counters_last_request
> 5) {
652 console
.log("scheduling request of counters...");
654 window
.clearTimeout(counter_timeout_id
);
655 counter_timeout_id
= window
.setTimeout("request_counters_real()", 1000);
657 counters_last_request
= timestamp
;
659 console
.log("request_counters: rate limit reached: " + (timestamp
- counters_last_request
));
663 exception_error("request_counters", e
);
667 function displayNewContentPrompt(id
) {
670 var msg
= "<a href='#' onclick='viewfeed("+id
+")'>" +
671 __("New articles available in this feed (click to show)") + "</a>";
673 msg
= msg
.replace("%s", getFeedName(id
));
675 $('auxDlg').innerHTML
= msg
;
677 new Effect
.Appear('auxDlg', {duration
: 0.5});
680 exception_error("displayNewContentPrompt", e
);
684 function parse_counters(reply
, scheduled_call
) {
689 var elems
= JSON
.parse(reply
.firstChild
.nodeValue
);
691 for (var l
= 0; l
< elems
.length
; l
++) {
694 var kind
= elems
[l
].kind
;
695 var ctr
= parseInt(elems
[l
].counter
)
696 var error
= elems
[l
].error
;
697 var has_img
= elems
[l
].has_img
;
698 var updated
= elems
[l
].updated
;
699 var title
= elems
[l
].title
;
700 var xmsg
= elems
[l
].xmsg
;
702 if (id
== "global-unread") {
704 if (ctr
> global_unread
) {
705 offlineDownloadStart(1);
713 if (id
== "subscribed-feeds") {
718 if (kind
&& kind
== "cat") {
719 var catctr
= $("FCATCTR-" + id
);
721 catctr
.innerHTML
= "(" + ctr
+ ")";
723 catctr
.className
= "catCtrHasUnread";
725 catctr
.className
= "catCtrNoUnread";
731 var feedctr
= $("FEEDCTR-" + id
);
732 var feedu
= $("FEEDU-" + id
);
733 var feedr
= $("FEEDR-" + id
);
734 var feed_img
= $("FIMG-" + id
);
735 var feedlink
= $("FEEDL-" + id
);
736 var feedupd
= $("FLUPD-" + id
);
738 if (updated
&& feedlink
) {
740 feedlink
.title
= "Error: " + error
+ " (" + updated
+ ")";
742 feedlink
.title
= "Updated: " + updated
;
747 if (!updated
) updated
= "";
751 feedupd
.innerHTML
= updated
+ " " + xmsg
+ " (Error)";
753 feedupd
.innerHTML
= updated
+ " (Error)";
757 feedupd
.innerHTML
= updated
+ " (" + xmsg
+ ")";
759 feedupd
.innerHTML
= updated
;
764 if (has_img
&& feed_img
) {
765 if (!feed_img
.src
.match(id
+ ".ico")) {
766 feed_img
.src
= getInitParam("icons_url") + "/" + id
+ ".ico";
770 if (feedlink
&& title
) {
771 feedlink
.innerHTML
= title
;
774 if (feedctr
&& feedu
&& feedr
) {
776 // if (id == getActiveFeedId())
777 // console.log("HAS CTR: " + feedu.innerHTML + " GOT CTR: " + ctr +
778 // " IS_SCHED: " + scheduled_call);
780 if (parseInt(ctr
) > 0 &&
781 parseInt(feedu
.innerHTML
) < parseInt(ctr
) &&
782 id
== getActiveFeedId() && scheduled_call
) {
784 displayNewContentPrompt(id
);
787 var row_needs_hl
= (ctr
> 0 && ctr
> parseInt(feedu
.innerHTML
));
789 feedu
.innerHTML
= ctr
;
792 feedr
.className
= feedr
.className
.replace("feed", "error");
794 feedr
.className
= feedr
.className
.replace("error", "feed");
798 feedctr
.className
= "feedCtrHasUnread";
799 if (!feedr
.className
.match("Unread")) {
800 var is_selected
= feedr
.className
.match("Selected");
802 feedr
.className
= feedr
.className
.replace("Selected", "");
803 feedr
.className
= feedr
.className
.replace("Unread", "");
805 feedr
.className
= feedr
.className
+ "Unread";
808 feedr
.className
= feedr
.className
+ "Selected";
814 !getInitParam("theme_options").match('no_highlights')) {
815 new Effect
.Highlight(feedr
, {duration
: 1, startcolor
: "#fff7d5",
816 queue
: { position
:'end', scope
: 'EFQ-' + id
, limit
: 1 } } );
818 cache_invalidate("F:" + id
);
821 feedctr
.className
= "feedCtrNoUnread";
822 feedr
.className
= feedr
.className
.replace("Unread", "");
827 hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
829 var feeds_stored
= number_of_feeds
;
831 //console.log("Feed counters, C: " + feeds_found + ", S:" + feeds_stored);
833 if (feeds_stored
!= feeds_found
) {
834 number_of_feeds
= feeds_found
;
836 if (feeds_stored
!= 0 && feeds_found
!= 0) {
837 console
.log("Subscribed feed number changed, refreshing feedlist");
838 setTimeout('updateFeedList(false, false)', 50);
841 /* var fl = $("feeds-frame").innerHTML;
843 cache_invalidate("FEEDLIST");
844 cache_inject("FEEDLIST", fl, getInitParam("num_feeds"));
849 exception_error("parse_counters", e
);
853 function get_feed_unread(id
) {
855 return parseInt($("FEEDU-" + id
).innerHTML
);
861 function get_cat_unread(id
) {
863 var ctr
= $("FCATCTR-" + id
).innerHTML
;
864 ctr
= ctr
.replace("(", "");
865 ctr
= ctr
.replace(")", "");
866 return parseInt(ctr
);
872 function get_feed_entry_unread(elem
) {
874 var id
= elem
.id
.replace("FEEDR-", "");
881 return parseInt($("FEEDU-" + id
).innerHTML
);
887 function get_feed_entry_name(elem
) {
888 var id
= elem
.id
.replace("FEEDR-", "");
889 return getFeedName(id
);
893 function resort_category(node
, cat_mode
) {
897 console
.log("resort_category: " + node
+ " CM=" + cat_mode
);
899 var by_unread
= feedsSortByUnread();
901 var list
= node
.getElementsByTagName("LI");
903 for (i
= 0; i
< list
.length
; i
++) {
905 for (j
= i
+1; j
< list
.length
; j
++) {
907 var tmp_val
= get_feed_entry_unread(list
[i
]);
908 var cur_val
= get_feed_entry_unread(list
[j
]);
910 var tmp_name
= get_feed_entry_name(list
[i
]);
911 var cur_name
= get_feed_entry_name(list
[j
]);
913 /* we don't want to match FEEDR-0 - e.g. Archived articles */
915 var valid_pair
= cat_mode
|| (list
[i
].id
.match(/FEEDR-[1-9]/) &&
916 list
[j
].id
.match(/FEEDR-[1-9]/));
918 if (valid_pair
&& ((by_unread
&& (cur_val
> tmp_val
)) || (!by_unread
&& (cur_name
< tmp_name
)))) {
919 tempnode_i
= list
[i
].cloneNode(true);
920 tempnode_j
= list
[j
].cloneNode(true);
921 node
.replaceChild(tempnode_i
, list
[j
]);
922 node
.replaceChild(tempnode_j
, list
[i
]);
928 exception_error("resort_category", e
);
933 function resort_feedlist() {
934 console
.log("resort_feedlist");
936 if ($("FCATLIST--1")) {
938 var lists
= document
.getElementsByTagName("UL");
940 for (var i
= 0; i
< lists
.length
; i
++) {
941 if (lists
[i
].id
&& lists
[i
].id
.match("FCATLIST-")) {
942 resort_category(lists
[i
], true);
947 resort_category($("feedList"), false);
951 function hideOrShowFeeds(hide
) {
955 //console.log("hideOrShowFeeds: " + hide);
957 if ($("FCATLIST--1")) {
959 var lists
= document
.getElementsByTagName("UL");
961 for (var i
= 0; i
< lists
.length
; i
++) {
962 if (lists
[i
].id
&& lists
[i
].id
.match("FCATLIST-")) {
964 var id
= lists
[i
].id
.replace("FCATLIST-", "");
965 hideOrShowFeedsCategory(id
, hide
);
970 hideOrShowFeedsCategory(null, hide
);
974 exception_error("hideOrShowFeeds", e
);
978 function hideOrShowFeedsCategory(id
, hide
) {
986 node
= $("FCATLIST-" + id
);
987 cat_node
= $("FCAT-" + id
);
989 node
= $("feedList"); // no categories
992 // console.log("hideOrShowFeedsCategory: " + node + " (" + hide + ")");
997 console
.warn("hideOrShowFeeds: passed node is null, aborting");
1001 // console.log("cat: " + node.id);
1003 if (node
.hasChildNodes() && node
.firstChild
.nextSibling
!= false) {
1004 for (i
= 0; i
< node
.childNodes
.length
; i
++) {
1005 if (node
.childNodes
[i
].nodeName
!= "LI") { continue; }
1007 if (node
.childNodes
[i
].style
!= undefined) {
1009 var has_unread
= (node
.childNodes
[i
].className
!= "feed" &&
1010 node
.childNodes
[i
].className
!= "label" &&
1011 !(!getInitParam("hide_read_shows_special") &&
1012 node
.childNodes
[i
].className
== "virt") &&
1013 node
.childNodes
[i
].className
!= "error" &&
1014 node
.childNodes
[i
].className
!= "tag");
1016 var has_error
= node
.childNodes
[i
].className
.match("error");
1018 // console.log(node.childNodes[i].id + " --> " + has_unread);
1020 if (hide
&& !has_unread
) {
1021 var id
= node
.childNodes
[i
].id
;
1022 Effect
.Fade(node
.childNodes
[i
], {duration
: 0.3,
1023 queue
: { position
: 'end', scope
: 'FFADE-' + id
, limit
: 1 }});
1027 Element
.show(node
.childNodes
[i
]);
1031 Element
.show(node
.childNodes
[i
]);
1035 //if (has_error) Element.hide(node.childNodes[i]);
1040 // console.log("end cat: " + node.id + " unread " + cat_unread);
1044 if (cat_unread
== 0) {
1045 if (cat_node
.style
== undefined) {
1046 console
.log("ERROR: supplied cat_node " + cat_node
+
1047 " has no styles. WTF?");
1051 //cat_node.style.display = "none";
1052 Effect
.Fade(cat_node
, {duration
: 0.3,
1053 queue
: { position
: 'end', scope
: 'CFADE-' + node
.id
, limit
: 1 }});
1055 cat_node
.style
.display
= "list-item";
1059 cat_node
.style
.display
= "list-item";
1066 // console.log("unread for category: " + cat_unread);
1069 exception_error("hideOrShowFeedsCategory", e
);
1073 function getFeedName(id
, is_cat
) {
1077 e
= $("FCATN-" + id
);
1079 e
= $("FEEDN-" + id
);
1082 return e
.innerHTML
.stripTags();
1088 function getNextUnreadCat(id
) {
1090 var rows
= $("feedList").getElementsByTagName("LI");
1091 var feeds
= new Array();
1093 var unread_only
= true;
1096 for (var i
= 0; i
< rows
.length
; i
++) {
1097 if (rows
[i
].id
.match("FCAT-")) {
1098 if (rows
[i
].id
== "FCAT-" + id
&& is_cat
|| (Element
.visible(rows
[i
]) && Element
.visible(rows
[i
].parentNode
))) {
1100 var cat_id
= parseInt(rows
[i
].id
.replace("FCAT-", ""));
1103 if (!unread_only
|| get_cat_unread(cat_id
) > 0) {
1111 var idx
= feeds
.indexOf(id
);
1112 if (idx
!= -1 && idx
< feeds
.length
) {
1113 return feeds
[idx
+1];
1115 return feeds
.shift();
1119 exception_error("getNextUnreadCat", e
);
1123 function getRelativeFeedId2(id
, is_cat
, direction
, unread_only
) {
1126 // alert(id + " IC: " + is_cat + " D: " + direction + " U: " + unread_only);
1128 var rows
= $("feedList").getElementsByTagName("LI");
1129 var feeds
= new Array();
1131 for (var i
= 0; i
< rows
.length
; i
++) {
1132 if (rows
[i
].id
.match("FEEDR-")) {
1134 if (rows
[i
].id
== "FEEDR-" + id
&& !is_cat
|| (Element
.visible(rows
[i
]) && Element
.visible(rows
[i
].parentNode
))) {
1137 (rows
[i
].className
.match("Unread") || rows
[i
].id
== "FEEDR-" + id
)) {
1138 feeds
.push(rows
[i
].id
.replace("FEEDR-", ""));
1143 if (rows
[i
].id
.match("FCAT-")) {
1144 if (rows
[i
].id
== "FCAT-" + id
&& is_cat
|| (Element
.visible(rows
[i
]) && Element
.visible(rows
[i
].parentNode
))) {
1146 var cat_id
= parseInt(rows
[i
].id
.replace("FCAT-", ""));
1149 if (!unread_only
|| get_cat_unread(cat_id
) > 0) {
1150 feeds
.push("CAT:"+cat_id
);
1157 // alert(feeds.toString());
1160 if (direction
== "next") {
1161 return feeds
.shift();
1166 if (direction
== "next") {
1167 if (is_cat
) id
= "CAT:" + id
;
1168 var idx
= feeds
.indexOf(id
);
1169 if (idx
!= -1 && idx
< feeds
.length
) {
1170 return feeds
[idx
+1];
1172 return getRelativeFeedId2(false, is_cat
, direction
, unread_only
);
1175 if (is_cat
) id
= "CAT:" + id
;
1176 var idx
= feeds
.indexOf(id
);
1178 return feeds
[idx
-1];
1180 return getRelativeFeedId2(false, is_cat
, direction
, unread_only
);
1187 exception_error("getRelativeFeedId2", e
);
1191 function clean_feed_selections() {
1193 var feeds
= $("feedList").getElementsByTagName("LI");
1195 for (var i
= 0; i
< feeds
.length
; i
++) {
1196 if (feeds
[i
].id
&& feeds
[i
].id
.match("FEEDR-")) {
1197 feeds
[i
].className
= feeds
[i
].className
.replace("Selected", "");
1199 if (feeds
[i
].id
&& feeds
[i
].id
.match("FCAT-")) {
1200 feeds
[i
].className
= feeds
[i
].className
.replace("Selected", "");
1204 exception_error("clean_feed_selections", e
);
1208 function feedsSortByUnread() {
1209 return feeds_sort_by_unread
;