]>
git.wh0rd.org - tt-rss.git/blob - feedlist.js
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
, skip_history
) {
23 history_push('FEED:' + feed
+ ':' + subop
+ ':' + is_cat
+
27 var toolbar_query
= Form
.serialize("main_toolbar_form");
28 var toolbar_form
= document
.forms
["main_toolbar_form"];
30 if (document
.forms
["main_toolbar_form"].query
) {
31 toolbar_form
.query
.value
= "";
34 /* storeInitParam("toolbar_limit",
35 toolbar_form.limit[toolbar_form.limit.selectedIndex].value);
37 storeInitParam("toolbar_view_mode",
38 toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value); */
40 var query
= "backend.php?op=viewfeed&feed=" + feed
+ "&" +
41 toolbar_query
+ "&subop=" + param_escape(subop
);
43 if (document
.getElementById("search_form")) {
44 var search_query
= Form
.serialize("search_form");
45 query
= query
+ "&" + search_query
;
49 debug("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat
);
51 var fe
= document
.getElementById("FEEDR-" + getActiveFeedId());
54 fe
.className
= fe
.className
.replace("Selected", "");
57 setActiveFeedId(feed
);
59 if (is_cat
!= undefined) {
60 active_feed_is_cat
= is_cat
;
63 if (subop
== "MarkAllRead") {
65 var feedlist
= document
.getElementById('feedList');
67 var next_unread_feed
= getRelativeFeedId(feedlist
,
68 getActiveFeedId(), "next", true);
70 if (!next_unread_feed
) {
71 next_unread_feed
= getRelativeFeedId(feedlist
,
75 var show_next_feed
= getInitParam("on_catchup_show_next_feed") == "1";
77 if (next_unread_feed
&& show_next_feed
&& !activeFeedIsCat()) {
78 query
= query
+ "&nuf=" + param_escape(next_unread_feed
);
79 setActiveFeedId(next_unread_feed
);
83 if (activeFeedIsCat()) {
84 query
= query
+ "&cat=1";
87 if (navigator
.userAgent
.match("Opera")) {
88 var date
= new Date();
89 var timestamp
= Math
.round(date
.getTime() / 1000);
90 query
= query
+ "&ts=" + timestamp
93 if (!activeFeedIsCat()) {
94 var feedr
= document
.getElementById("FEEDR-" + getActiveFeedId());
95 if (feedr
&& !feedr
.className
.match("Selected")) {
96 feedr
.className
= feedr
.className
+ "Selected";
100 disableContainerChildren("headlinesToolbar", false);
101 Form
.enable("main_toolbar_form");
105 /* var container = document.getElementById("headlines-frame");
107 container.innerHTML = "<div class=\"loadingPrompt\"><img src=\"images/indicator_white.gif\"> " +
108 "Loading, please wait...</div>"; */
110 notify("Loading, please wait...", true);
114 if (xmlhttp_ready(xmlhttp)) {
115 xmlhttp.open("GET", query, true);
116 xmlhttp.onreadystatechange=headlines_callback;
119 debug("xmlhttp busy (@feeds)");
123 exception_error("viewfeed", e);
127 function toggleCollapseCat(cat) {
129 if (!xmlhttp_ready(xmlhttp)) {
134 var cat_elem = document.getElementById("FCAT-" + cat);
135 var cat_list = document.getElementById("FCATLIST-" + cat).parentNode;
136 var caption = document.getElementById("FCAP-" + cat);
138 if (cat_list.className.match("invisible")) {
139 cat_list.className = "";
140 caption.innerHTML = caption.innerHTML.replace("...", "");
142 setCookie("ttrss_vf_uclps", "0");
145 cat_list.className = "invisible";
146 caption.innerHTML = caption.innerHTML + "...";
148 setCookie("ttrss_vf_uclps", "1");
152 new Ajax.Request("backend.php?op=feeds&subop=collapse&cid=" +
156 exception_error("toggleCollapseCat", e);
160 function feedlist_init() {
162 // if (arguments.callee.done) return;
163 // arguments.callee.done = true;
165 debug("in feedlist init");
167 hideOrShowFeeds(document, getInitParam("hide_read_feeds") == 1);
168 document.onkeydown = hotkey_handler;
169 setTimeout("timeout()", 0);
171 debug("about to remove splash, OMG!");
173 var o = document.getElementById("overlay");
176 o.style.display = "none";
177 debug("removed splash!");
180 if (typeof correctPNG != 'undefined') {
184 if (getActiveFeedId()) {
185 debug("some feed is open on feedlist refresh, reloading");
186 setTimeout("viewCurrentFeed()", 100);
190 exception_error("feedlist/init", e);