]>
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
;
19 function viewFeedGoPage(i
) {
21 if (!getActiveFeedId()) return;
24 page_offset
= page_offset
+ i
;
29 if (page_offset
< 0) page_offset
= 0;
30 viewfeed(getActiveFeedId(), undefined, undefined, undefined,
31 undefined, page_offset
);
33 exception_error(e
, "viewFeedGoPage");
37 function viewfeed(feed
, subop
, is_cat
, subop_param
, skip_history
, offset
) {
40 if (!offset
) page_offset
= 0;
45 history_push('FEED:' + feed
+ ':' + subop
+ ':' + is_cat
+
49 var toolbar_query
= Form
.serialize("main_toolbar_form");
50 var toolbar_form
= document
.forms
["main_toolbar_form"];
52 if (document
.forms
["main_toolbar_form"].query
) {
53 toolbar_form
.query
.value
= "";
56 /* storeInitParam("toolbar_limit",
57 toolbar_form.limit[toolbar_form.limit.selectedIndex].value);
59 storeInitParam("toolbar_view_mode",
60 toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value); */
62 var query
= "backend.php?op=viewfeed&feed=" + feed
+ "&" +
63 toolbar_query
+ "&subop=" + param_escape(subop
);
65 if (document
.getElementById("search_form")) {
66 var search_query
= Form
.serialize("search_form");
67 query
= query
+ "&" + search_query
;
71 debug("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat
);
73 var fe
= document
.getElementById("FEEDR-" + getActiveFeedId());
76 fe
.className
= fe
.className
.replace("Selected", "");
79 setActiveFeedId(feed
);
81 if (is_cat
!= undefined) {
82 active_feed_is_cat
= is_cat
;
85 if (subop
== "MarkAllRead") {
87 var feedlist
= document
.getElementById('feedList');
89 var next_unread_feed
= getRelativeFeedId(feedlist
,
90 getActiveFeedId(), "next", true);
92 if (!next_unread_feed
) {
93 next_unread_feed
= getRelativeFeedId(feedlist
,
97 var show_next_feed
= getInitParam("on_catchup_show_next_feed") == "1";
99 if (next_unread_feed
&& show_next_feed
&& !activeFeedIsCat()) {
100 query
= query
+ "&nuf=" + param_escape(next_unread_feed
);
101 setActiveFeedId(next_unread_feed
);
105 if (activeFeedIsCat()) {
106 query
= query
+ "&cat=1";
110 query
= query
+ "&skip=" + offset
;
113 if (navigator
.userAgent
.match("Opera")) {
114 var date
= new Date();
115 var timestamp
= Math
.round(date
.getTime() / 1000);
116 query
= query
+ "&ts=" + timestamp
119 if (!activeFeedIsCat()) {
120 var feedr
= document
.getElementById("FEEDR-" + getActiveFeedId());
121 if (feedr
&& !feedr
.className
.match("Selected")) {
122 feedr
.className
= feedr
.className
+ "Selected";
126 disableContainerChildren("headlinesToolbar", false);
127 Form
.enable("main_toolbar_form");
131 /* var container = document.getElementById("headlines-frame");
133 container.innerHTML = "<div class=\"loadingPrompt\"><img src=\"images/indicator_white.gif\"> " +
134 "Loading, please wait...</div>"; */
136 notify("Loading, please wait...", true);
140 if (xmlhttp_ready(xmlhttp)) {
141 xmlhttp.open("GET", query, true);
142 xmlhttp.onreadystatechange=headlines_callback;
145 debug("xmlhttp busy (@feeds)");
149 exception_error("viewfeed", e);
153 function toggleCollapseCat(cat) {
155 if (!xmlhttp_ready(xmlhttp)) {
160 var cat_elem = document.getElementById("FCAT-" + cat);
161 var cat_list = document.getElementById("FCATLIST-" + cat).parentNode;
162 var caption = document.getElementById("FCAP-" + cat);
164 if (cat_list.className.match("invisible")) {
165 cat_list.className = "";
166 caption.innerHTML = caption.innerHTML.replace("...", "");
168 setCookie("ttrss_vf_uclps", "0");
171 cat_list.className = "invisible";
172 caption.innerHTML = caption.innerHTML + "...";
174 setCookie("ttrss_vf_uclps", "1");
178 new Ajax.Request("backend.php?op=feeds&subop=collapse&cid=" +
182 exception_error("toggleCollapseCat", e);
186 function feedlist_init() {
188 // if (arguments.callee.done) return;
189 // arguments.callee.done = true;
191 debug("in feedlist init");
193 hideOrShowFeeds(document, getInitParam("hide_read_feeds") == 1);
194 document.onkeydown = hotkey_handler;
195 setTimeout("timeout()", 0);
197 debug("about to remove splash, OMG!");
199 var o = document.getElementById("overlay");
202 o.style.display = "none";
203 debug("removed splash!");
206 if (typeof correctPNG != 'undefined') {
210 if (getActiveFeedId()) {
211 debug("some feed is open on feedlist refresh, reloading");
212 setTimeout("viewCurrentFeed()", 100);
216 exception_error("feedlist/init", e);