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;
69 if (getActiveFeedId() != feed) {
77 Form.enable("main_toolbar_form");
79 var toolbar_form = document.forms["main_toolbar_form"];
80 var toolbar_query = Form.serialize("main_toolbar_form");
82 if (document.forms["main_toolbar_form"].query) {
83 toolbar_form.query.value = "";
86 var query = "backend.php?op=viewfeed&feed=" + feed + "&" +
87 toolbar_query + "&subop=" + param_escape(subop);
89 if (document.getElementById("search_form")) {
90 var search_query = Form.serialize("search_form");
91 query = query + "&" + search_query;
95 debug("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat);
97 var fe = document.getElementById("FEEDR-" + getActiveFeedId());
100 fe.className = fe.className.replace("Selected", "");
103 setActiveFeedId(feed);
105 if (is_cat != undefined) {
106 active_feed_is_cat = is_cat;
109 if (subop == "MarkAllRead") {
111 var feedlist = document.getElementById('feedList');
113 var next_unread_feed = getRelativeFeedId(feedlist,
114 getActiveFeedId(), "next", true);
116 if (!next_unread_feed) {
117 next_unread_feed = getRelativeFeedId(feedlist,
121 var show_next_feed = getInitParam("on_catchup_show_next_feed") == "1";
123 if (next_unread_feed && show_next_feed && !activeFeedIsCat()) {
124 query = query + "&nuf=" + param_escape(next_unread_feed);
125 setActiveFeedId(next_unread_feed);
129 if (activeFeedIsCat()) {
130 query = query + "&cat=1";
133 if (page_offset != 0) {
134 query = query + "&skip=" + page_offset;
137 var date = new Date();
138 var timestamp = Math.round(date.getTime() / 1000);
139 query = query + "&ts=" + timestamp
141 if (!activeFeedIsCat()) {
142 var feedr = document.getElementById("FEEDR-" + getActiveFeedId());
143 if (feedr && !feedr.className.match("Selected")) {
144 feedr.className = feedr.className + "Selected";
148 disableContainerChildren("headlinesToolbar", false);
149 Form.enable("main_toolbar_form");
153 /* var container = document.getElementById("headlines-frame");
155 container.innerHTML = "<div class=\"loadingPrompt\"><img src=\"images/indicator_white.gif\"> " +
156 "Loading, please wait...</div>"; */
158 // for piggybacked counters
160 if (tagsAreDisplayed()) {
161 query = query + "&omode=lt";
163 query = query + "&omode=flc";
167 notify_progress("Loading, please wait...", true);
172 if (xmlhttp_ready(xmlhttp)) {
173 xmlhttp.open("GET", query, true);
174 xmlhttp.onreadystatechange=headlines_callback;
177 debug("xmlhttp busy (@feeds)");
181 exception_error("viewfeed", e);
185 function toggleCollapseCat_af(effect) {
186 //var caption = elem.id.replace("FCATLIST-", "");
190 var elem = effect.element;
191 var cat = elem.id.replace("FCATLIST-", "");
192 var cap = document.getElementById("FCAP-" + cat);
194 if (Element.visible(elem)) {
195 cap.innerHTML = cap.innerHTML.replace("...", "");
197 if (cap.innerHTML.lastIndexOf("...") != cap.innerHTML.length-3) {
198 cap.innerHTML = cap.innerHTML + "...";
203 exception_error("toggleCollapseCat_af", e);
207 function toggleCollapseCat(cat) {
209 if (!xmlhttp_ready(xmlhttp)) {
214 var cat_elem = document.getElementById("FCAT-" + cat);
215 var cat_list = document.getElementById("FCATLIST-" + cat).parentNode;
216 var caption = document.getElementById("FCAP-" + cat);
218 /* if (cat_list.className.match("invisible")) {
219 cat_list.className = "";
220 caption.innerHTML = caption.innerHTML.replace("...", "");
222 setCookie("ttrss_vf_uclps", "0");
225 cat_list.className = "invisible";
226 caption.innerHTML = caption.innerHTML + "...";
228 setCookie("ttrss_vf_uclps", "1");
234 if (Element.visible("FCATLIST-" + cat)) {
235 setCookie("ttrss_vf_uclps", "1");
237 setCookie("ttrss_vf_uclps", "0");
242 if (Element.visible("FCATLIST-" + cat)) {
243 setCookie("ttrss_vf_lclps", "1");
245 setCookie("ttrss_vf_lclps", "0");
250 if (Element.visible("FCATLIST-" + cat)) {
251 setCookie("ttrss_vf_vclps", "1");
253 setCookie("ttrss_vf_vclps", "0");
257 Effect.toggle('FCATLIST-' + cat, 'blind', { duration: 0.5,
258 afterFinish: toggleCollapseCat_af });
260 new Ajax.Request("backend.php?op=feeds&subop=collapse&cid=" +
264 exception_error("toggleCollapseCat", e);
268 function feedlist_init() {
270 // if (arguments.callee.done) return;
271 // arguments.callee.done = true;
273 debug("in feedlist init");
275 hideOrShowFeeds(document, getInitParam("hide_read_feeds") == 1);
276 document.onkeydown = hotkey_handler;
277 setTimeout("timeout()", 0);
279 debug("about to remove splash, OMG!");
281 var o = document.getElementById("overlay");
284 o.style.display = "none";
285 debug("removed splash!");
288 if (typeof correctPNG != 'undefined') {
292 if (getActiveFeedId()) {
293 debug("some feed is open on feedlist refresh, reloading");
294 setTimeout("viewCurrentFeed()", 100);
298 exception_error("feedlist/init", e);