]>
git.wh0rd.org - tt-rss.git/blob - tt-rss.js
2 This program is Copyright (c) 2003-2005 Andrew Dolgov <cthulhoo@gmail.com>
3 Licensed under GPL v.2 or (at your preference) any later version.
11 /*@if (@_jscript_version >= 5)
12 // JScript gives us Conditional compilation, we can cope with old IE versions.
13 // and security blocked creation of the objects.
15 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
18 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
25 if (!xmlhttp
&& typeof XMLHttpRequest
!='undefined') {
26 xmlhttp
= new XMLHttpRequest();
29 function feedlist_callback() {
30 var container
= document
.getElementById('feeds');
31 if (xmlhttp
.readyState
== 4) {
32 container
.innerHTML
=xmlhttp
.responseText
;
34 var feedtu
= document
.getElementById("FEEDTU");
37 total_unread
= feedtu
.innerHTML
;
45 function viewfeed_callback() {
46 var container
= document
.getElementById('headlines');
47 if (xmlhttp
.readyState
== 4) {
48 container
.innerHTML
= xmlhttp
.responseText
;
50 var factive
= document
.getElementById("FACTIVE");
51 var funread
= document
.getElementById("FUNREAD");
52 var ftotal
= document
.getElementById("FTOTAL");
54 if (ftotal
&& factive
&& funread
) {
55 var feed_id
= factive
.innerHTML
;
57 var feedr
= document
.getElementById("FEEDR-" + feed_id
);
58 var feedt
= document
.getElementById("FEEDT-" + feed_id
);
59 var feedu
= document
.getElementById("FEEDU-" + feed_id
);
61 feedt
.innerHTML
= ftotal
.innerHTML
;
62 feedu
.innerHTML
= funread
.innerHTML
;
64 if (feedu
.innerHTML
> 0 && !feedr
.className
.match("Unread")) {
65 feedr
.className
= feedr
.className
+ "Unread";
66 } else if (feedu
.innerHTML
<= 0) {
67 feedr
.className
= feedr
.className
.replace("Unread", "");
77 function view_callback() {
78 var container
= document
.getElementById('content');
79 if (xmlhttp
.readyState
== 4) {
80 container
.innerHTML
=xmlhttp
.responseText
;
85 function updateFeedList(called_from_timer
, fetch
) {
87 if (called_from_timer
!= true) {
88 //document.getElementById("feeds").innerHTML = "Loading feeds, please wait...";
89 notify("Updating feeds...");
92 var query_str
= "backend.php?op=feeds";
94 if (fetch
) query_str
= query_str
+ "&fetch=yes";
96 xmlhttp
.open("GET", query_str
, true);
97 xmlhttp
.onreadystatechange
=feedlist_callback
;
102 function catchupAllFeeds() {
103 var query_str
= "backend.php?op=feeds&subop=catchupAll";
105 notify("Marking all feeds as read...");
107 xmlhttp
.open("GET", query_str
, true);
108 xmlhttp
.onreadystatechange
=feedlist_callback
;
113 function viewfeed(feed
, skip
, subop
) {
115 // document.getElementById('headlines').innerHTML='Loading headlines, please wait...';
116 // document.getElementById('content').innerHTML=' ';
118 xmlhttp
.open("GET", "backend.php?op=viewfeed&feed=" + param_escape(feed
) +
119 "&skip=" + param_escape(skip
) + "&subop=" + param_escape(subop
) , true);
120 xmlhttp
.onreadystatechange
=viewfeed_callback
;
123 notify("Loading headlines...");
127 function view(id
,feed_id
) {
129 var crow
= document
.getElementById("RROW-" + id
);
131 if (crow
.className
.match("Unread")) {
132 var umark
= document
.getElementById("FEEDU-" + feed_id
);
133 umark
.innerHTML
= umark
.innerHTML
- 1;
134 crow
.className
= crow
.className
.replace("Unread", "");
136 if (umark
.innerHTML
== "0") {
137 var feedr
= document
.getElementById("FEEDR-" + feed_id
);
138 feedr
.className
= feedr
.className
.replace("Unread", "");
146 var upd_img_pic
= document
.getElementById("FUPDPIC-" + id
);
149 upd_img_pic
.innerHTML
= "";
152 document
.getElementById('content').innerHTML
='Loading, please wait...';
154 xmlhttp
.open("GET", "backend.php?op=view&id=" + param_escape(id
), true);
155 xmlhttp
.onreadystatechange
=view_callback
;
162 updateFeedList(true);
164 setTimeout("timeout()", 1800*1000);
168 function search(feed
, sender
) {
170 notify("Search: " + feed
+ ", " + sender
.value
)
172 document
.getElementById('headlines').innerHTML
='Loading headlines, please wait...';
173 document
.getElementById('content').innerHTML
=' ';
175 xmlhttp
.open("GET", "backend.php?op=viewfeed&feed=" + param_escape(feed
) +
176 "&search=" + param_escape(sender
.value
) + "&ext=SEARCH", true);
177 xmlhttp
.onreadystatechange
=viewfeed_callback
;
182 function update_title() {
183 //document.title = "Tiny Tiny RSS (" + total_unread + " unread)";
187 updateFeedList(false, false);
188 setTimeout("timeout()", 1800*1000);