]>
git.wh0rd.org - tt-rss.git/blob - feedlist.js
cc36587a2eb288bbbdb3fdb99b74e8ea244950f8
1 //var xmlhttp = Ajax.getTransport();
3 function viewCategory(cat
) {
4 active_feed_is_cat
= true;
5 viewfeed(cat
, '', true);
8 function feedlist_callback() {
9 if (xmlhttp
.readyState
== 4) {
10 debug("feedlist_callback");
11 var f
= document
.getElementById("feeds-frame");
12 f
.innerHTML
= xmlhttp
.responseText
;
17 function viewfeed(feed
, subop
, is_cat
, subop_param
) {
22 var toolbar_query
= Form
.serialize("main_toolbar_form");
23 var toolbar_form
= document
.forms
["main_toolbar_form"];
25 if (document
.forms
["main_toolbar_form"].query
) {
26 toolbar_form
.query
.value
= "";
29 storeInitParam("toolbar_limit",
30 toolbar_form
.limit
[toolbar_form
.limit
.selectedIndex
].value
);
32 storeInitParam("toolbar_view_mode",
33 toolbar_form
.view_mode
[toolbar_form
.view_mode
.selectedIndex
].value
);
35 var query
= "backend.php?op=viewfeed&feed=" + feed
+ "&" +
36 toolbar_query
+ "&subop=" + param_escape(subop
);
38 if (document
.getElementById("search_form")) {
39 var search_query
= Form
.serialize("search_form");
40 query
= query
+ "&" + search_query
;
44 debug("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat
);
46 var fe
= document
.getElementById("FEEDR-" + getActiveFeedId());
49 fe
.className
= fe
.className
.replace("Selected", "");
52 setActiveFeedId(feed
);
54 if (is_cat
!= undefined) {
55 active_feed_is_cat
= is_cat
;
58 if (subop
== "MarkAllRead") {
60 var feedlist
= document
.getElementById('feedList');
62 var next_unread_feed
= getRelativeFeedId(feedlist
,
63 getActiveFeedId(), "next", true);
65 var show_next_feed
= getInitParam("on_catchup_show_next_feed") == "1";
67 if (next_unread_feed
&& show_next_feed
&& !activeFeedIsCat()) {
68 query
= query
+ "&nuf=" + param_escape(next_unread_feed
);
69 setActiveFeedId(next_unread_feed
);
73 if (activeFeedIsCat()) {
74 query
= query
+ "&cat=1";
77 if (navigator
.userAgent
.match("Opera")) {
78 var date
= new Date();
79 var timestamp
= Math
.round(date
.getTime() / 1000);
80 query
= query
+ "&ts=" + timestamp
83 if (!activeFeedIsCat()) {
84 var feedr
= document
.getElementById("FEEDR-" + getActiveFeedId());
85 if (feedr
&& !feedr
.className
.match("Selected")) {
86 feedr
.className
= feedr
.className
+ "Selected";
90 disableContainerChildren("headlinesToolbar", false);
91 Form
.enable("main_toolbar_form");
95 /* var container = document.getElementById("headlines-frame");
97 container.innerHTML = "<div class=\"loadingPrompt\"><img src=\"images/indicator_white.gif\"> " +
98 "Loading, please wait...</div>"; */
100 notify("Loading, please wait...", true);
104 if (xmlhttp_ready(xmlhttp)) {
105 xmlhttp.open("GET", query, true);
106 xmlhttp.onreadystatechange=headlines_callback;
109 debug("xmlhttp busy (@feeds)");
113 exception_error("viewfeed", e);
117 function toggleCollapseCat(cat) {
119 if (!xmlhttp_ready(xmlhttp)) {
124 var cat_elem = document.getElementById("FCAT-" + cat);
125 var cat_list = document.getElementById("FCATLIST-" + cat).parentNode;
126 var caption = document.getElementById("FCAP-" + cat);
128 if (cat_list.className.match("invisible")) {
129 cat_list.className = "";
130 caption.innerHTML = caption.innerHTML.replace("...", "");
132 setCookie("ttrss_vf_uclps", "0");
135 cat_list.className = "invisible";
136 caption.innerHTML = caption.innerHTML + "...";
138 setCookie("ttrss_vf_uclps", "1");
142 new Ajax.Request("backend.php?op=feeds&subop=collapse&cid=" +
146 exception_error("toggleCollapseCat", e);
150 function feedlist_init() {
152 // if (arguments.callee.done) return;
153 // arguments.callee.done = true;
155 debug("in feedlist init");
157 hideOrShowFeeds(document, getInitParam("hide_read_feeds") == 1);
158 document.onkeydown = hotkey_handler;
159 setTimeout("timeout()", 0);
161 debug("about to remove splash, OMG!");
163 var o = document.getElementById("overlay");
166 o.style.display = "none";
167 debug("removed splash!");
170 if (typeof correctPNG != 'undefined') {
175 exception_error("feedlist/init", e);