1 //var xmlhttp = Ajax.getTransport();
5 function viewCategory(cat) {
6 active_feed_is_cat = true;
7 viewfeed(cat, '', true);
11 function feedlist_callback() {
12 if (xmlhttp.readyState == 4) {
13 debug("feedlist_callback");
14 var f = document.getElementById("feeds-frame");
15 f.innerHTML = xmlhttp.responseText;
22 function viewFeedGoPage(i) {
24 if (!getActiveFeedId()) return;
27 page_offset = page_offset + i;
32 if (page_offset < 0) page_offset = 0;
33 viewfeed(getActiveFeedId(), undefined, undefined, undefined,
34 undefined, page_offset);
36 exception_error(e, "viewFeedGoPage");
41 function viewNextFeedPage() {
43 if (!getActiveFeedId()) return;
47 viewfeed(getActiveFeedId(), undefined, undefined, undefined,
48 undefined, feed_cur_page);
51 exception_error(e, "viewFeedGoPage");
55 function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
58 // if (!offset) page_offset = 0;
67 if (getActiveFeedId() != feed) {
75 Form.enable("main_toolbar_form");
77 var toolbar_form = document.forms["main_toolbar_form"];
78 var toolbar_query = Form.serialize("main_toolbar_form");
80 if (document.forms["main_toolbar_form"].query) {
81 toolbar_form.query.value = "";
84 var query = "backend.php?op=viewfeed&feed=" + feed + "&" +
85 toolbar_query + "&subop=" + param_escape(subop);
87 if (document.getElementById("search_form")) {
88 var search_query = Form.serialize("search_form");
89 query = query + "&" + search_query;
93 debug("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat);
95 var fe = document.getElementById("FEEDR-" + getActiveFeedId());
98 fe.className = fe.className.replace("Selected", "");
101 setActiveFeedId(feed);
103 if (is_cat != undefined) {
104 active_feed_is_cat = is_cat;
107 if (subop == "MarkAllRead") {
109 var feedlist = document.getElementById('feedList');
111 var next_unread_feed = getRelativeFeedId(feedlist,
112 getActiveFeedId(), "next", true);
114 if (!next_unread_feed) {
115 next_unread_feed = getRelativeFeedId(feedlist,
119 var show_next_feed = getInitParam("on_catchup_show_next_feed") == "1";
121 if (next_unread_feed && show_next_feed && !activeFeedIsCat()) {
122 query = query + "&nuf=" + param_escape(next_unread_feed);
123 setActiveFeedId(next_unread_feed);
127 if (activeFeedIsCat()) {
128 query = query + "&cat=1";
131 if (page_offset != 0) {
132 query = query + "&skip=" + page_offset;
135 var date = new Date();
136 var timestamp = Math.round(date.getTime() / 1000);
137 query = query + "&ts=" + timestamp
139 if (!activeFeedIsCat()) {
140 var feedr = document.getElementById("FEEDR-" + getActiveFeedId());
141 if (feedr && !feedr.className.match("Selected")) {
142 feedr.className = feedr.className + "Selected";
146 disableContainerChildren("headlinesToolbar", false);
147 Form.enable("main_toolbar_form");
151 /* var container = document.getElementById("headlines-frame");
153 container.innerHTML = "<div class=\"loadingPrompt\"><img src=\"images/indicator_white.gif\"> " +
154 "Loading, please wait...</div>"; */
156 // for piggybacked counters
158 if (tagsAreDisplayed()) {
159 query = query + "&omode=lt";
161 query = query + "&omode=flc";
164 notify_progress("Loading, please wait...", true);
168 if (xmlhttp_ready(xmlhttp)) {
169 xmlhttp.open("GET", query, true);
170 xmlhttp.onreadystatechange=headlines_callback;
173 debug("xmlhttp busy (@feeds)");
177 exception_error("viewfeed", e);
181 function toggleCollapseCat(cat) {
183 if (!xmlhttp_ready(xmlhttp)) {
188 var cat_elem = document.getElementById("FCAT-" + cat);
189 var cat_list = document.getElementById("FCATLIST-" + cat).parentNode;
190 var caption = document.getElementById("FCAP-" + cat);
192 if (cat_list.className.match("invisible")) {
193 cat_list.className = "";
194 caption.innerHTML = caption.innerHTML.replace("...", "");
196 setCookie("ttrss_vf_uclps", "0");
199 cat_list.className = "invisible";
200 caption.innerHTML = caption.innerHTML + "...";
202 setCookie("ttrss_vf_uclps", "1");
206 new Ajax.Request("backend.php?op=feeds&subop=collapse&cid=" +
210 exception_error("toggleCollapseCat", e);
214 function feedlist_init() {
216 // if (arguments.callee.done) return;
217 // arguments.callee.done = true;
219 debug("in feedlist init");
221 hideOrShowFeeds(document, getInitParam("hide_read_feeds") == 1);
222 document.onkeydown = hotkey_handler;
223 setTimeout("timeout()", 0);
225 debug("about to remove splash, OMG!");
227 var o = document.getElementById("overlay");
230 o.style.display = "none";
231 debug("removed splash!");
234 if (typeof correctPNG != 'undefined') {
238 if (getActiveFeedId()) {
239 debug("some feed is open on feedlist refresh, reloading");
240 setTimeout("viewCurrentFeed()", 100);
244 exception_error("feedlist/init", e);