]>
git.wh0rd.org - tt-rss.git/blob - tt-rss.js
aeaac22cce562ab5a1bf27279359f8178ac7ac8c
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.
9 /*@if (@_jscript_version >= 5)
10 // JScript gives us Conditional compilation, we can cope with old IE versions.
11 // and security blocked creation of the objects.
13 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
16 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
23 if (!xmlhttp
&& typeof XMLHttpRequest
!='undefined') {
24 xmlhttp
= new XMLHttpRequest();
27 function param_escape(arg
) {
28 if (typeof encodeURIComponent
!= 'undefined')
29 return encodeURIComponent(arg
);
34 function param_unescape(arg
) {
35 if (typeof decodeURIComponent
!= 'undefined')
36 return decodeURIComponent(arg
);
41 function notify(msg
) {
43 var n
= document
.getElementById("notify");
49 function feedlist_callback() {
50 var container
= document
.getElementById('feeds');
51 if (xmlhttp
.readyState
== 4) {
52 container
.innerHTML
=xmlhttp
.responseText
;
56 function viewfeed_callback() {
57 var container
= document
.getElementById('headlines');
58 if (xmlhttp
.readyState
== 4) {
59 container
.innerHTML
= xmlhttp
.responseText
;
61 var factive
= document
.getElementById("FACTIVE");
62 var funread
= document
.getElementById("FUNREAD");
63 var ftotal
= document
.getElementById("FTOTAL");
65 if (ftotal
&& factive
&& funread
) {
66 var feed_id
= factive
.innerHTML
;
68 var feedr
= document
.getElementById("FEEDR-" + feed_id
);
69 var feedt
= document
.getElementById("FEEDT-" + feed_id
);
70 var feedu
= document
.getElementById("FEEDU-" + feed_id
);
72 feedt
.innerHTML
= ftotal
.innerHTML
;
73 feedu
.innerHTML
= funread
.innerHTML
;
75 if (feedu
.innerHTML
> 0 && !feedr
.className
.match("Unread")) {
76 feedr
.className
= feedr
.className
+ "Unread";
77 } else if (feedu
.innerHTML
<= 0) {
78 feedr
.className
= feedr
.className
.replace("Unread", "");
85 function view_callback() {
86 var container
= document
.getElementById('content');
87 if (xmlhttp
.readyState
== 4) {
88 container
.innerHTML
=xmlhttp
.responseText
;
93 function update_feed_list(called_from_timer
) {
95 if (called_from_timer
!= true) {
96 document
.getElementById("feeds").innerHTML
= "Updating feeds, please wait...";
99 xmlhttp
.open("GET", "backend.php?op=feeds", true);
100 xmlhttp
.onreadystatechange
=feedlist_callback
;
106 function viewfeed(feed
, skip
, ext
) {
108 notify("view-feed: " + feed
);
110 document
.getElementById('headlines').innerHTML
='Loading headlines, please wait...';
111 document
.getElementById('content').innerHTML
=' ';
113 xmlhttp
.open("GET", "backend.php?op=viewfeed&feed=" + param_escape(feed
) +
114 "&skip=" + param_escape(skip
) + "&ext=" + param_escape(ext
) , true);
115 xmlhttp
.onreadystatechange
=viewfeed_callback
;
120 function view(id
,feed_id
) {
122 var crow
= document
.getElementById("RROW-" + id
);
124 if (crow
.className
.match("Unread")) {
125 var umark
= document
.getElementById("FEEDU-" + feed_id
);
126 umark
.innerHTML
= umark
.innerHTML
- 1;
127 crow
.className
= crow
.className
.replace("Unread", "");
129 if (umark
.innerHTML
== "0") {
130 var feedr
= document
.getElementById("FEEDR-" + feed_id
);
131 feedr
.className
= feedr
.className
.replace("Unread", "");
135 document
.getElementById('content').innerHTML
='Loading, please wait...';
137 xmlhttp
.open("GET", "backend.php?op=view&id=" + param_escape(id
), true);
138 xmlhttp
.onreadystatechange
=view_callback
;
145 update_feed_list(true);
147 setTimeout("timeout()", 1800*1000);
151 function search(feed
, sender
) {
153 notify("Search: " + feed
+ ", " + sender
.value
)
155 document
.getElementById('headlines').innerHTML
='Loading headlines, please wait...';
156 document
.getElementById('content').innerHTML
=' ';
158 xmlhttp
.open("GET", "backend.php?op=viewfeed&feed=" + param_escape(feed
) +
159 "&search=" + param_escape(sender
.value
) + "&ext=SEARCH", true);
160 xmlhttp
.onreadystatechange
=viewfeed_callback
;
171 setTimeout("timeout()", 1800*1000);