]>
git.wh0rd.org - tt-rss.git/blob - viewfeed.js
1 var active_feed_id
= false;
2 var active_post_id
= false;
5 var xmlhttp_rpc
= false;
8 /*@if (@_jscript_version >= 5)
9 // JScript gives us Conditional compilation, we can cope with old IE versions.
10 // and security blocked creation of the objects.
12 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
15 xmlhttp_rpc = new ActiveXObject("Microsoft.XMLHTTP");
22 if (!xmlhttp_rpc
&& typeof XMLHttpRequest
!='undefined') {
23 xmlhttp_rpc
= new XMLHttpRequest();
26 function view(id
, feed_id
) {
30 var crow
= document
.getElementById("RROW-" + id
);
32 if (crow
.className
.match("Unread")) {
33 var umark
= parent
.document
.getElementById("FEEDU-" + feed_id
);
34 umark
.innerHTML
= umark
.innerHTML
- 1;
35 crow
.className
= crow
.className
.replace("Unread", "");
37 if (umark
.innerHTML
== "0") {
38 var feedr
= parent
.document
.getElementById("FEEDR-" + feed_id
);
39 feedr
.className
= feedr
.className
.replace("Unread", "");
45 cleanSelected("headlinesList");
47 var upd_img_pic
= document
.getElementById("FUPDPIC-" + id
);
50 upd_img_pic
.innerHTML
= "";
53 var unread_rows
= getVisibleUnreadHeadlines();
55 if (unread_rows
.length
== 0) {
56 var button
= document
.getElementById("btnCatchupPage");
58 button
.className
= "disabledButton";
64 active_feed_id
= feed_id
;
66 var content
= parent
.document
.getElementById("content-frame");
69 content
.src
= "backend.php?op=view&addheader=true&id=" + param_escape(id
);
70 markHeadline(active_post_id
);
74 function toggleMark(id
, toggle
) {
76 // notify("Toggle mark: " + id + ", " + toggle);
78 if (!xmlhttp_ready(xmlhttp_rpc
)) {
83 var mark_img
= document
.getElementById("FMARKPIC-" + id
);
85 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=mark";
88 mark_img
.src
= "images/mark_set.png";
89 mark_img
.alt
= "Reset mark";
90 mark_img
.setAttribute('onclick', 'javascript:toggleMark('+id
+', false)');
91 query
= query
+ "&mark=1";
93 mark_img
.src
= "images/mark_unset.png";
94 mark_img
.alt
= "Set mark";
95 mark_img
.setAttribute('onclick', 'javascript:toggleMark('+id
+', true)');
96 query
= query
+ "&mark=0";
99 xmlhttp_rpc
.open("GET", query
, true);
100 xmlhttp_rpc
.onreadystatechange
=rpc_notify_callback
;
101 xmlhttp_rpc
.send(null);
105 function moveToPost(mode
) {
107 var rows
= getVisibleHeadlineIds();
112 if (active_post_id
== false) {
113 next_id
= getFirstVisibleHeadlineId();
114 prev_id
= getLastVisibleHeadlineId();
116 for (var i
= 0; i
< rows
.length
; i
++) {
117 if (rows
[i
] == active_post_id
) {
124 if (mode
== "next") {
125 if (next_id
!= undefined) {
126 view(next_id
, active_feed_id
);
130 if (mode
== "prev") {
131 if ( prev_id
!= undefined) {
132 view(prev_id
, active_feed_id
);
137 function localHotkeyHandler(keycode
) {
140 return moveToPost('next');
144 return moveToPost('prev');
148 // if (keycode == 85) {
149 // return viewfeed(active_feed_id, active_offset, "ForceUpdate");
152 // alert("KC: " + keycode);